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

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

问题描述

我正在尝试提供带有MPEG4视频编解码器和AC3音频编解码器的MKV视频,以使用Mozilla或Chrome浏览器在线播放.我尝试了多种方法,包括本机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 Web插件(因为我知道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 affect 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.

所以我的问题是,是否有人知道一种解决方法,可以在本地HTML5播放器中播放AC3音频,或者VLC Web插件的正确语法是什么?还是有人会推荐一个完全不同的球员?任何和所有帮助表示赞赏!

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天全站免登陆