[FFmpeg-devel] [PATCH]: Fix decoding of mpegts streams with h264 video that does *NOT* have b frames
mike.scheutzow at alcatel-lucent.com
Thu Apr 28 16:14:26 CEST 2011
Tony Strauss wrote:
> Basically, the earlier patch made h264_parse() invoke
> ff_h264_decode_extradata() the first time through. The problem,
> however, is that the H264Context that was passed in belongs to the
> AVCodecParserContext and is uninitialized. In particular, low_delay =
> 0 and that eventually leads to has_b_frames = 1. My fix is to split
> off a new ff_h264_context_init() function from ff_h264_decode_init();
> this will initialize the AVCodecParserContext's H264Context and also
> invoke ff_h264_decode_extradata().
This problem was more difficult to solve than I expected. I've attached
a patch which takes a different approach than Tony's patch.
One of the causes of this bug is that the h264 parser defaults low_delay
to 1, but the h264 codec defaults low_delay to 0. Really Ugly.
After many hours of looking at this, I'm still not sure how has_b_frames
is *intended* to behave, but to me the implementation appears way more
complicated than it ought to be.
My patch relies on the encoder to set an optional field in the SPS. This
works for libx264 streams, but I'm not sure that all h264 encoders will
P.S. Tony: did you try '-vcodec copy'? For me, your patch crashes with a
null ptr exception.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the ffmpeg-devel