Convert GIF to MKV

Converting GIF to MKV wraps the animation in Matroska with an H.264 video track, which is what a media server needs before it will treat the file as something playable rather than as a picture. Drop the GIF above and the container is assembled in your browser.

  • Where it runs In your browser. The file is never uploaded.
  • Lossy Some detail is traded for size. MKV cannot hold everything a GIF can.
  • File size limit Up to 100 MB per file, free, without an account.
  • Worth knowing The result has no sound, because a GIF has none to carry. Each frame keeps its own timing, so an animation with irregular delays plays at the speed it was authored at rather than an averaged one.

Up to 100 files at once. Mixed formats are fine.

A library scanner does not know what to do with a GIF

Media servers sort what they find into films, episodes, music and images, and they decide by container. A GIF lands on the wrong side of that line: it is an image file, so Jellyfin and Kodi either skip it or file it as artwork, and no amount of naming convention changes their mind. The animation is invisible to the thing that is supposed to play it.

An MKV is unambiguous. The scanner reads a duration, a video track and a resolution, and the item appears in the library with a thumbnail and a progress bar like everything else. That is the whole of the argument for this conversion, and it is the reason to do it — not file size, which any video container would deliver.

Matroska is a shelf format, not a delivery format

MKV was published in 2002 as an open container designed to hold anything for as long as anybody wants to keep it: any number of video, audio and subtitle tracks, chapters, attachments, and metadata that survives being moved between machines. Its uses in this registry are recorded as archival and delivery, and the archival half is the honest one.

What it is not is a web format. Its browser support is recorded as none — not partial, none — and it is not designed for progressive streaming the way WebM is. If there is any chance this animation ends up embedded on a page, converting it to MKV puts it one step further from that, not closer.

H.264 inside the MKV, chosen for the player and not the browser

Matroska will carry almost any codec, which makes the choice a real one rather than a lookup. This conversion writes H.264 in the High profile, because the person putting a file into a self-hosted library is usually feeding a television, a streaming box or a phone app, and H.264 is the one thing every piece of that hardware decodes without transcoding on the fly.

The alternative would have been VP9 or AV1, both smaller at the same visible quality and both a gamble on the far end. A media server that has to transcode on playback turns a silent five-minute animation into a job for a CPU that is usually also doing something else. A file the client can play directly costs nothing.

Remuxing later is where MKV earns its place

The Matroska file this produces holds one video track and nothing else, which is exactly what a GIF has to give. What makes that a starting point rather than a limitation is that MKVToolNix can add to it later without re-encoding anything: a commentary track, a subtitle file, chapter marks, a cover image.

Remuxing copies the video stream across untouched, so nothing is lost in the process and it takes seconds rather than minutes. If this animation is going to become part of something larger — a compilation, a lecture with narration recorded afterwards — starting from MKV means every later step is a container edit rather than another generation of compression.

Every GIF frame is a whole picture, and that is the size problem

The GIF format has no motion compensation. Frame twelve is stored as a complete image even if it differs from frame eleven by four pixels, and the only compression applied is LZW over an indexed palette. That design is from 1989 and it never changed, which is why a screen capture saved as a GIF can be tens of megabytes for a couple of minutes of almost nothing moving.

H.264 stores one full frame and then, for each frame after it, the difference. On the material that ends up in a library as a GIF — a captured terminal session, a slowly rotating render, a whiteboard being drawn on — most of the picture is unchanged from frame to frame, and that is precisely the case the codec was built for.

What the palette already cost, before the MKV existed

A GIF frame carries at most 256 colours. Whatever the original capture had, that reduction happened when the GIF was written, and it is baked into the frames the encoder receives. A gradient that was smooth is now stepped, and a dithered area is now a field of alternating pixels.

The video encoder does not add to that, but dithering is a genuine complication: it is high-frequency noise, and high-frequency noise is the most expensive thing a video codec can be asked to store. A heavily dithered GIF converts to a larger MKV than a flat one of the same dimensions and length, and raising the quality band makes that worse rather than better.

No audio track, and what a media server does about it

A GIF has no sound, so the MKV contains a video track alone. Most players handle that without comment — VLC and MPV show no audio device, Kodi plays it silently.

A few library front ends are less relaxed and will show an item with no audio stream as having an unknown or damaged format. If your setup is one of them, MKVToolNix can mux a silent audio track into the file in one pass without re-encoding the picture, which is cheaper than converting the GIF again with different settings.

When a GIF does not belong in a media library at all

