MKV to animated WebP
Your video never leaves your browser, and nothing is downloaded to make this work. Your browser already decodes MKV because it has to play it; this asks it for the picture at each moment and writes animated WebP around what comes back.
An animated WebP, which is far smaller than either.
The same animation as a GIF or an APNG at a fraction of the size, and every browser has read it for years. Your browser compresses each frame with its own WebP encoder at the quality you pick; this page writes the animation around those frames. Nothing is downloaded to do it.
It will probably be bigger than the video
This surprises everybody, so it is worth saying before you press the button. A video codec stores the difference between one frame and the next: a person talking against a still background costs almost nothing per frame, because almost nothing changes. animated WebP does nothing of the kind. Every frame is stored whole, with nothing carried over from the frame before it.
So a ten-second clip that was 2 MB as an MP4 can easily be 8 MB coming out. The controls above are the cure: fewer frames a second, a smaller width, and a shorter span. The size is shown before you download anything.
The timing is kept exactly
This is where animated WebP is better than a GIF. A GIF stores frame delays in hundredths of a second and nothing finer, so thirty frames a second becomes 33.3 and there is no setting that fixes it. An animated WebP stores the delay in milliseconds, with twenty-four bits to do it in, so any rate at all is expressed exactly.
So the rate you choose above is the rate you get, and the length shown before you download is the length it will actually play for.
Where the frames come from
There are three ways to get pictures out of a video in a browser and only one of them works. This was measured rather than assumed:
requestVideoFrameCallbackonly fires for frames the browser actually puts on screen. A video element that is not on the page puts nothing on screen — measured here as zero frames from a clip that played all the way through.MediaRecorderhas the same problem for the same reason, and it runs in real time: a ten-minute video would take ten minutes.- Seeking and drawing works with the video off the page, works in a background tab, and runs far faster than real time — about ten milliseconds a frame on a small clip. That is what this uses.
Each frame is taken from the middle of its slot rather than the start. Asking for the picture at exactly 1.0 seconds on a clip that cuts at 1.0 seconds is asking the decoder which side of the line to round to, and different files answer differently. The midpoint has no such question in it.
What does not come across
The sound. None of these five formats has any, so it is not lost so much as impossible. If it was the sound you wanted, the same file will give you an MP3 and nothing is uploaded there either. Subtitles, chapters, rotation metadata and any second video track are not carried.
AVI, MOV, WMV, FLV and MTS are refused, and
that is not a shortcoming of this page: no browser will decode them, and
working around it would mean shipping a demuxer and a codec for each. If
you hand one over it says so plainly rather than producing an empty file.
An .ogv with Theora video does open, and has no picture in it
this browser can decode — the page says that too.
Where to go next
- MKV to GIF — the same clip, another way
- MKV to APNG — the same clip, another way
- MKV to PNG frames — the same clip, another way
- MKV to JPEG frames — the same clip, another way