[Libav-user] Difference between AVCodecParserContext->parser->parser_parse() and avcodec_decode_video2()

Tim van den Kerkhof tim.van.den.kerkhof at vinotion.nl
Fri Jun 10 15:13:05 CEST 2011


On 06/10/2011 02:47 PM, Hendrik Leppkes wrote:
> Hi,
>
> You must've missed part of the mplayer code.
> The parser is only that, a parser. It parses the data, extracts some
> metadata and puts complete frames back together, it doesn't do any
> actual decoding.
> For decoding you'll always have to use avcodec_decode_video2.
>
> In my experience, you'll usually want to do both, but that depends on
> the source of the content.
>
> Regards,
>
> Hendrik
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
Hi,

Thank you for your response.
I indeed mist a part of the Mplayer code, where they use 
avcodec_decode_video2.
Can you give me some pointers on how to use avcodec_decode_video2 when 
all I have is an unsigned char* buffer?
I already tried adding 0x000001 as the first three bytes of the buffer 
(and resizing it to len+FF_INPUT_BUFFER_PADDING_SIZE) and then storing 
it as AVPacket.
avcodec_decode_video2() then fails with these errors:

[h264 @ 0x203d720]non-existing PPS 0 referenced
[h264 @ 0x203d720]decode_slice_header error
[h264 @ 0x203d720]no frame!

Is there something small forgot or is the decoding of H264 not as simple 
as I hoped?

Regards,

Tim


More information about the Libav-user mailing list