Convert AVI to MKV: Remux, Add Subtitles, Batch a Library

By FileConvertLab

Published:

Convert AVI to MKV: an Xvid AVI remuxed without re-encoding into an MKV with two audio tracks and English subtitles, ready for Plex, Jellyfin and VLC
An AVI file with Xvid video and MP3 audio is remuxed into an MKV that keeps the same video and adds a second audio track and an English subtitle track

You can convert AVI to MKV in two ways. A remux copies the existing video and audio into a Matroska container without touching them. It's lossless, takes seconds, and lets you add subtitles and extra audio tracks. A re-encode turns the video into H.264, which makes the file smaller and friendlier to TVs, but it's a new lossy copy. For a library of old DivX and Xvid files, remux. For a few files that have to play on a picky device, re-encode.

For a remux, upload the files to the AVI to MKV converter, or use MKVToolNix or FFmpeg. Re-encoding to H.264 is worth it only when a TV can't play the old codec, a case covered below. Both remux routes are below, plus how to attach subtitles, batch a whole folder and name things so Plex or Jellyfin recognise them.

Why Move an Old AVI Library to MKV?

AVI dates from 1992, and it shows. It still plays, but it can't hold the things a modern library wants:

FeatureAVIMKV
Subtitles inside the fileNo standard way; you keep a separate .srt next to itYes, as many text or image tracks as you like, each with a language tag
Several audio tracksPossible, but many players ignore all but the firstYes, with language, name and "default" flags
ChaptersNoYes
Titles, languages, cover artVery limitedYes
Modern codecs (H.265, AV1, Opus)PoorlyYes
Open specificationMicrosoft formatOpen, royalty-free

The practical wins are simple. The subtitles travel with the movie instead of getting lost when you copy one file. A dubbed and an original soundtrack live in one file. Media servers read the language tags and pick the right track automatically.

What MKV doesn't do: improve the picture. A 640×352 Xvid rip from 2006 is still a 640×352 Xvid rip in an MKV. The container changes, the video doesn't.

Remux vs Re-encode: What We Measured

We made a 2-minute test AVI of the kind that filled hard drives in the 2000s: 640×352 Xvid video at 1 Mbps with 128 kbps MP3 audio. Then we converted it both ways with FFmpeg on an Intel i9-13900K:

MethodResultSizeTimePicture vs the AVI (SSIM)
Original AVIXvid + MP317.4 MB——
Remux to MKV (-c copy)Xvid + MP3, untouched17.2 MB0.06 s1.000 (identical)
Remux + subtitles + second audio trackXvid + 2 × MP3 + SRT18.7 MB0.06 s1.000 (identical)
Re-encode to MKV (H.264 at a high-quality setting + AAC 128 kbps)H.264 + AAC14.0 MB2.8 s0.990

What this tells you:

  • A remux is effectively free. It took a fraction of a second, and the video is bit-for-bit the same. The MKV was even a little smaller than the AVI, because Matroska's packaging is leaner
  • A re-encode trades a tiny bit of fidelity for size and compatibility. 0.990 is well past the point where anyone can see a difference on normal footage, and the file shrank by a fifth. But it's a copy of a copy, and it took about 45 times longer than the remux

On a 2-minute clip, 2.8 seconds doesn't matter. On a 300-film library, it's the difference between a coffee break and running the computer for days.

How to Convert AVI to MKV Online

  1. Open the AVI to MKV converter
  2. Drag in your .avi files. Several files go into a queue and convert one after another
  3. Download each MKV, or grab them all with Download all as ZIP

What the online converter does: it remuxes. Xvid, DivX and H.264 video and MP3, AC-3 and PCM audio are copied into the MKV unchanged, like the remux row in the table above; other video, such as old MS-MPEG4 or Cinepak, is re-encoded to H.264 and other audio to AAC. That's the quick route for a library. When the file has to play on a TV or streaming stick that doesn't handle DivX or Xvid, use AVI to MP4, which re-encodes them to H.264.

