[x264-devel] Appending an iFrame to the start of a h264 video?

Cary Fitzhugh cfitzhugh at echo360.com
Wed Jul 9 20:41:42 CEST 2008


Hello --

I'm trying to figure out if there is a way to concatenate two h264 files without reencoding.

I am making edits of longer h264 videos.
In order to make sure that my video starts on an iFrame - I want to use ffmpeg to encode a single frame at the start 
time.  Then in a subsequent call - do a -vcodec copy on the rest of the edit.

This provides me with 2 h264 movies.  One is 1 frame long and is an iframe.  The second movie is the rest of the edit.

I do not understand the h264 codec well enough - which is why I'm writing you all.  It makes sense in my head, that if I 
were to just concatenate the raw h264 files together and wrap it I should have a valid h264 file.

In my movies I do not have B frames, just P and I frames.  My understanding is that P frames are only moving forward. 
So prepending that initial i frame onto the front of the edit should work fine.

I tried this, and when I combined the two it got very swirly and messed up on vlc.

ANy ideas if this is possible?  I would really like to do this no matter how convoluted I need to get.  When I'm editing 
1 - 4 hour movies all the time I would rather not wait 20% of real time to make an edit - just for that first iframe.

Thanks for any insight into this.

Cary FitzHugh


More information about the x264-devel mailing list