[x264-devel] Re: using B-frames

Michael Niedermayer michaelni at gmx.at
Sat Mar 17 18:48:13 CET 2007


Hi

On Wed, Mar 14, 2007 at 09:05:02PM -0800, Alex Izvorski wrote:
> 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 ;)

no sorry, mencoder is the program which doesnt support muxing b frames
correctly, mencoder is designed around AVI which has no PTS so it "works"
with avi output but as soon as you use non avi (lavf) PTS would be needed
and mencoder simply doesnt pass pts around so the muxer (lavf) gets
none ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.videolan.org/pipermail/x264-devel/attachments/20070317/3da7d3de/attachment.pgp 


More information about the x264-devel mailing list