[Libav-user] Frame order from TS demux - mpeg2video vs h264

Kalileo kalileo at universalx.net
Thu May 3 12:23:08 CEST 2012


On Apr 30, 2012, at 23:53 , jettoblack wrote:

> On Mon, Apr 30, 2012 at 2:51 AM, Kalileo [via libav-users] <
> ml-node+s943685n4597541h88 at n4.nabble.com> wrote:
> 
>> 
>> The decoder gives you the (decoded) pictures in the correct order.
>> 
>> 
> That's what I expected, and it does for MPEG-2 codec video, but not for
> H.264 codec within a MPEG-2 transport stream.

It does. Otherwise there would be no way to display h264 video correctly ;)

As i said, and as also Andrey Utkin pointed out, the correct order for display is in the pts value, and after decoding (not after demuxing) the pictures/frames should be in pts order, ready for display.

> 
>> I would try to attach the metadata in the order as you get it from the
>> demuxer with the pictures as you get them out of the decoder.
>> 
> 
> I tried that

No you haven't.

> and for H.264 it's definitely wrong if I use the frames
> in-order from the demuxed.

as said, for h264 with b frames you need the order _not_ "as demuxed" but "as decoded", and I'm not talking about any 'coded_picture_number' but about the order of the h264 frames as the decoder returns them. That is the correct order, and the pts should reflect that order. If it doesn't, trust the order the decoder gives you over the pts.

>  It does work fine for MPEG-2 video.

but not in h264 because in h264 the coded frames are reordered depending on which frame is needed for decoding first, not which frame is to be displayed first.

> 
> Should I file a bug report?

No. You expect info from the demuxer which is not there.




More information about the Libav-user mailing list