When I try to decode packet (using this function avcodec_decode_video2) sometimes I get corrupt (gray) frame. This error is obtained because of the missed frames. ffmpeg shoes the following errors to the log:
[hevc @ 000000000379b680] Could not find ref with POC 43 [hevc @ 000000000379b1c0] Duplicate POC in a sequence: 17. [hevc @ 000000000379b1c0] Error parsing NAL unit #0.
I wanted to solve this problem by strictly adjusting the context of the decoder using the following flags: AV_EF_EXPLODE and AV_EF_AGGRESSIVE. Unfortunatly it didn't help, errors continue appear in log, but avcodec_decode_video2 gives away corrupt frame.
AVCodecContext* context = avcodec_alloc_context3(codecId);
avctx->flags2 |= AV_CODEC_FLAG2_FAST; // Known encoder's bugs handling.
avctx->workaround_bugs = AV_EF_EXPLODE | AV_EF_AGGRESSIVE;
avctx->err_recognition = 0;
avctx->error_concealment = 0; // Threads.
avctx->thread_count = 4;
avctx->thread_type = FF_THREAD_FRAME;
.....
avcodec_decode_video2(avctx, picture, got_picture_ptr, avpkt);
....
What do I need to do to ensure that corrupted frames are not repeated? Maybe I need to configure the context a little differently?
P.S. you can see ffmpeg version in attachment
-- attachment