我正在尝试用 ffmpeg 运行 12 个流,使用这个脚本:
#!/bin/bash
ffmpeg -re -stream_loop -1 \
-i test.mp4 \
-i test.mp4 \
-i test.mp4 \
-i test.mp4 \
-i test.mp4 \
-i test.mp4 \
-i test.mp4 \
-i test.mp4 \
-i test.mp4 \
-i test.mp4 \
-i test.mp4 \
-i test.mp4 \
-map 0 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream0 \
-map 1 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream1 \
-map 2 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream2 \
-map 3 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream3 \
-map 4 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream4 \
-map 5 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream5 \
-map 6 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream6 \
-map 7 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream7 \
-map 8 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream8 \
-map 9 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream9 \
-map 10 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream10 \
-map 11 -c: libx264 -b:v 500k -f rtsp rtsp://localhost:8554/mystream11
我真的不明白 -b:v 选项。视频分辨率为3072x1728,10 FPS,我用一个在线工具计算出每个流需要3.4 Mbps的比特率。但是我将 -b:v 选项增加得越多,例如,增加到 3400k,我得到的碎片就越多。我的假设是我的网络无法跟上编码 3.4 Mbps 的数据,尽管我使用有线 1000 Mb/s。
我应该使用哪些选项来运行没有碎片的流?
我尝试将 -b:v 参数更改为多个值。 100k 不够,stream 卡住了。 500k 有一点碎片,与 1000k 相同。 3400k 整个流都是碎片化的。