What it doesn't do: attach subtitles. Extra audio tracks are kept: when we uploaded an AVI with two audio tracks, the MKV came back with both. To add subtitles or name the tracks, use the desktop route below.

Limits: 100 MB per file without an account (500 MB on Premium, 1 GB on Premium Plus). Conversion is free without sign-up, with a daily limit. A video conversion uses a bigger share of it than a document does, so a guest can convert about five videos a day. Files are sent over an encrypted (HTTPS) connection, and their handling is described in the privacy policy.

How to Remux AVI to MKV Without Re-encoding

MKVToolNix (Windows, Mac, Linux, free). This is the standard tool for building MKV files:

  1. Open MKVToolNix GUI and stay on the Multiplexer tab
  2. Drag the .avi into Source files. Add your .srt and any extra audio files the same way
  3. Click each track in the list and set its language and track name (for example "English" or "Director's commentary"). Mark the track that should play first as the default track
  4. Check the destination file at the bottom, then click Start multiplexing

For many files, use Add to job queue instead of starting each one, then run the queue once.

FFmpeg (command line). The one-line remux:

ffmpeg -i "movie.avi" -map 0 -c copy "movie.mkv"

-map 0 keeps every stream (both audio tracks, if there are two), and -c copy means nothing is re-encoded. VLC can also save to MKV, but its converter is built around re-encoding. For a plain container change, MKVToolNix or FFmpeg are the cleaner tools. VLC, FFmpeg and HandBrake compared goes into the differences.

One warning you might see. Some old DivX files use a trick called "packed B-frames", and FFmpeg says so when it reads them. The remuxed MKV still plays in VLC and most players. If a picky player stutters on it, add -bsf:v mpeg4_unpack_bframes to the FFmpeg command.

How to Add SRT Subtitles and a Second Audio Track

This is usually the reason to move to MKV in the first place. With FFmpeg:

ffmpeg -i "movie.avi" -i "movie.en.srt" -i "commentary.mp3" -map 0 -map 1 -map 2 -c copy -metadata:s:s:0 language=eng -metadata:s:a:1 title="Commentary" "movie.mkv"

What each part does:

  • -map 0 -map 1 -map 2: take everything from the AVI, the subtitle file and the extra audio
  • -metadata:s:s:0 language=eng: tag the first subtitle track as English, so players and media servers can label it
  • -metadata:s:a:1 title=...: name the second audio track

We ran exactly this on the test file. The MKV came out with one video track, two audio tracks and an English subtitle track in 0.06 seconds, with the video still identical to the AVI.

Subtitles out of sync? If the .srt was made for a different release of the film, it will drift or start early. Fix the timing in a subtitle editor before you mux it in. The container won't fix it for you.

How to Batch Convert a Whole Folder of AVI Files

A loop over the folder remuxes everything and picks up subtitle files with matching names. On Mac or Linux (Terminal, run inside the folder):

for f in *.avi; do b="${f%.avi}"; if [ -f "$b.en.srt" ]; then ffmpeg -n -i "$f" -i "$b.en.srt" -map 0 -map 1 -c copy -metadata:s:s:0 language=eng "$b.mkv"; else ffmpeg -n -i "$f" -map 0 -c copy "$b.mkv"; fi; done

On Windows (Command Prompt, inside the folder), the simple version without subtitles:

for %f in (*.avi) do ffmpeg -n -i "%f" -map 0 -c copy "%~nf.mkv"

We tested the Mac/Linux loop on a folder with "Holiday 2006.avi" plus "Holiday 2006.en.srt", and "Birthday 2007.avi" with two audio tracks. The first MKV got the subtitles, and the second kept both audio tracks. -n makes FFmpeg skip files that are already converted, so you can run the loop again after adding more AVIs.

Before you delete anything: open a few MKVs from different years in the player you actually use, skip through them, and check sound and subtitles. Remuxing is lossless, but a damaged source AVI stays damaged. Keep the originals until you've spot-checked.

Naming Files for Plex and Jellyfin

