ffmpeg解码h264 Increasing reorder buffer

开发环境

Windows10 x64,vs2017,ffmpeg版本:4.3.1

发生场景

使用live555 mediaServer启动rtsp server,然后使用testRTSPClient程序拉流,ffmpeg解码,在视频开头几帧出现该警告,结果导致播放画面闪烁,rtsp client不论使用UDP还是TCP均有该问题,接收缓存足够大

解决方法

经Google[h264 @ 0x28819a0] Increasing reorder buffer to 1相关问题,可以在解码时设置-strict 1参数,让ffmpeg使用更高的重排序计数,代码:

AVDictionary *dict = NULL;
av_dict_set(&dict, "strict", "1", 0);
avcodec_open2(ctx, codec, dict); // 参数 AVCodecContext *ctx, AVCodec *codec
av_dict_free(&dict);

参考

  1. https://github.com/FFMS/ffms2/issues/301
  2. https://trac.ffmpeg.org/ticket/5439
posted @ 2021-03-16 13:50  jixhua  阅读(1420)  评论(0编辑  收藏  举报