[FFmpeg-devel] [FEATURE] Cut a video (-ss) with timings non-aligned on keyframes, with minimal re-encoding

basj at gget.it basj at gget.it
Mon Jul 21 00:54:09 EEST 2025


Hi,

Out of curiosity, has there been any progress since 1 year about this topic?

Really, millions of CPU-hours are probably wasted to reencode already-perfectly-encoded content, just for cutting purposes. For example, is there a way to cut a AVI or MKV H264 video with a specific starting point and specific length, with minimal re-encoding?

When using: "ffmpeg -ss 120 -t 60 -i input.mp4 -c copy output.mp4", the result is often choppy or non-smooth in the first seconds, because the cut point doesn't necessarily coincide with a keyframe, at least on some players. 

We could reencode just the beginning until the next keyframe, and then use copy codec for the rest of the video, and then concatenate, but nobody does this, it's unnecessarily complex (and I'm not even sure it works).

20 Aug 2024, 22:34, michael at niedermayer.cc wrote:

> Such signalling can be added to existing containers with little effort.
> Iam also happy to help to add it to nut

Can you explain with a little bit more details how it would work? Thanks in advance!

All the best.


More information about the ffmpeg-devel mailing list