HTML5直播视频“黑客”
在过去的两个月里,我一直试图“欺骗” safari,让其认为它正在查看服务器上的文件,实际上该文件是来自摄像机的实时视频流,根据请求使用 Gstreamer 编码和混合为支持的格式通过浏览器。由于 HTML5 支持渐进式视频下载,这至少在理论上是可能的。
我的结论是,考虑到浏览器在下载 HTML5 视频文件时会发出部分内容请求(主要是为了查找),这会变得相当复杂。如果服务器不支持此功能,则在文件完全下载后才会播放视频。
还有其他人尝试过这种方法并取得了更大的成功吗?或者我应该放弃并等待真正的实时视频支持(如 RTSP)集成到浏览器中。
干杯。
For the last two month I have been trying to "fool" safari into thinking that it's looking at a file on the server, which in fact is a live video stream from a camera encoded and muxed upon request using Gstreamer into a format that is supported by the browser. Since HTML5 supports progressive video downloads this should at least be possible in theory.
My conclusion is that this gets quite complicated considering that browsers make a partial content request when downloading video files in HTML5, mainly for the sake of seeking. If the server lacks support for this feature the video is not played until the file is completely downloaded.
Have anyone else tried this approach with more success? Or should I just give up and wait for true live video support like RTSP to be integrated into browsers.
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
本文提供了一些有用的提示:https://developer.mozilla.org/en/Configuring_servers_for_Ogg_media
您提供
X-content-duration
标头吗?This article provides some useful tips: https://developer.mozilla.org/en/Configuring_servers_for_Ogg_media
Are you serving the
X-content-duration
header?你有两种可能性。
使用 H.264,您可以模拟具有片段结构的文件:带有电影片段原子 (MOOF) 的 ISO 容器 (.mp4)。
另一个选择是 Google 的 WebM。由于 MKV 文件的结构,客户端可以随时“加入”流。为了获得最佳结果,传输到客户端的第一帧应该是关键帧。
You have two possibilies.
With H.264 you can emulate a file with fragmented structure: ISO container (.mp4) with movie fragment atoms (MOOF's).
The other option is Google's WebM. Clients can "join in" the stream any time thanks to MKV file's structure. For best results the first frame transmitted to the client should be akeyframe.
如果您只需要视频而不需要音频,“Motion JPEG”可以做到。它不是 HTML5,而是 Netscape 时代的功能。
http://en.wikipedia.org/wiki/Motion_JPEG#M-JPEG_over_HTTP
If you only need video but not audio, "Motion JPEG" can do it. It's not HTML5 but a Netscape-era feature.
http://en.wikipedia.org/wiki/Motion_JPEG#M-JPEG_over_HTTP