[FFmpeg-user] Cut part of a video, crop it and blackout parts of it

Cecil Westerhof Cecil at decebal.nl
Mon Apr 5 12:58:51 EEST 2021


Michael Koch <astroelectronic at t-online.de> writes:

> Am 05.04.2021 um 01:48 schrieb Cecil Westerhof via ffmpeg-user:
>> I have to cut out a part of a video, crop it and blackout two parts.
>> I do this with:
>>      ffmpeg -y                                      \
>>             -ss 00:19:49                            \
>>             -i  2021-03-25ToastmastersClubAvond.mp4 \
>>             -to 442                                 \
>>             -vf "
>>                  crop = 1440:1080:240:0
>>                  ,
>>                  drawbox=enable='between(t, 0, 2)'     :
>>                     color     = black                  :
>>                     w         = in_w                   :
>>                     h         = in_h                   :
>>                     thickness = fill
>>                  ,
>>                  drawbox=enable='between(t, 339, 342)' :
>>                     color     = black                  :
>>                     w         = in_w                   :
>>                     h         = in_h                   :
>>                     thickness = fill
>>             "                                       \
>>             -acodec copy                            \
>>             -vcodec libx264                         \
>>             -crf    23                              \
>>             speechClean2.mp4
>>
>> The reason I do -to in the output is that in this way the metadata
>> concerning the video length is less out of whack.
>>
>> I was wondering if this is a good way, or that it could be done
>> better?
>> Also, beside the timestamps the parameters for drawbox are the same.
>> Is there a way that I do not have to repeat them?
>
> drawbox=enable='bitor(between(t, 0, 2),between(t, 339, 342))'

Works like a charm.

Strange thing is that it seems to be much faster. About 20%. To much
to be because of different load I think.
But I am not complaining. ;-)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list