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

Peter White peter.white at posteo.net
Sat Mar 27 04:38:10 EET 2021

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.

> 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.


More information about the ffmpeg-user mailing list