[Libav-user] H264 multithreading

Andrey Shvyrkin ashvyrkin at gosniias.ru
Thu Nov 20 15:39:06 CET 2014

If I use the H264 parser:

av_parser_parse2(parser, avCodecContext, &avpkt.data, &avpkt.size, 
correctedBufferPtr, correctedFrameSize, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);

and enabled multithreading:

avCodecContext->thread_count = 0;
avCodecContext->thread_type = FF_THREAD_SLICE | FF_THREAD_FRAME;

  appear artifacts when decoding streams, and sometimes there are warnings:

Cannot use next picture in error concealment ... errors in P frame

If I use avCodecContext->flags2 |= CODEC_FLAG2_CHUNKS, all streams are 
decoded without lags and errors, but it disable multithreading

More information about the Libav-user mailing list