如何将 VLC 直播与 HTML5 视频结合使用?
我尝试了 HTTP Ogg/Theora,在 Chrome 上工作正常,但在 Firefox 7 上工作不正常。
VLC 配置:
为了测试,我一直使用以下 vlc 命令行配置流式传输桌面:
vlc.exe screen:// :screen-fps=30 :screen-caching=100 :sout=#transcode{vcodec=theo,vb=800,scale=1,width=800,height=600,acodec=none}:http{mux=ogg,dst=:8181/desktop} :no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep
HTML5 视频标签配置:
<video id="video" src="http://my_host_name:8181/desktop" type="video/ogg; codecs=theora" autoplay="autoplay"/>
有什么想法吗?
I tried HTTP Ogg/Theora and works alright with Chrome but not with Firefox 7.
VLC Configuration:
For testing, I've been streaming the desktop using the following vlc command line configuration:
vlc.exe screen:// :screen-fps=30 :screen-caching=100
:sout=#transcode{vcodec=theo,vb=800,scale=1,width=800,height=600,acodec=none}:http{mux=ogg,dst=:8181/desktop}
:no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep
HTML5 video tag configuration:
<video id="video" src="http://my_host_name:8181/desktop" type="video/ogg; codecs=theora" autoplay="autoplay"/>
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我为此苦苦挣扎了一段时间,并且能够验证 Ogg/Theora 在 Firefox 7、Nightly 10 和 Opera Next 中工作得很好。
现在一切都可以在 Google Chrome 上运行。我在使用 Chrome 时遇到的问题是 XP 中最新版本的 Chrome 不再需要在命令行中传递“--enable-webgl”指令。 XP 中唯一需要的命令行条目是“--ignore-gpu-blacklist”,因为 GPU 在 XP 中被列入黑名单。
此外,我还能够验证 Chrome 是否可以与 Web-m/VP8/Vorbis 流一起正常工作。 Opera 和 Firefox 尚未支持它。
我发现的主要问题是:
1 - 页面加载:如果您从文件系统而不是网络服务器加载页面,则不会显示视频(任何视频、vlc 或文件) 。
要修复此问题,只需确保您正在从网络服务器加载内容即可。
2 - 直播/实时流媒体:使用了 VLC,为了使其正常工作,我必须绕过 WebGL/HTML5 视频安全限制。有时,由于安全限制,并非源自同一 Web 服务器和 Web 上下文或子上下文的视频流将无法播放。
要解决此问题,只需在您的应用程序服务器前面安装一个 Apache Web 服务器,并将您的 VLC 流配置为位于加载的网页的 Web 子上下文下。例如,在 Apache 2.2 中启用 mod 代理并将以下行添加到您的 httpd.conf 文件中:
如果您还使用 Apache 来存储内容,则根据上面的示例,只需放置您的 html 页面在名为“desktop”的目录下。
到目前为止的结论:
尽管 HTML5 视频规范为流媒体提供了空间,但到目前为止我的结论是 HTML5 视频还没有为直播做好准备。在我的实验中,视频标签总是会缓冲,但我找不到禁用它的方法,这最终导致至少 5 到 8 秒的延迟。
所以,我想目前基于 Flash 和 RTMP 的解决方案仍然是可行的方法。
I struggled with this for a while and I was able to verify that Ogg/Theora work just fine in Firefox 7, Nightly 10 and Opera Next.
Everything is now also working on Google Chrome. The issue I had with Chrome was that the latest version of Chrome in XP no longer needs the '--enable-webgl' instruction passed in the command line. The only command line entry required in XP is '--ignore-gpu-blacklist' since GPUs are blacklisted in XP.
In addition, I was able to verify that Chrome works just fine with Web-m/VP8/Vorbis streams. Opera and Firefox are yet to support it.
The main issues I found were:
1 - Page loading: If you load your page from your file system as opposed to from a web server, the video will not be displayed (any video, vlc or file).
To fix it, just make sure you are loading your content from a web server.
2 - Live/Real Time Streaming: VLC was used and in order to make it work I had to navigate around WebGL/HTML5 Video security restrictions. It happens that video streams that do not originate from the same web server and web context or sub-context it will not be played due to security restrictions.
To fix this, just front your application server with an Apache web server and configure your VLC stream to be under a web sub-context from your loaded web pages. For example, in Apache 2.2 enable mod proxy and add the following lines to your httpd.conf file:
If you're also using Apache to store you content, then, and based on the example above, just place your html page(s) under a directory named "desktop".
Conclusion so far:
Even though the HTML5 video specs provide room for streams, so far my conclusion is that HTML5 video is not nearly ready for live streaming. In my experiments the video tag would always buffer and I could not find a way to have it disabled and, this ends-up causing a lag of at least 5 to 8 seconds behind.
So, I guess that for now Flash and RTMP based solutions are still the way to go.