[x264-devel] Appending an iFrame to the start of a h264 video?
Cary Fitzhugh
cfitzhugh at echo360.com
Mon Jul 14 17:43:56 CEST 2008
Hello all - thanks for the help. I got sidetracked late last week - but I'm back on this again.
I checked - and if I just run ffmpeg with the output as h264 - it seems to work and give me raw h264 frames (first few
bytes are 0)
Now - i'm looking into it, and there is something funky with the data. I'm no h264 expert, so maybe you all could point
me in the right direction?
If I cat the two files together and try to play them, it falls apart after the edit point.
Things I am seeing:
If I output from ffmpeg to h264 it seems to 'work'. I.e. nothing funky in the file headers.
I try to play it in VLC I get "non existing PPS referenced" and "no frame"...
I would guess that is b/c there are some parameters set by the initial iframe
If I output from ffmpeg to mp4, then extract with MP4Box (MP4Box -add f.mp4 -raw 1 f.h264)
I look in the file and see three 000 to start, but then a bunch of MP4 atoms?
It plays ok in vlc.
Diffing the two files (ffmpeg->h264 and then ffmpeg->mp4->h264) shows a difference in the header,
then every (I'm guessing frame) so often a bit or two is twiddled. But it would look like the encoded data is the same.
But somehow it plays in vlc, but the h264 that I would get directly from ffmpeg doesn't?
Now I'm thinking that the best thing may be to edit it on the iframe, because combining things on the iframes seems to
work. But how can I reliably find the exact frame which is an iframe?
Any ideas?
Thanks again,
Cary
Tomas Carnecky wrote:
> Make sure ffmpeg is producing raw .264 files (with no headers or such).
> A simple check is to see if the first three of four bytes of the file
> are (0x00) 0x00 0x00 0x01.
>
> tom
>
> Cary Fitzhugh wrote:
>> Thanks for the reply!
>>
>> I'll keep looking if you all think it is possible.
>> I may be getting tripped up by ffmpeg adding some header information onto the front. I'm not sure.
>>
>> At least I have a clue that it may be possible.
>>
>> Thanks so much,
>> Cary
>>
>> Alex Giladi wrote:
>>> "cat movie1.264 movie2.264 > longer_movie.264 " should suffice, AFAIK.
>>>
>>> On Wed, Jul 9, 2008 at 12:41 PM, Cary Fitzhugh <cfitzhugh at echo360.com> wrote:
>>>> 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
>>>> _______________________________________________
>>>> x264-devel mailing list
>>>> x264-devel at videolan.org
>>>> http://mailman.videolan.org/listinfo/x264-devel
>>>>
>>> _______________________________________________
>>> x264-devel mailing list
>>> x264-devel at videolan.org
>>> http://mailman.videolan.org/listinfo/x264-devel
>>>
>>>
>> _______________________________________________
>> x264-devel mailing list
>> x264-devel at videolan.org
>> http://mailman.videolan.org/listinfo/x264-devel
>>
>
> _______________________________________________
> x264-devel mailing list
> x264-devel at videolan.org
> http://mailman.videolan.org/listinfo/x264-devel
>
>
More information about the x264-devel
mailing list