[Libav-user] Parsing H264 SPS and PPS nal unit types

Ivan Roubíček Ivan.Roubicek at zld.cz
Thu Jul 30 09:20:25 CEST 2015

Hello guys,
what would be the correct way to parse H264 SPS nad PPS so I can get width, height, etc.

I'm trying something like this but it does nothing

AVCodecParserContext *parser = av_parser_init(AV_CODEC_ID_H264);

AVCodec *pCodec = avcodec_find_decoder(AV_CODEC_ID_H264);
AVCodecContext *pCodecCtx = avcodec_alloc_context3(pCodec);

pCodecCtx = avcodec_alloc_context3(pCodec);

uint8_t* poutbuf = nullptr;
int poutbuf_size = 0;

int len = av_parser_parse2(parser, pCodecCtx, &poutbuf, &poutbuf_size, pSps, sps_size, 0, 0, 0);

Best regards Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20150730/5608e232/attachment.html>

More information about the Libav-user mailing list