ffmpeg rtsp问题总结

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

//--------------------------------------------------------------------------------------------------

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值