The stopping rule is worth stating plainly. If the animation is three seconds long and its purpose is to be posted somewhere, converting it to Matroska is effort spent on the wrong problem — it will sit in the library as an item nobody wants to browse to, and MP4 or WebM would have served the actual use better.

This conversion pays off when the GIF is long, when it is being kept rather than shared, and when the rest of the shelf is already Matroska. Consistency inside a library is worth something on its own: one container means one set of playback settings and one thing to check when something does not play.

The conversion runs where the GIF already is

The frames are read by the browser’s own image decoder and muxed into Matroska in the same tab. No part of the file is sent anywhere, there is no account, and there is no queue — which is the same reason people install FFmpeg for this job, without installing FFmpeg.

That decoder is not present in every browser. Where it is missing, the page says so and names browsers that have it, rather than quietly handing the file to a server to finish the job elsewhere.

How to file a GIF as an MKV

  1. Drop the animated GIF onto this page, or click to choose it.
  2. The frames are decoded and encoded as H.264 inside a Matroska container.
  3. Download the MKV and drop it into the library folder your server scans.

GIF and MKV: a picture format against a library container

GIF compared with MKV
GIFMKV
Full nameGraphics Interchange FormatMatroska Video
File extension.gif.mkv
Media typeimage/gifvideo/x-matroska
CompressionLossless — nothing is discardedLossy — file size is bought with quality
First published19872002
Published byCompuServe
SpecificationGIF89aMatroska
LicensingOpen standardOpen standard
Standing todayLegacy, still read everywhereCurrent
Bit depth8
Colour it can describeindexed palette
Largest image65,535 px per side
Opens in a browserEvery browserSome browsers
Considered insteadWebP, MP4MP4, WebM

Opening the result

Only some browsers read MKV. It is the less portable of the two, so it is worth being sure the program at the other end accepts it before sending one.

MKV is a container rather than a single format. What actually plays is the codec inside it — usually H.264, HEVC and AV1 — which is why two files with the same extension can behave differently on the same device.

GIF dates from 1987 and is largely superseded. MKV is what current software writes, so the conversion is as much about staying readable as about the file itself.

The usual programs do not overlap: GIF opens in GIMP, Adobe Photoshop and ImageMagick, MKV in VLC, MKVToolNix and HandBrake — so whoever receives the result needs something from the second list.

What each format is for

The two are aimed at different work: GIF at the web, MKV at archiving and handing a finished file over. That is worth weighing before converting, because the reason one exists is usually the reason the other is awkward.

GIF is CompuServe's format, published in 1987. It records 8 bits per channel.

MKV dates from 2002, specified as Matroska. VLC, MKVToolNix and HandBrake all read it.

GIF was published in 1987 and MKV in 2002. The older one is generally the safer file to hand to somebody; the newer one usually does the job in fewer bytes.

GIF to MKV: media servers, codecs and remuxing

Why will my media server not play the GIF as it is?

Because a GIF is an image file. Jellyfin, Plex and Kodi scan for video containers and index images separately, if at all, so a GIF sitting in a library folder is either ignored or shown as artwork. Putting the same animation inside a Matroska container gives the scanner something it recognises, with a duration it can read.

What codec ends up inside the MKV?

H.264 video, in the High profile, with no audio track. Matroska will hold almost any codec — its own trait list names H.264, HEVC, AV1, VP9 and FLAC — and the compatible pair is chosen deliberately, because somebody converting to MKV is usually feeding a media player or a set-top box rather than a browser.

Can I add subtitles or a soundtrack afterwards?

Yes, and that is one of the better reasons to pick Matroska. MKVToolNix can add subtitle tracks, chapters and audio to an existing MKV by remuxing, which rewrites the container without touching the video, so no quality is lost in the process. This conversion gives you the video track; the rest is a remux away.

Will the MKV play in a browser?

No. Matroska has no browser support at all — it is the one container in this group that no browser will open, which is why the format’s own record lists patchy support as its known problem. VLC, MPV, Kodi and any modern television play it without complaint. If the animation is going onto a web page, WebM or MP4 is what you want instead.

How much smaller is the MKV than the GIF?

Usually a great deal, because the saving comes from the codec rather than the container. A GIF stores every frame as a complete picture with no motion compensation; H.264 stores one frame and then only what changed. On a screen capture, where most of the picture is identical from frame to frame, the difference is at its largest.

Does the file leave my machine?

No. The GIF is decoded and the Matroska file is assembled in your browser, with no server involved and no account. That is the same guarantee as running FFmpeg locally, without installing FFmpeg.

More about these formats

Where these figures come from

The claims this page makes about GIF and MKV are checkable, and these are the documents that settle them.