Html 如何使用 HTML5 <video> 标签播放 mkv 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16940520/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to play mkv files using HTML5 <video> tag?
提问by Boblob
回答by robertc
WebM uses a variant of the Matroska containerso it's not too surprising that some browsers are able to play some .mkv files. It's likely that you'd need to set the content type header to something that the browser recognises (eg. video/webm
) if it was going to work at all.
WebM 使用Matroska 容器的变体,因此某些浏览器能够播放某些 .mkv 文件也就不足为奇了。很可能您需要将内容类型标头设置为浏览器识别的内容(例如video/webm
),如果它要工作的话。
However, that's only part of the story. The Matroska container is just that, a container. Inside the container are video and audio objects which have been encoded with particular codecs, if the browser you're attempting to play the file with doesn't support those codecs then they won't be able to play the file even if they can parse the container format. If you want wide compatibility then your best option is to transcode to one of the more common container/codec combinations such as MP4/h264or WebM/VP8.
然而,这只是故事的一部分。Matroska 容器就是一个容器。容器内部是使用特定编解码器编码的视频和音频对象,如果您尝试播放文件的浏览器不支持这些编解码器,那么即使它们可以解析,它们也将无法播放文件容器格式。如果您想要广泛的兼容性,那么最好的选择是转码为更常见的容器/编解码器组合之一,例如MP4/h264或WebM/VP8。
回答by SolessChong
You wanna take a look at DivX player
你想看看DivX 播放器
Cut & paste
剪切和粘贴
As of version 2.1, the DivX Plus Web Player supports the HTML5 API, so it can be embedded and controlled using the tag and open web standards such as JavaScript. It takes full advantage of the tag's attributes by allowing publishers to create seamless playback experiences and custom controls for DivX, AVI, MKV, MP4 and MOV videos across multiple browsers: Firefox and Chrome (Internet Explorer & Safari Coming in full release version).
从 2.1 版开始,DivX Plus 网络播放器支持 HTML5 API,因此可以使用标签和 JavaScript 等开放网络标准对其进行嵌入和控制。它充分利用了标签的属性,允许发布商跨多个浏览器为 DivX、AVI、MKV、MP4 和 MOV 视频创建无缝播放体验和自定义控件:Firefox 和 Chrome(Internet Explorer 和 Safari 即将推出完整版本)。