[FFmpeg-devel] h264: dealing with "broken links"

Reinhard Nissl rnissl
Sun Nov 18 23:48:43 CET 2007


in the thread "[PATCH] Enable PAFF decoding", Loren Merritt wrote, that
H.264's "closed gop" implementation are IDR slices. When I start
replaying a VDR recording at an I frame which is coded with IDR slices,
I can successfully watch the recording.

But I've got some samples from Russia which contain very few IDR coded I
frames so, most often replay starts at an I frame which was coded with
non IDR slices. But in that case, FFmpeg decodes the I frame properly
but then runs out of frames when dealing with the B frame.

It reports [h264 @ 0xb61bb2f0]warning: first frame is no keyframe
and then gotos to a location in MPV_frame_start() where it allocates a
further frame. This "loop" continues until all 32 frames are allocated,
where replay terminates with an error.

A debug version would have asserted before entering the loop:

assert(s->pict_type != B_TYPE); //these should have been dropped if we
don't have a reference

But I'm a bit pointless where this should have been done. Attached is a
hack which patches pict_type to P_TYPE in that case, which makes the
sample play properly. As I do not get any errors regarding picture
referencing, I think it is legal to try to replay "broken links"
although they do not start with IDR slices.

Dipl.-Inform. (FH) Reinhard Nissl
mailto:rnissl at gmx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: h264-handle_broken_link.diff
Type: text/x-patch
Size: 705 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071118/2920cdc6/attachment.bin>

More information about the ffmpeg-devel mailing list