[x264-devel] Re: using B-frames
Alex Izvorski
aizvorski at gmail.com
Thu Mar 15 06:05:02 CET 2007
On Tue, 2007-03-13 at 10:32 -0700, Axel Gunter wrote:
> I tried posting this at the ffmpeg-dev list but got no responses, trying
> here since it pertains to x264 as well. Apologies for duplication.
> -----------
> Hi Experts,
>
> Do we know of any known problem using h264 video codec and having
> B-frames? I am using mpegts as the transport.
>
> when using the command below the output video looks jerky with frames
> being rendered out of order (some problem with timestamps using B-frames?)
> ./ffmpeg -i source.ts -vcodec h264 -s 320x240 -refs 4 -bf 2 -y -f mpegts
> -acodec copy output.ts
>
> However, when I disable B-frames using the command below, the video is
> better (VLC says dropping late frames, but that might be a decoder
> problem). At least the time stamps seem to be ok.
> ./ffmpeg -i source.ts -vcodec h264 -s 320x240 -refs 4 -bf 0 -y -f mpegts
> -acodec copy output.ts
>
>
> Has anyone seen this behavior before? Any help is appreciated.
>
> -Axel
Hello Axel,
x264 essentially does not care about timestamps - it gets frames in what
it assumes is the display order, and returns them in the correct
decoding/transmission order based on that assumption. There is a field
for a timestamp (the PTS, in MPEG2 terms) in the input frames which is
copied to the correct output frames, but otherwise completely ignored by
x264 ;) So the question is, does the ffmpeg muxer screw it up? and the
answer is, probably yes.
There *is* a way to set explicit frame timestamps in H.264: I believe it
requires sending a picture timing SEI message before each frame
(payloadType==1, defined in Annex D.1.2 in the standard). However (a)
x264 doesn't do this and (b) this is probably something better done at
the container level and (c) most playback programs/devices probably just
ignore it anyway and use the container timestamps instead.
I don't know much about ffmpeg, but I do know x264 and B-frames works
fine in mencoder, and also there is a big warning about using
libavformat muxers with B-frames in mencoder ;)
Regards,
--Alex
--
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html
More information about the x264-devel
mailing list