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

Cecil Westerhof Cecil at decebal.nl
Mon Apr 5 14:33:54 EEST 2021


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

> Am 05.04.2021 um 11:58 schrieb Cecil Westerhof via ffmpeg-user:
>> 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. ;-)
>
> If you want to cover the whole frame size, you could also use this (for
> 50% gray):
> eq=enable='bitor(between(t, 0, 2),between(t, 339, 342))':contrast=0
> or add :brightness=-0.5 if you want black.
> It might be faster than drawbox.

I will try that out later. At the moment I am working with the
different preset values. It seems that veryfast is still the best. And
that you really should not use ultrafast.

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


More information about the ffmpeg-user mailing list