PHP流式视频处理程序 [英] PHP Streaming video handler

查看:135
本文介绍了PHP流式视频处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现一种基于用户访问权限的视频流解决方案。

I'm trying to implement a video streaming solution based on user access.

我在与服务器相连的专用网络上有很多视频流(http / /192.168.100.101/mpeg4/1/media.amp),我想通过网络服务器代理该视频流。

I have many video streams located on a private network connected to the server (http//192.168.100.101/mpeg4/1/media.amp), and I want to "proxy" that video stream through the web server.

我知道如何设置用户访问部分,但是如何将视频流代理给用户?

I know how to setup the user access part, but how can I proxy the video stream to the user?

我已经尝试过类似的操作,但似乎不起作用。

I have tried something like this, but it does not seem to work.

header('Content-type: application/x-rtsp-tunnelled');
$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL, "http//192.168.100.101/mpeg4/1/media.amp");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
echo $output;
curl_close($ch);

是否有最佳方法的想法?

Any ideas on the best way to do this? How do other streaming sites do it?

谢谢:)

推荐答案

curl_exec()不适用于流输出。仅在http请求完成后才会返回。对于流式传输请求,理论上讲它是从不,而您只是在某个地方填满内存缓冲区。

curl_exec() isn't designed for streaming output. It'll return only when the http request is completed. For a streaming request, that would theoretically be "never", and you'll just be filling up a memory buffer somewhere.

请查看此答案以找到解决方法:处理长度为3000万个字符的字符串

Check this answer for workarounds: Manipulate a string that is 30 million characters long

这篇关于PHP流式视频处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