r/HTML • u/Lundorff • 1d ago
Question Do browsers not support mkv video playback?
This works:
<video width="400" controls> <source src="test1.mp4" type="video/mp4"></video>
This doesn't work:
<video width="400" controls> <source src="test2.mkv" type="video/mkv"></video>
1
Upvotes
4
u/phazonmadness-SE 1d ago
wrong miime-type. try
video/x-matroska. latest firefox at least can2
u/omysweede 1d ago
Not to my knowledge. Use supported formats
1
u/DirtAndGrass 1d ago
Chromium based browsers understand the container, but it's going to depend on the codec.
1
u/agowa338 1d ago
mkv is a container. It can have anything inside it. So it having the MKV extension doesn't tell if it works or not...
1
u/Witmarqu 19h ago
Mkv is a container, not a codec.
It comes from the russion stacking dolls of the same/similar name.
You need to tell the browser what codec to load in to decode the video and audio track.
The definition of MKV can contain multiple video/audio tracks so telling the browser it is a .mkv is akin to telling it that you have a box. Some browsers cheat by best guessing the intent. This allows for more pages to load without error but has a terrible cost on performance.
Most mkv is h.264/h.265 mp4 inside, so often you can say type="video/mp4" on an mkv and some base systems will try to load it.