[Libav-user] decoding movies: how to decode 'unordered' frames?

Philipp Beyer phi-b at gmx.de
Tue Mar 20 18:07:25 CET 2012


Hi to all,

Im trying to decode videos with libavformat/codec. I have a few movies with video frames not perfectly ordered in dts order.

The (partial) output of ffprobe for the first video frames looks like this, for example:


[FRAME]
codec_type=video
pict_type=I
coded_picture_number=0
display_picture_number=0
repeat_pict=0
reference=3
stream_index=1
pkt_pts=0.000000 
pkt_dts=N/A
pkt_duration=0.040000 
file_pkt_nb=4
stream_pkt_nb=1
pkt_flag_key=K
[/FRAME]
[FRAME]
codec_type=video
pict_type=B
coded_picture_number=2
display_picture_number=0
interlaced_frame=0
repeat_pict=0
reference=0
stream_index=1
pkt_pts=0.040000 
pkt_dts=0.040000 
pkt_duration=0.040000 
file_pkt_nb=6
stream_pkt_nb=3
pkt_flag_key=_
[/FRAME]
[FRAME]
codec_type=video
pict_type=P
coded_picture_number=1
display_picture_number=0
repeat_pict=0
reference=3
stream_index=1
size=104702.000000 
pkt_pts=0.080000 
pkt_dts=0.000000 
pkt_duration=0.040000 
file_pkt_nb=5
stream_pkt_nb=2
pkt_flag_key=_
[/FRAME]

So, basically decoding timestamps for the first 3 frames are:
n/a - 0.04 - 0

Trying to decode this movie with libavformat/codec results in frame 1 (dts=0.04) being skipped. This seems to be perfectly correct for my understanding, packets have to be stored in dts order to add up to a valid video stream.

However, requirements are to decode all frames, and interestingly, ffmpeg accomplishes it without complaining.

So my question is: What's the simplest thing to do to decode such badly ordered frames? I cannot find provisions in ffmpeg.c for this, so I guess I do not have to order packets by myself. Is there a special flag I am missing?

Thanks


-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a


More information about the Libav-user mailing list