Video.js: Playing a MKV container

Created on 3 Apr 2019  路  4Comments  路  Source: videojs/video.js

Description

I've videos in .mkv files which are encoded with FFMpeg libx264 codec. I want to play it using videojs on a browser. But it seems so impossible!

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. Take any video file
  2. run this to encode ffmpeg -i myinput.mp4 -c:v libx264 -s 700:300 output.mkv
  3. try playing output.mkv using videojs

Results

Expected

Play the video

Actual

This video cannot be played

Error output

Additional Information

Please include any additional information necessary here. Including the following:

versions

videojs

what version of videojs does this occur with?

browsers

tried on chrome

OSes

Android

plugins

NO PLUGIN

Most helpful comment

The short answer is that browsers don't support MKV for HTML5 video.

The slightly longer answer is you can sometimes get some MKVs to play in browsers that support webm, because webm is a subset of MKV. You'd probably have to give the type as video/webm for that to work at all. But even then no browser supports the AC3 audio codec commonly used in MKV, so you might get no audio.

See also https://docs.videojs.com/tutorial-troubleshooting.html#choosing-a-video-format

All 4 comments

馃憢 Thanks for opening your first issue here! 馃憢

If you're reporting a 馃悶 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

The short answer is that browsers don't support MKV for HTML5 video.

The slightly longer answer is you can sometimes get some MKVs to play in browsers that support webm, because webm is a subset of MKV. You'd probably have to give the type as video/webm for that to work at all. But even then no browser supports the AC3 audio codec commonly used in MKV, so you might get no audio.

See also https://docs.videojs.com/tutorial-troubleshooting.html#choosing-a-video-format

Yeah, unfortunately, it's basically not supported. mp4 with h264 video and aac audio is probably your best bet.

Just a response ...
Was able to play the video by setting the type to video/mp4 or video/webm on my Default browser. But Google Chrome didn't bother playing it. (just the duration was loaded)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stephanedemotte picture stephanedemotte  路  4Comments

askaliuk picture askaliuk  路  3Comments

0xsven picture 0xsven  路  3Comments

dingyaguang117 picture dingyaguang117  路  4Comments

SolmazKh picture SolmazKh  路  4Comments