【发布时间】:2016-02-11 11:45:34
【问题描述】:
我正在尝试使用 ffmpeg 将 udp 流转换为帧。我运行以下命令:
ffmpeg -loglevel debug -strict 2 -re -i "udp://192.168.15.50:3200?fifo_size=1000000&overrun_nonfatal=1" -r 8 -vf scale=432:243 -f image2pipe -vcodec ppm pipe:1
它发生在不同的流类型、mpeg2video 和 h264 上。核心处理此特定流的 CPU 负载低于 30%,其分辨率为 640x576 的低质量 sd 流。
它在大多数情况下都能正常工作,但有时,有时会出现延迟,帧到达较晚。所以我想要正好 8 fps,但有时我得到更少,有时更多。
为什么会出现这种延迟,我该如何减少它?
更新:我尝试将其更改为:
ffmpeg -loglevel debug -i "udp://192.168.15.50:3200?fifo_size=1000000&overrun_nonfatal=1" -r 8 -preset ultrafast -fflags nobuffer -vf scale=432:243 -f image2pipe -vcodec ppm pipe:1
但我仍然遇到问题。例如,在 ffmpeg 日志中我得到:
[2016/02/11 13:32:30] frame= 7477 fps=8.0 q=-0.0 size= 2299638kB time=00:15:34.62 bitrate=20156.4kbits/s dup=7 drop=15867 ^M*** dropping frame 7477 from stream 0 at ts 7475
[2016/02/11 13:32:30] ***dropping frame 7477 from stream 0 at ts 7476
[2016/02/11 13:32:30] ***dropping frame 7478 from stream 0 at ts 7476
[2016/02/11 13:32:32] Last message repeated 1 times
[2016/02/11 13:32:32] frame= 7479 fps=8.0 q=-0.0 size= 2300253kB time=00:15:34.87 bitrate=20156.4kbits/s dup=7 drop=15871 ^M*** dropping frame 7479 from stream 0 at ts 7477
如您所见,在第 31 秒期间,没有输出任何帧...并且 ffmpeg 报告的两帧之间的时间为 0.25s
【问题讨论】:
标签: ffmpeg video-streaming latency buffering