[FFmpeg-user] Hiding part of a video

Leo Butler leo.butler81 at googlemail.com
Sat Mar 27 02:18:43 EET 2021

Cecil Westerhof via ffmpeg-user <ffmpeg-user at ffmpeg.org> writes:

> Carl Zwanzig <cpz at tuunq.com> writes:
>> On 3/26/2021 2:09 AM, Cecil Westerhof via ffmpeg-user wrote:
>>> I publish speeches I give during zoom meetings. The problem is that
>>> some people forget to mute themselves and when they make a sound they
>>> will appear in the video. Luckily most time people do not have a
>>> problem with that. But if they would, what would the best way to hide
>>> them?
>> Pull the video into some editing software and drop in a few replacement
>> frames when needed. You could do this with ffmpeg, but it's probably
>> going to be simpler in the long run with with purpose-built editing
>> software* (FOSS editors often use ffmpeg libraries inside, I know
>> shotcut does).
>> *openShot, Kdenlive, VidCutter, Shotcut, etc
>> (You might be able to build a house with just a Swiss Army knife, but
>> it'll be easier if you also have a hammer.)
> In the past I tried a few. (One was Kdenlive.) I found that quite
> cumbersome. That is why I wrote some scripts to do the work for me.
> But that was quite some time ago. So maybe it is better now.

If the offending speakers appear in a well-defined region, you can use a
combination of crop, pad and overlay filters. I did something similar
for a zoom recording with

ffmpeg -y -i $part1 -filter_complex 'split[v0][v1]; [v0]crop=x=0:y=0:w=1360, pad=width=1814:height=1008[v2]; [v1]crop=x=1360:y=250:w=454:h=260, pad=width=1814:height=1008:x=0:y=0:color=black at 0xff[v3]; [v2][v3]overlay=x=1360:y=0[v]' -map '[v]' -map 0:a -c:a copy ${part1t}

I can explain what is going on here, but basically [v2] contains the
'good' region of the frame, and [v3] is set up to contain a black frame
that is overlaid on [v2].


More information about the ffmpeg-user mailing list