解决ffmpeg拉流转发频繁丢包问题max delay reached. need to consume packet
软件:
1、流媒体服务器EasyDarwin-windows-8.1.0-1901141151
2、ffmpeg-20181001-dcbd89e-win64-static
3、直播源:rtsp://192.168.1.168/0
4、流媒体服务器EasyDarwin地址rtsp://192.168.1.28/3
问题现象
[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 frame= 964 fps= 30 q=29.0 size=N/A time=00:00:33.26 bitrate=N/A dup=141 frame= 999 fps= 31 q=29.0 size=N/A time=00:00:33.77 bitrate=N/A dup=170 [rtsp @ 0000000000122bc0] max delay reached. need to consume packet [rtsp @ 0000000000122bc0] RTP: missed 12 packets [h264 @ 0000000002ed1000] corrupted macroblock 55 32 (total_coeff=-1) [h264 @ 0000000002ed1000] error while decoding MB 55 32
解决方法:
采用以下命令进行拉流转发,运行了几个小时,几乎没有出现丢包现象
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.168/0 -vcodec copy -f rtsp rtsp://192.168.1.28/11
原因:这是rtsp协议默认使用udp导致的问题,所以rtsp强制使用tcp方式可以一定程度避免丢包。
如果是拉rtsp转rtmp,命令是(没测试)
ffmpeg -rtsp_transport tcp -i rtsp://admin:password@192.168.1.11:554 -vcodec copy -f flv -an rtmp://localhost/live/tests