[FFmpeg-user] Cutting out part of a video does not work

Cecil Westerhof Cecil at decebal.nl
Sat Mar 27 07:18:59 EET 2021

Peter White <peter.white at posteo.net> writes:

> On Fri, Mar 26, 2021 at 05:28:40PM +0100, Cecil Westerhof via ffmpeg-user wrote:
>> Peter White <peter.white at posteo.net> writes:
>> > On Fri, Mar 26, 2021 at 09:55:21AM +0100, Cecil Westerhof via ffmpeg-user wrote:
>> >> I want to publish a speech I gave during a Zoom meeting. But cutting
>> >> it out does not work.
>> >> 
>> >> When I use:
>> >>     ffmpeg -y -i 2021-03-25ToastmastersClubAvond.mp4 -ss 1190 -to 1631
>> >> -acodec copy -vcodec copy -async 1 speech.mp4
>> >> 
>> >> The video starts just a bit to late. But when I use:
>> >>     ffmpeg -y -i 2021-03-25ToastmastersClubAvond.mp4 -ss 1185 -to 1631
>> >> -acodec copy -vcodec copy -async 1 speech.mp4
>> >> 
>> >
>> > If you can live with further quality loss in the video, you can
>> > transcode it, i.e. -c:v libx264.
>> >
>> I now use:
>>     ffmpeg -y -ss 1189 -i 2021-03-25ToastmastersClubAvond.mp4 -to 442
>> -acodec copy -vcodec libx264 -crf 8 -async 1 speech.mp4
> CRF 8 seems excessive. Try 16 for a start. From various online sources I
> gathered that it is pretty much transparent, as in no noticeable
> difference to the original. My own experience shows the same.

So crf is useful? (Other post said not.) I am now running it without
crf (and async). When it is finished I will try it with crf 16.

>> This takes about 8 minutes instead of a second. But I have to live
>> with that.
> You could try to do this in multiple stages, maybe. Only transcode the
> first few seconds up to the next keyframe and then stitch that and the
> copied rest together. In theory this should work, but may be not as easy
> to achieve. Obviously the codecs, frame rates and resolutions need to
> match. I guess codec parameters need to match as well, not sure. The
> question is if it is worth the effort.

I was thinking about a variant of this. Create a few seconds of the
start and a few seconds of the end until I entered the correct values
and then generate the complete file.

It seems that without crf the video is generated faster. It now only
took five minutes. (But maybe my computer was doing less.) It is a lot
smaller: 41.5 MB instead of 147.8 MB.

Now trying with crf 16. And then comparing the video quality.

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

More information about the ffmpeg-user mailing list