The extent .mkv
and .mp4
has nothing to do with the format of the video, you could rename a file with the mp4 format to the extent video.foobaz
that would still be an archive .mp4
.
Videos are not played simply by HTML, the tag <video>
depends on the Codecs installed on the machine or viewed with the browser:
Wiki: Codec is the acronym for Encoder/Decoder, hardware device or software that encodes/decodes signals.
If you have a CODEC installed in your computer for MKV that is compatible with the same build architecture type as your browser, which can be x86 or x64 (other times Arm), then it will work in your computer, does not mean that it will work in other browsers.
So if you have an x64 browser, you will need an x64 codec, there is a codec package called k-lite codec, which contains x86/x64 embedded, ie it installs for both, the basic package which is the lightest supports mkv: https://www.codecguide.com/download_k-lite_codec_pack_basic.htm
All supported formats (has nothing to do with extensions) sane:
- AVI, MKV, MP4, FLV, MPEG, MOV, TS, M2TS, WMV, RM, RMVB, OGM, Webm
When installing it is recommended to restart the computer, of course as I already said this will only make your browser recognize, so that it works on other computers will be necessary to install the codecs as well.
How to work on "all" (almost all) modern browsers
There is no guarantee that it works on all browsers, Chrome already comes with many codecs, but the mkv
nay is one of them, the only viable solution is to re-encode the video to a new format that is more common as the MPEG-4 or H.264 format itself (both usually use the extension .mp4
), you can convert manually using software like:
- Freemake (I don’t know the quality of the software, it’s just an example, there are others in the "market")
Or you can convert on the server side, while uploading, using the ffmpeg
which is a program aimed at this, for example:
ffmpeg -i videoupado.mkv -vcodec copy -acodec copy videoupado.mp4
In PHP you could use exec
, after upload, for example:
exec('ffmpeg -i videoupado.mkv -vcodec copy -acodec copy videoupado.mp4', $output);
print_r($output);
And what have you done? Could [Edit] and show what your code is?
– UzumakiArtanis
@Stormwind
<video controls="true" autoplay="true">
 <source src="video.mkv" type="video/mp4">
</video>
– Carlos da Silva
Do you have this video? It’s in the folder along with the HTML file?
– UzumakiArtanis
have, in google opens, but in firefox not
– Carlos da Silva
In the MDN says nothing about the element
<video>
support the fomate.mkv
.– UzumakiArtanis
there is something I can do to run this video in the browser?
– Carlos da Silva
Same error. But what error? Try dragging this video to the browser and see if it runs normally.
– vinibrsl
Video format or MIME type not Supported
– Carlos da Silva