ffmpeg rtsp问题总结
//--------------------------------------------------------------------------------------------------
https://www.cnblogs.com/jixiaohua/p/14543076.html
发生场景
使用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);
//--------------------------------------------------------------------------------------------------
https://www.zhangshilong.cn/work/405366.html
场景:读取本地文件
错误:
error while decoding MB 98 45, bytestream -6error while decoding MB 64 60,
bytestream -8error while decoding MB 73 52, bytestream -12missing picture
in access unit with
size 12116 No start code is found. Error splitting the input into NAL units.
解决办法:
读取文件时调用av_usleep(1000)
总结:不管读取本地还是网络视频,都不能一股脑读取,中间需要sleep
//--------------------------------------------------------------------------------------------------
https://www.codeprj.com/blog/ab2d3c1.html
问题现象
[rtsp @ 0000000000122bc0] max delay reached. need to consume packet
[rtsp @ 0000000000122bc0] RTP: missed 33 packets
[rtsp @ 0000000000122bc0] max delay reached. need to consume packet
[rtsp @ 0000000000122bc0] RTP: missed 166 packets
[h264 @ 0000000002f4b280] out of range intra chroma pred mode
[h264 @ 0000000002f4b280] error while decoding MB 27 39
[h264 @ 0000000002f4b280] concealing 502 DC, 502 AC, 502 MV errors in P f
[h264 @ 0000000002ed08c0] Increasing reorder buffer to 8
解决方法:
采用以下命令进行拉流转发,运行了几个小时,几乎没有出现丢包现象
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.168/0 -vcodec copy -f rtsp rtsp://192.168.1.28/11
//--------------------------------------------------------------------------------------------------