RTSP & mms protocol implementation in PHP

六眼飞鱼酱① 提交于 2020-01-03 04:50:14

问题


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)?


回答1:


You can use php curl to fetch the feed and then display/save it.




回答2:


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.



来源:https://stackoverflow.com/questions/4276166/rtsp-mms-protocol-implementation-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!