Mark
Mark

Reputation: 41155

HTML5 <video> can play .mkv files?

So I accidentally opened an mkv video file with Chrome, and to my surprise it played it using the native player:

<video src="video.mkv"></video>

It was playing perfectly. HTML5 video supports matroska container?

Upvotes: 16

Views: 57591

Answers (3)

Synergiance
Synergiance

Reputation: 11

I'd be surprised if browsers didn't support mkv, as the webm container is just a restricted version of the matroska format. Beyond that you'd have to check the codec of the video inside, and ensure your browser can handle that. If the video format is VP8 or VP9 and the audio is Opus or Vorbis it's webm compliant and might as well be renamed as such. Note that H.264, H.265 and MP3 are not webm compliant and you should avoid using that extension on files that include those formats, the video would still play but it would technically break the webm specification and is frowned upon.

Upvotes: 1

Harry Lewis
Harry Lewis

Reputation: 518

The website has probably set the mimetype of the file to video/webm. Chrome will open this inline rather than forcing a download (because otherwise it doesnt know what to do with it or how to open it).

E.g., in apache this is done by using the AddType directive (can be done in a htaccess):

    AddType video/webm .mkv

Upvotes: 2

JJJ
JJJ

Reputation: 33143

HTML5 doesn't support any video formats, or rather HTML5 doesn't specify what formats browsers should support. It's up to the browsers to decide which formats they choose to support. Apparently Chrome plays .mkv, but I wouldn't be surprised if other browsers didn't play the same file.

Upvotes: 21

Related Questions