Media servers identify films and episodes by folder and file name, not by what's inside. The conventions both Plex and Jellyfin document:

TypeFolder and file name
FilmMovies/The Film Title (1999)/The Film Title (1999).mkv
External subtitle (if you didn't mux it in)The Film Title (1999).en.srt next to the MKV
TV episodeTV/Show Name/Season 01/Show Name - S01E03.mkv
Home videoA separate "Home Videos" library, named by date: 2006-07-14 Holiday.mkv

With subtitles and language tags inside the MKV, the server shows "English" in its subtitle menu instead of "Unknown", and picks the right audio track by your language preference.

When MP4 Is the Better Target

MKV is the better archive. MP4 is the better thing to hand to other people:

  • iPhone, iPad and Apple TV apps don't open MKV without a third-party player
  • Phones, older smart TVs and car screens are far more reliable with MP4
  • Sharing and uploading works with MP4 everywhere

If that's your situation, convert AVI to MP4 instead, and see how to convert AVI to MP4 for the no-sound and VLC details. A common setup is to keep the MKV library for the media server and make MP4 copies only of what you share. MKV vs MP4 covers the trade-off, and converting MKV to MP4 while keeping subtitles and audio tracks is the follow-up when you need one.

Does MKV Play on My TV?

Often, but it depends on the codec inside more than on the container. Many smart TVs play MKV from a USB stick. Whether they decode the old DivX or Xvid video inside is another matter: support for those codecs varies by brand and model year. If the TV shows the file but gives you no picture or no sound, that's a codec problem. Re-encode it to H.264 with AVI to MP4 or HandBrake, or let your media server transcode on the fly. The AVI to MKV converter copies the old video as it is, so it won't help here.

Need to go back for an old player that only takes AVI? MKV to AVI does the reverse. And if container versus codec is still fuzzy, video formats explained sorts it out.

Summary

Converting AVI to MKV doesn't have to mean re-encoding. A remux in MKVToolNix or FFmpeg keeps the video bit-for-bit, takes seconds, and gives each old film a home for its subtitles and extra audio. The AVI to MKV converter does that remux online. Re-encode only when a device can't play the old codec.

Related Tools

Frequently Asked Questions

Does converting AVI to MKV lose quality?

Not if you remux. A remux copies the video and audio streams unchanged. In our test the MKV picture was identical to the AVI. A re-encode to H.264 is lossy, but at a normal quality setting the difference isn't visible.

Is the online AVI to MKV converter a remux?

Yes, for most AVIs. Xvid, DivX, H.264 and MJPEG video and MP3, AC-3 and PCM audio are copied into the MKV unchanged, and every audio track is kept; only rarer codecs are re-encoded, video to H.264 and audio to AAC. To add subtitles or name the tracks, use MKVToolNix or FFmpeg.

How do I add an SRT subtitle file to an MKV?

In MKVToolNix GUI, drag the video and the .srt into Source files, set the subtitle language and click Start multiplexing. With FFmpeg, add the .srt as a second input, map both inputs and use copy mode. Neither method re-encodes the video.

How do I convert a whole folder of AVI files to MKV?

Use MKVToolNix's job queue, or run an FFmpeg loop over the folder that remuxes each file with copy mode. Remuxing takes seconds per file, so even a large library finishes quickly. Keep the originals until you've spot-checked the results.

Will MKV files play on my smart TV?

Many TVs play MKV from USB, but old DivX and Xvid video inside the file isn't supported everywhere. If you get no picture or no sound, re-encode to H.264 and AAC, or let a media server like Plex or Jellyfin transcode it.

Should I convert AVI to MKV or MP4?

MKV if you're building an archive or a media-server library and want subtitles and several audio tracks in one file. MP4 if the files are for phones, Apple devices or sharing, because MP4 plays on more devices.

Why is my MKV smaller than the AVI after a remux?

Matroska stores the same streams with less packaging overhead than AVI. In our test a 17.4 MB AVI became a 17.2 MB MKV with identical video. A re-encode to H.264 shrinks it further, to 14.0 MB in the same test.