MKV to GIF
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 GIF around what comes back.
An animated GIF, which will play anywhere at all.
This is the one people mean by “turn my video into a GIF”, and it is the one with the most to say about what it costs. A GIF holds 256 colours per frame and stores every frame whole, so expect it to be bigger than the video it came from — often several times bigger. That is not the conversion going wrong; it is what a GIF is. Every frame here gets its own 256 colours rather than sharing one palette across the whole animation, which is why converted video so often comes out muddy elsewhere.
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. GIF does nothing of the kind. Every frame is stored whole, and a GIF is limited to 256 colours in each one on top of that.
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.
A GIF cannot run at every speed
A GIF stores how long to show each frame in hundredths of a second and nothing finer. Ten frames a second is ten hundredths and comes out exactly right. Thirty frames a second is 3.33 hundredths, which is not a number a GIF can hold: it becomes 3, and the animation runs at 33.3 frames a second instead. There is no setting that fixes this. It is the format.
There is a floor as well. Every browser treats a delay below two hundredths as if it were ten — a rule inherited from Netscape and never removed — so a GIF claiming 100 frames a second plays at ten. Anything above 50 is therefore a lie, and this will not write one.
The rate you pick is checked against what a GIF can actually do, and if the two differ the page says so, with the number, above the download rather than after it.
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 APNG — the same clip, another way
- MKV to animated WebP — the same clip, another way
- MKV to PNG frames — the same clip, another way
- MKV to JPEG frames — the same clip, another way