问题
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