RTSP 和PHP 中的 mms 协议实现
嗨
PHP 中是否有 RTSP 和/或 MMS 协议的实现来从 RTSP 和 MMS 下载流? MMS 服务器(PHP 中的 RTSP/MMS 客户端)?
Hi
Is there any implementation of RTSP and/or MMS protocols in PHP to download streams from RTSP & MMS servers (RTSP/MMS client in PHP)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 php curl 获取提要,然后显示/保存它。
You can use php curl to fetch the feed and then display/save it.
你试图做的事情从根本上来说是行不通的。 MMS 是一种实时多媒体流协议 - 客户端和服务器来回对话,同步数据传输(因此视频和音频同步)并根据数据包延迟和数据包丢失率协商比特率,等等...并且只要媒体在流式传输就保持会话状态。它以媒体的速率而不是连接的比特率进行流传输。如果视频时长为一小时,您的客户将必须保持连接一个小时。
PHP 是一种查询/响应脚本语言 - 你向它发送一个请求,它发送一个答案,挂断,然后忘记它为你的请求所做的一切 - 它不维护“状态”(除非你将会话数据推送回浏览器客户端)。 Web 服务器最终会使脚本超时并终止它(诚然,您可以将超时设置得很长)...但实际上拥有一个可以“保存”MMS 流的 php 客户端意味着本质上是用 PHP 编写 Windows Media Player 并执行以下操作因此它管理两个套接字 - 每个方向一个 - 所有这些都试图实现一种专有的未记录的复杂流协议。
正如其他人指出的那样,您需要从服务器名称中删除 mms:// 才能连接到服务器 - 但即使这样也并不简单。 Windows Media Player 使用各种端口来尝试连接到服务器,因为防火墙和路由器可能会阻止它。它的最终后备是端口 80,以愚弄看门人,WMP 只是下载一个大小未知的又大又长的无辜图形图像。您也许能够验证另一端是否有实时彩信服务器,但除此之外,它很快就会变得非常复杂。
这是不适合这项工作的工具。
What you are trying to do is fundamentally not going to work. MMS is a real time multimedia streaming protocol - the client and the server have a conversation back and forth synchronizing the transfer of data (so the video and the audio are synchronized) and negotiating the bit rates based on the packet delay and packet loss rate, etc... and stays in session for as long as the media is streaming. It streams at the rate of the media, not at the bit rate of the connection. If it is an hour long video, your client will have to remain connected for an hour.
PHP is a query/response scripting language - you send it a request, it sends an answer, hangs up and then forgets everything it was doing for your request - it doesn't maintain "state" (unless you push sesstion data back to the browser client). The web server will time out the script eventually and kill it (admittedly you could make the timeout very long)... but to actually have a php client that could "save" an MMS stream means essentially writing Windows Media Player in PHP and doing it so it manages two sockets - one in each direction - all trying to implement a proprietary undocumented complex streaming protocol.
As others pointed out, you need to drop the mms:// from the server name in order to connect to the server - but even that is not simple. Windows Media Player uses a variety of ports in order to try to connect to the server, because firewalls and routers may be blocking its way. It's ultimate fallback is port 80, to fool the gatekeepers that WMP is just downloading a big long innocent grahpics image of unknown size. You might be able to verify that you have a live MMS server on the other end, but beyond that it gets very complicated very fast.
It's the wrong tool for the job.