html5 MKV playback with subtitles

5.7k Views Asked by At

I am attempting to play an MKV file in my chrome browser with subtitles so I can view local video files. This has been successful, using the above method/code in Microsoft Edge, however, when I use chrome I am unable to see the subtitles (cannot use Firefox as MKV was unsupported)

<video id="video" controls preload="metadata" style="width:80%;height:80%">
   <source src="file.mkv" type="video/mp4">
   <source src="file.mkv" type="video/webm">
   <track label="language one" kind="subtitles" srclang="en" src="sub.vtt">
   <track label="language two" kind="subtitles" srclang="en" src="sub.vtt">
</video>

File structure

  • chrome MKV player //(root directory)
  • file.mkv //(The video file)
  • file.vtt //(The subtitle file)
  • RUN.html //(The html file that displays the video)

This method was based off of this github repository "https://github.com/iandevlin/iandevlin.github.io/tree/master/mdn/video-player-with-captions"


I have:

  • tried using different subtitle formats (vtt, stl, ass, srt)
1

There are 1 best solutions below

0
On

Perhaps the primary language must be tagged with default?

<track label="language one" kind="subtitles" srclang="en" src="sub.vtt" default>

Works for me, haven't tried without. Otherwise I'd guess there's something wrong with the .vtt file.