首页 > 解决方案 > ffmpeg 直播流错误:av_interleaved_write_frame(): Broken pipe

问题描述

我正在尝试使用 ffmpeg 实时流式传输视频,输入来自 UDP 源。大多数情况下它工作正常,但我可以看到以下日志行,并且 ffmpeg 停止将转换/提要推送到 rtmp 服务器。以下几行日志供参考。这个问题与到达目的地或来源的网络有关,还是我需要在 ffmpeg 命令中更改?

Wed Jun 17 07:53:22 2020 av_interleaved_write_frame(): Broken pipe
Wed Jun 17 07:53:48 2020     Last message repeated 1 times
Wed Jun 17 07:53:48 2020 av_interleaved_write_frame(): End of file
Wed Jun 17 07:53:49 2020     Last message repeated 1 times
Wed Jun 17 07:53:49 2020 [flv @ 0x40c87c0] Failed to update header with correct duration.
Wed Jun 17 07:53:49 2020 [flv @ 0x40c87c0] Failed to update header with correct filesize.
Wed Jun 17 07:53:49 2020 Error writing trailer of rtmp://ipaddress:1935/rtmp/push/test1: Broken pipe
Wed Jun 17 07:53:49 2020 [flv @ 0x48fe140] Failed to update header with correct duration.
Wed Jun 17 07:53:49 2020 [flv @ 0x48fe140] Failed to update header with correct filesize.
Wed Jun 17 07:53:49 2020 Error writing trailer of rtmp://ipaddress:1935/rtmp/push/test2: Broken pipe
Wed Jun 17 07:53:49 2020 [flv @ 0x4ccb5c0] Failed to update header with correct duration.
Wed Jun 17 07:53:49 2020 [flv @ 0x4ccb5c0] Failed to update header with correct filesize.
Wed Jun 17 07:53:49 2020 Error writing trailer of rtmp://ipaddress:1935/rtmp/push/test3: End of file
Wed Jun 17 07:53:49 2020 [flv @ 0x4725840] Failed to update header with correct duration.
Wed Jun 17 07:53:49 2020 [flv @ 0x4725840] Failed to update header with correct filesize.
Wed Jun 17 07:53:49 2020 Error writing trailer of rtmp://ipaddress:1935/rtmp/push/test4: Broken pipe
Wed Jun 17 07:53:49 2020 video:10594389kB audio:678081kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Wed Jun 17 07:53:49 2020 [libx264 @ 0x410c540] frame I:12400 Avg QP:19.58  size: 11797
Wed Jun 17 07:53:49 2020 [libx264 @ 0x410c540] frame P:359585 Avg QP:23.19  size:  1317

在下面添加 ffmpeg 命令:

ffmpeg -err_detect aggressive -fflags discardcorrupt -i udp://230.1.1.2:11000?fifo_size=5000000&overrun_nonfatal=1 -analyzeduration 25M -probesize 50M -threads 0 -vsync 1 -filter_complex [i:0x202]yadif,setdar=16/9[1out1];[i:0x202]yadif,setdar=16/9[1out2];[i:0x202]yadif,setdar=16/9[1out3];[i:0x202]yadif,setdar=16/9[1out4] -map [1out1] -map i:0x29e -c:v libx264 -x264-params nal-hrd=cbr -b:v 200k -maxrate 200k -bufsize 300k -r 15 -g 30 -profile:v baseline -level 3.0 -pix_fmt yuv420p -c:a libfdk_aac -b:a 32k -ac 2 -ar 48000 -sc_threshold 0 -s 256x144 -tune film -af aresample=async=1:min_hard_comp=0.100000:first_pts=0 -x264opts opencl -f flv rtmp://ipaddress:1935/rtmp/push/test1-map [1out2] -map i:0x29e -c:v libx264 -x264-params nal-hrd=cbr -b:v 500k -maxrate 500k -bufsize 750k -r 25 -g 50 -profile:v baseline -level 3.0 -pix_fmt yuv420p -c:a libfdk_aac -b:a 64k -ac 2 -ar 48000 -sc_threshold 0 -s 512x288 -tune film -af aresample=async=1:min_hard_comp=0.100000:first_pts=0 -x264opts opencl -f flv rtmp://ipaddress:1935/rtmp/push/test2 -map [1out3] -map i:0x29e -c:v libx264 -x264-params nal-hrd=cbr -b:v 1000k -maxrate 1000k -bufsize 1500k -r 25 -g 50 -profile:v main -level 3.0 -pix_fmt yuv420p -c:a libfdk_aac -b:a 64k -ac 2 -ar 48000 -sc_threshold 0 -s 1024x576 -tune film -af aresample=async=1:min_hard_comp=0.100000:first_pts=0 -x264opts opencl -f flv rtmp://ipaddress:1935/rtmp/push/test3 -map [1out4] -map i:0x29e -c:v libx264 -x264-params nal-hrd=cbr -b:v 1800k -maxrate 1800k -bufsize 2700k -r 25 -g 50 -profile:v main -level 3.1 -pix_fmt yuv420p -c:a libfdk_aac -b:a 64k -ac 2 -ar 48000 -sc_threshold 0 -s 1280x720 -tune film -af aresample=async=1:min_hard_comp=0.100000:first_pts=0 -x264opts opencl -f flv rtmp://ipaddress:1935/rtmp/push/test4

标签: ffmpeg

解决方案


推荐阅读