检测错误POC的帧

时间:2018-08-03 08:09:29

标签: c++ ffmpeg decode

当我尝试解码数据包(使用此功能avcodec_decode_video2)时,有时会损坏(灰色)帧。由于缺少帧而获得此错误。 ffmpeg将以下错误记录到日志:

  

[hevc @ 000000000379b680]找不到POC 43的引用[hevc @   000000000379b1c0]序列中重复的POC:17。[hevc @   000000000379b1c0]解析NAL单元#0时出错。

我想通过使用以下标志严格调整解码器的上下文来解决此问题:AV_EF_EXPLODE和AV_EF_AGGRESSIVE。不幸的是,它没有帮助,错误继续出现在日志中,但是avcodec_decode_video2放弃了损坏的帧。

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);
....

我该怎么做才能确保不会重复出现损坏的帧?也许我需要对上下文进行一些不同的配置?

P.S。您可以在attachment

中看到ffmpeg版本

0 个答案:

没有答案