有人知道这个视频输出的问题可能是什么吗?

5

当处理 UDP 输入流时,我看到一个实时流的输出混乱。我正在使用最近从 GIT 下载的 ffmpeg。停止和重新启动 ffmpeg 命令可以暂时解决这些问题。

混乱的输出 日志样本:

    Sun Jan 26 03:52:00 2020 ffmpeg version N-94528-gfaa9cd3 Copyright (c) 2000-2019 the FFmpeg developers
Sun Jan 26 03:52:00 2020   built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)
Sun Jan 26 03:52:00 2020   configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/root/bin --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-openssl
Sun Jan 26 03:52:00 2020   libavutil      56. 33.100 / 56. 33.100
Sun Jan 26 03:52:00 2020   libavcodec     58. 55.100 / 58. 55.100
Sun Jan 26 03:52:00 2020   libavformat    58. 30.100 / 58. 30.100
Sun Jan 26 03:52:00 2020   libavdevice    58.  9.100 / 58.  9.100
Sun Jan 26 03:52:00 2020   libavfilter     7. 58.100 /  7. 58.100
Sun Jan 26 03:52:00 2020   libswscale      5.  6.100 /  5.  6.100
Sun Jan 26 03:52:00 2020   libswresample   3.  6.100 /  3.  6.100
Sun Jan 26 03:52:00 2020   libpostproc    55.  6.100 / 55.  6.100


Sun Jan 26 04:02:46 2020 [h264 @ 0x4d988c0] illegal short term buffer state detected
Sun Jan 26 04:02:46 2020 [h264 @ 0x4e54f80] reference picture missing during reorder
Sun Jan 26 04:02:46 2020     Last message repeated 1 times
Sun Jan 26 04:02:46 2020 [h264 @ 0x4e54f80] Missing reference picture, default is 56257016
Sun Jan 26 04:02:46 2020     Last message repeated 1 times
Sun Jan 26 04:02:46 2020 [h264 @ 0x4cc2e00] mmco: unref short failure
Sun Jan 26 04:02:46 2020 [h264 @ 0x594f4c0] illegal short term buffer state detected
Sun Jan 26 04:02:46 2020 [h264 @ 0x4f66800] reference picture missing during reorder
Sun Jan 26 04:02:46 2020 [h264 @ 0x4f66800] Missing reference picture, default is 56257692
Sun Jan 26 04:02:46 2020 [h264 @ 0x4c75a00] mmco: unref short failure
Sun Jan 26 04:02:46 2020 [h264 @ 0x4d988c0] illegal short term buffer state detected
Sun Jan 26 04:02:47 2020 [h264 @ 0x4e54f80] reference picture missing during reorder
Sun Jan 26 04:02:47 2020     Last message repeated 1 times
Sun Jan 26 04:02:47 2020 [h264 @ 0x4e54f80] Missing reference picture, default is 56257032
Sun Jan 26 04:02:47 2020     Last message repeated 1 times
Sun Jan 26 04:02:47 2020 [h264 @ 0x4cc16c0] reference picture missing during reorder
Sun Jan 26 04:02:47 2020 [h264 @ 0x4cc16c0] Missing reference picture, default is 56257700
Sun Jan 26 04:02:47 2020 [h264 @ 0x4cc2e00] mmco: unref short failure
Sun Jan 26 04:02:47 2020 [h264 @ 0x594f4c0] illegal short term buffer state detected
Sun Jan 26 04:02:47 2020 udp://230.1.1.2:12000?fifo_size=5000000&overrun_nonfatal=1: corrupt decoded frame in stream 3
Sun Jan 26 04:02:47 2020 [h264 @ 0x4f66800] reference picture missing during reorder
Sun Jan 26 04:02:47 2020 [h264 @ 0x4f66800] Missing reference picture, default is 56257708
Sun Jan 26 04:02:47 2020 [h264 @ 0x4c75a00] mmco: unref short failure
Sun Jan 26 04:02:47 2020 [h264 @ 0x4d988c0] illegal short term buffer state detected
Sun Jan 26 04:02:47 2020 [h264 @ 0x4e54f80] reference picture missing during reorder
Sun Jan 26 04:02:47 2020     Last message repeated 1 times
Sun Jan 26 04:02:47 2020 [h264 @ 0x4e54f80] Missing reference picture, default is 56257048
Sun Jan 26 04:02:47 2020     Last message repeated 1 times
Sun Jan 26 04:02:47 2020 [h264 @ 0x4cc16c0] reference picture missing during reorder
Sun Jan 26 04:02:47 2020 [h264 @ 0x4cc16c0] Missing reference picture, default is 56257716
Sun Jan 26 04:02:47 2020 [h264 @ 0x4cc2e00] mmco: unref short failure
Sun Jan 26 04:02:47 2020 [h264 @ 0x594f4c0] illegal short term buffer state detected

视频格式是ts吗? - Kapil
1个回答

1
可能是因为UDP数据包丢失或乱序,导致“缺少参考图像”错误和“混乱”的视频输出。 或者ffmpeg无法实时解码流,因此跳过了一些数据包。

好的。我以为源代码中缺少iframes。有没有办法解决这个问题?我们可以使用--keyint参数强制ffmpeg插入关键帧。 - Krishnakumar
你控制输入流吗?你使用ffmpeg进行编码/流传输吗?命令行是什么? 是的,每秒定期关键帧应该显着提高流的弹性。 接收端的ffmpeg命令行是什么? - Alexey Doilnitsyn
我们从UDP获取源。是的,我们使用ffmpeg将其推送到我们的rtmp服务器。请参见下面的命令行。 - Krishnakumar
ffmpeg -err_detect aggressive -fflags discardcorrupt -i udp://x.x.x.x fifo_size=5000000&buffer_size=1000000&overrun_nonfatal=1 -analyzeduration 25M -probesize 50M -threads 0 -vsync 1 -filter_complex [i:0x550]yadif,setdar=11/9[1out1] -map [1out1] -map i:0x528-c:v libx264 -x264-params keyint=50:scenecut=0:nal-hrd=cbr -b:v 100k -maxrate 100k -bufsize 150k -r 25 -g 50 -profile:v high -level 4.0 -pix_fmt yuv420p -c:a libfdk_aac -b:a 64k -ac 2 -ar 48000 -sc_threshold 0 -s 176x144 -tune film -af aresample=async=1:min_hard_comp=0.100000:first_pts=0 -x264opts opencl -f flv rtmp://x.x.x.x:1935/rtmp/test - Krishnakumar
您应该在源UDP流中启用1秒的关键帧间隔,以提高其弹性。 - Alexey Doilnitsyn
1
请忽略我之前的评论。 我猜你是通过UDP(卫星?)接收ts流。 为什么将线程设置为0?FFmpeg流媒体指南建议使用多个线程,以便接收线程可以无中断地工作。 首先,我会检查纯UDP接收是否正常 - 只需将输入的ts保存在文件中,并检查其中是否有错误。 如果出现相同的错误,则意味着FFmpeg无法及时接收所有UDP数据包 - 请查看服务器上的网络配置,例如接收缓冲区大小。 如果纯接收正常工作,则意味着您的输出是瓶颈,这会减慢接收速度。 - Alexey Doilnitsyn

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接