Forumsee logo

Cut beginning of h264 video with minimal re-encoding?

MPEG-4 AVC / H.264 - Doom9's Forum - forum.doom9.org
Ffmpeg makes it super easy to losslessly cut off the end of an existing h264 stream: you just use -codec copy alongside -t or -to to specify how long you want the clip to be.

Cutting off the beginning of a stream with -ss, however, does not work so well. I always end up with a corrupted second or two of video at the beginning of the resulting clip.

I understand why this is—h264 frames cannot exist independently, as they rely on information from previous frames. As a result, some frames will always have to be re-encoded—but I should be able to avoid re-encoding everything, right?

How can I cut a portion from the beginning of an h264 stream while re-encoding only the minimum number of frames required? I would prefer to do this via ffmpeg, if possible

Thanks!


Read responses in forum.doom9.org

Last videos:

Hilary Hahn & Josh Ritter
Hilary Hahn & Josh Ritter
Whiskey Cavalier on ABC with Lauren Cohan
Whiskey Cavalier on ABC with Lauren Cohan
Pose on FX
Pose on FX
Safe - Netflix Series
Safe - Netflix Series
Nobody else on the planet has this...
Nobody else on the planet has this...
The Innocents - Netflix Series
The Innocents - Netflix Series
Sacred Games Series - Netflix
Sacred Games Series - Netflix
Another out of box thought; Exciter Panel speakers ; Interesting
Another out of box thought; Exciter Panel speakers ; Interesting
Cars · 
Mobility · 
Hardware · 
Motorbikes · 
Travel · 
Boating · 
Aviation · 
production-backend
About Forumsee · Contact · Privacy policy · Request content removal
We use cookies for navigation analysis and personalized advertisement. By using our site, you agree to our use of cookies.
Accept  ·  Learn more