[Libav-user] Fastest possible stream parsing

Robert Krüger krueger at lesspain.de
Wed Mar 6 17:40:00 CET 2013

On Thu, Feb 28, 2013 at 12:35 PM, Robert Krüger <krueger at lesspain.de> wrote:
> On Thu, Feb 28, 2013 at 10:32 AM, Tocy <zyvj at qq.com> wrote:
>> i think you can consider av_parser_parse2 function
> That looks indeed promising. I will try that. Thank you!
> Robert

I am still trying to understand if this will work by looking at the
code and hacking debug output into the code of h264_parser.c and

I have a sample camera file for which only the first frame is reported
as a keyframe when decoding it (AVFrame.key_frame) but for some frames
AVCodecParserContext.keyframe is set to 1 and that would absolutely
make sense taking into account what I know about the camera's GOP size
from other sources. However, the field
AVCodecParserContext.convergence_duration is never set to any other
value but 0 and judging by its documentation it looks like it is the
one I should really use to identify recovery points when parsing the
stream. It would be nice if someone with knowledge of ffmpeg's h264
internals could tell me if I can use this to identify recovery points
in an h.264 stream or if the inconsistency between
AVCodecParserContext.keyframe and AVFrame.key_frame should be fixed or
if I'm getting it all wrong.

Thanks in advance,


More information about the Libav-user mailing list