如何在网络浏览器中播放 MKV 视频? [英] How to playback MKV video in web browser?

查看:88
本文介绍了如何在网络浏览器中播放 MKV 视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 MPEG4 视频编解码器和 AC3 音频编解码器制作可使用 Mozilla 或 Chrome 在线播放的 MKV 视频.我尝试了多种方法,包括原生 HTML5,它播放视频但没有音频,并且从我读过的内容来看,AC3 是一种专有编解码器,因此它不包含在支持的编解码器中.代码如下:

I am trying to make a MKV video with a MPEG4 video codec and AC3 audio codec available to be played online using Mozilla or Chrome. I have tried multiple methods including native HTML5, which plays back the video but no audio and from what I've read AC3 is a proprietary codec so it is not included in the supported codecs. The code for that was as follows:

<video width='1024' height='768' controls autoplay> 
    <source src="path_to_src" type='video/x-matroska'>
</video>

然后我尝试使用 VLC 网络插件(因为我知道 VLC 可以正确播放文件)但还没有让它播放任何文件,使用示例中似乎没有很多一致性这种方法.这是我迄今为止使用 VLC 插件尝试过的:

I then tried to use the VLC web plugin (as I know VLC can play the files correctly) but have not yet gotten it to play any file, there doesn't seem to be a lot of consistency in the examples for using this method. Here is what I have tried so far using the VLC plugin:

<embed type="application/x-vlc-plugin" version="VideoLAN.VLCPlugin.2" 
width="1024" height="768" id="vlc" autoplay="yes" target="path_to_file"></embed>

VLC 页面 此处 说要添加此内容:

The VLC page here says to add this:

<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
 codebase="http://download.videolan.org/pub/videolan/vlc/last/win32/axvlc.cab">

但是代码库似乎不再存在,并且将那个 classid 添加到上面的代码中对文件的播放没有影响.这两种方法都会导致制作 VLC 播放器框,但没有播放任何内容,开发者控制台也不会显示任何错误.

But the codebase doesn't seem to exist anymore and adding that classid to the code above has no effect on the playing of the file. Both methods result in the VLC player box being made but nothing ever getting played and the developer console doesn't show any errors.

所以我的问题是有没有人知道让 AC3 音频在原生 HTML5 播放器中播放的解决方法,或者 VLC 网络插件的正确语法是什么?或者是否有人会推荐完全不同的播放器?任何和所有帮助表示赞赏!

So my question is does anyone know a workaround to get AC3 audio to play in the native HTML5 player or what the correct syntax is for the VLC web plugin? Or does anyone have a different player altogether they would recommend? Any and all help appreciated!

推荐答案

HTML5 不支持 .mkv/Matroska 文件,但您可以使用此代码...

HTML5 does not support .mkv / Matroska files but you can use this code...

<video>
    <source src="video.mkv" type="video/mp4">
</video>

但它是否会播放取决于浏览器.已知此方法适用于 Chrome.

But it depends on the browser as to whether it will play or not. This method is known to work with Chrome.

这篇关于如何在网络浏览器中播放 MKV 视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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