Php 使用 Fopen 功能进行直播(rtp)
Php Using Fopen function with live streaming(rtp)
我正在尝试准备网络摄像头流媒体页面。我创建了一个 vlc 流,这是我在命令行中写到 运行 我的网络摄像头的内容。
cvlc -vvv v4l2:///dev/video0 --sout '#transcode{vcodec=mp2v,vb=800,acodec=none}:rtp{dst=239.0.0.1,port=5004,mux=ts}'
输入此代码后,我可以通过输入
来查看我的网络摄像头
rtp://239.0.0.1:5004/
到浏览器。到这里还好。
我准备了一个 php 流媒体文件,它用
打开静态视频文件
fopen('localhost/sample.mp4','rb')
命令,它工作正常。但是当我通过 "rtp://239.0.0.1:5004"/ in
fopen( 'rtp://239.0.0.1:5004/', "rb" )
命令,我收到错误 502 网关,这可能意味着它还没有打开 rtp 文件。
我该怎么办?谢谢
PHP只能使用某些协议打开资源。
file:// — Accessing local filesystem
http:// — Accessing HTTP(s) URLs
ftp:// — Accessing FTP(s) URLs
php:// — Accessing various I/O streams
zlib:// — Compression Streams
data:// — Data (RFC 2397)
glob:// — Find pathnames matching pattern
phar:// — PHP Archive
ssh2:// — Secure Shell 2
rar:// — RAR
ogg:// — Audio streams
expect:// — Process Interaction Streams
如您所见,rtp 不是其中之一。你需要 find/write rtp wrapper 来获取这个资源。
我正在尝试准备网络摄像头流媒体页面。我创建了一个 vlc 流,这是我在命令行中写到 运行 我的网络摄像头的内容。
cvlc -vvv v4l2:///dev/video0 --sout '#transcode{vcodec=mp2v,vb=800,acodec=none}:rtp{dst=239.0.0.1,port=5004,mux=ts}'
输入此代码后,我可以通过输入
来查看我的网络摄像头rtp://239.0.0.1:5004/
到浏览器。到这里还好。
我准备了一个 php 流媒体文件,它用
打开静态视频文件fopen('localhost/sample.mp4','rb')
命令,它工作正常。但是当我通过 "rtp://239.0.0.1:5004"/ in
fopen( 'rtp://239.0.0.1:5004/', "rb" )
命令,我收到错误 502 网关,这可能意味着它还没有打开 rtp 文件。
我该怎么办?谢谢
PHP只能使用某些协议打开资源。
file:// — Accessing local filesystem
http:// — Accessing HTTP(s) URLs
ftp:// — Accessing FTP(s) URLs
php:// — Accessing various I/O streams
zlib:// — Compression Streams
data:// — Data (RFC 2397)
glob:// — Find pathnames matching pattern
phar:// — PHP Archive
ssh2:// — Secure Shell 2
rar:// — RAR
ogg:// — Audio streams
expect:// — Process Interaction Streams
如您所见,rtp 不是其中之一。你需要 find/write rtp wrapper 来获取这个资源。