通过 LAN 使用 ffmpeg 进行流式传输?
Stream with ffmpeg over LAN?
我正在尝试通过 LAN 流式传输 mpegts 文件,使用命令
ffmpeg -re -i in.ts -vcodec copy -acodec copy -f mpegts "udp://localhost:5000/live/stream"
并尝试通过 LAN(在服务器上)在
捕获 10s 块
ffmpeg -i udp://192.168.xx.xx:5000/live/stream -c copy -f segment -segment_time 10 -strftime 1 "in /%Y-%m-%d_%H-%M-%S.mp4"
这是行不通的。我在 VLC 中测试了流,但没有可播放的内容。
现在,我怀疑这是一个端口问题,因为 FFMPEG 似乎没有 write/listen 通过指定的 5000 端口。我用netstat查看,端口上没有包括ffmpeg在内的PID。但是,命令
ffmpeg -i udp://127.0.0.1:5000/live/stream -c copy -f segment -segment_time 10 -strftime 1 "in/%Y-%m-%d_%H-%M-%S.mp4"
在我的机器(本地主机)上生成所需的输出,ffplay 也是如此。有人可以帮忙吗?
使用 UDP 时,您必须指定流式传输到的服务器的 IP,而不是流式传输服务器的 IP。
流媒体命令
ffmpeg -re -i in.ts -vcodec copy -acodec copy -f mpegts "udp://192.168.target.IP:5000/live/stream"
捕获命令
ffmpeg -i udp://192.168.target.IP:5000/live/stream -c copy -f segment -segment_time 10 -strftime 1 "in/%Y-%m-%d_%H-%M-%S.mp4"
我正在尝试通过 LAN 流式传输 mpegts 文件,使用命令
ffmpeg -re -i in.ts -vcodec copy -acodec copy -f mpegts "udp://localhost:5000/live/stream"
并尝试通过 LAN(在服务器上)在
捕获 10s 块ffmpeg -i udp://192.168.xx.xx:5000/live/stream -c copy -f segment -segment_time 10 -strftime 1 "in /%Y-%m-%d_%H-%M-%S.mp4"
这是行不通的。我在 VLC 中测试了流,但没有可播放的内容。
现在,我怀疑这是一个端口问题,因为 FFMPEG 似乎没有 write/listen 通过指定的 5000 端口。我用netstat查看,端口上没有包括ffmpeg在内的PID。但是,命令
ffmpeg -i udp://127.0.0.1:5000/live/stream -c copy -f segment -segment_time 10 -strftime 1 "in/%Y-%m-%d_%H-%M-%S.mp4"
在我的机器(本地主机)上生成所需的输出,ffplay 也是如此。有人可以帮忙吗?
使用 UDP 时,您必须指定流式传输到的服务器的 IP,而不是流式传输服务器的 IP。
流媒体命令
ffmpeg -re -i in.ts -vcodec copy -acodec copy -f mpegts "udp://192.168.target.IP:5000/live/stream"
捕获命令
ffmpeg -i udp://192.168.target.IP:5000/live/stream -c copy -f segment -segment_time 10 -strftime 1 "in/%Y-%m-%d_%H-%M-%S.mp4"