The extension .mkv
and .mp4
has nothing to do with the format of the video, you could rename a file with mp4 format for the video.foobaz
extension that would still be a .mp4
.
Videos are not reproduced simply by HTML, the <video>
tag depends on the CODECs installed on the machine or the browser:
Wiki: CoDec is the acronym for Encoder / Decoder, hardware device or software that encodes / decodes signals.
If you have a CODEC installed on your computer for MKV that is compatible with the same architecture type as your browser build, which may be x86 or x64 (sometimes arm ) then it will work on your computer , that does not mean it will work on other browsers.
So if you have an x64 browser, you will need an x64 codec, there is a codec pack called k-lite codec , which contains x86 / x64 built-in, ie it installs for both the basic package which is the lightest supports mkv: link
All supported formats ( no extensions ) are:
AVI, MKV, MP4, FLV, MPEG, MOV, TS, M2TS, WMV, RM, RMVB, OGM, WebM
When installing it is recommended that you restart the computer, of course as I already said this will only make your browser recognize, so that it works on other computers you will need to install the codecs as well.
How to work in "all" (almost all) modern browsers
You can not guarantee that it works in all browsers, Chrome already comes with many codecs, but% % is not one of them, the only feasible solution is to re-encode the video to a new format that is more common as the MPEG-4 or H.264 format (both usually use the mkv
extension), you can manually convert using software like:
-
freemake (I do not 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, during upload, using .mp4
which is a program aimed at this, for example:
ffmpeg -i videoupado.mkv -vcodec copy -acodec copy videoupado.mp4
In PHP you could use ffmpeg
, after uploading, for example:
exec('ffmpeg -i videoupado.mkv -vcodec copy -acodec copy videoupado.mp4', $output);
print_r($output);