如何通过多个VLC播放器播放一个流?
我正在尝试通过此命令流式传输视频:
$ vlc [path to file] --sout udp:// [destination path]
并且在目的地上,我运行两个 VLC 播放器,它们通过命令播放一个流:
$ vlc udp:// [source path]
当我运行第一个播放器时,它播放视频,但是当我运行第二个播放器时,第一个播放器停止,只有第二个播放器播放溪流。
如何让 2 名玩家同时播放一个流?
I'm trying to streaming video by this command:
$ vlc [path to file] --sout udp:// [destination path]
And also on destination, i run two VLC players which play one stream by command:
$ vlc udp:// [source path]
When i run first player it play video but when i run second player first player stopping and only second player play stream.
How i can play one stream by 2 players?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设目标路径是播放器的 IP 和端口,这意味着您将流直接单播到该端点。当您在播放器上打开流时,它会绑定到该套接字并读取数据包。之后数据包就“消失”了。通常玩家会保留该地址,这样其他程序就不能在那里打开套接字,但这里似乎没有发生这种情况,因此第二个玩家劫持同一个套接字并获取 UDP 数据包。
如果两个玩家都在同一主机上,则多播也将不起作用。如果你需要支持的玩家数量是固定的,你可以让VLC复制输出;
--sout '#duplicate{dst=rtp{mux=ts,dst=192.168.1.10,port=50002},
dst=rtp{mux=ts,dst=192.168.1.40,port=50004}}'
如果您需要动态支持未知数量的客户端,则需要混合使用流媒体服务器。哪一个实际上取决于您想要实现的目标。也许 VLC 也可以直接充当流媒体服务器,但我从未尝试过。
I assume destination path is the IP and port of the player, meaning you are unicasting the stream directly to that endpoint. When you open the stream on the player it binds to that socket and reads the packets. After that the packets are "gone". Normally the player would reserve the address so no other program can open a socket there, but it seems like this is not happening here, so the second player hijacks the same socket and gets the UDP packets.
If both players are on the same host, multicast will not work either. If there is a fixed number of players you need to support, you can let VLC duplicate the output;
--sout '#duplicate{dst=rtp{mux=ts,dst=192.168.1.10,port=50002},
dst=rtp{mux=ts,dst=192.168.1.40,port=50004}}'
If you need to support an unknown number of clients dynamically, you need to put a streaming server in the mix. Which one really depends on what you want to achieve. Might be that VLC can act as a streaming server directly as well, but I've never tried.
对于您的情况,拥有一些实用程序将发送到特定端口的 UDP 数据包复制到同一台计算机上的多个其他端口将是有益的。
该应用程序的实现应该很简单。
For your case, it would be beneficial to have some utility that will replicate UDP packets sent to particular port to several other ports on the same machine.
Implementation of this application should be trivial.