Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to playback MKV video in web browser?

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> 

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> 

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"> 

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.

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!

like image 821
Alex Meyer Avatar asked Jan 17 '14 17:01

Alex Meyer


People also ask

Can you play MKV on Chrome?

VLC for Chrome OS plays most local video and audio files, as well as network streams (including adaptive streaming), DVD ISOs, like the desktop version of VLC. All formats are supported, including MKV, MP4, AVI, MOV, Ogg, FLAC, TS, M2TS, Wv and AAC.

Does HTML support MKV?

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

How can I play MKV files in Firefox?

. Mkv and/or other video files can be played through firefox and firefox mobile by either right-click/long-press on video link for play options then choose the video player you know sorts the file example VLC player on Android market.


1 Answers

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

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

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

like image 119
Narendra Dharajiya Avatar answered Oct 02 '22 21:10

Narendra Dharajiya