Convert AVI to MKV — Free Online Tool
Convert AVI files to MKV, upgrading from Microsoft's legacy interleaved container to the modern open-standard Matroska format while retaining full video quality. Your AVI's video stream is re-encoded with H.264 (libx264) and audio is transcoded to AAC — giving you a more capable container that supports subtitles, chapters, and multiple audio tracks that AVI simply cannot handle.
to
FFmpeg Command
Copy this command to run the same conversion locally with FFmpeg on your desktop. Download FFmpeg
Drop your AVI file here
or click to browse
Free — no uploads, no signups. Your files never leave your browser.
Settings
Note: Browser-based encoding uses approximate quality targets. For precise CRF compression, copy the FFmpeg command above and run it on your desktop.
Estimated output:
Conversion Complete!
DownloadHow It Works
AVI is a rigid, legacy container tied to Microsoft's RIFF structure, with limited codec flexibility and no native support for subtitles, chapters, or modern audio formats. When converting to MKV, the video stream is re-encoded using libx264 with a CRF of 23 (a perceptually transparent quality level for most content), and the audio — whether it was originally MP3 or another codec inside the AVI — is transcoded to AAC at 128k bitrate. This is a full transcode rather than a simple remux because AVI's interleaved audio/video structure and its codec signaling are not directly portable into the Matroska container. The result is an MKV file with broad codec compatibility, a more efficient bitstream structure, and access to Matroska's full feature set including subtitle tracks and chapter markers.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg program, the open-source multimedia processing engine that powers this conversion both in the browser (via FFmpeg.wasm) and on the desktop. |
-i input.avi
|
Specifies the input file — your source AVI file in Microsoft's legacy RIFF-based container. FFmpeg reads the interleaved audio and video streams from this file to begin the conversion process. |
-c:v libx264
|
Sets the video codec to H.264 using the libx264 encoder, re-encoding the AVI's video stream (which may have originally been DivX, Xvid, or another older codec) into the modern, universally compatible H.264 format. |
-c:a aac
|
Sets the audio codec to AAC, transcoding whatever audio was in the AVI (commonly MP3) into AAC, which offers better quality-per-bit and wider hardware decoder support on modern devices and platforms. |
-crf 23
|
Sets the Constant Rate Factor for the libx264 video encoder to 23, which is the recommended default — delivering perceptually high quality for most video content while keeping file sizes reasonable. Lower values increase quality and file size; higher values reduce both. |
-b:a 128k
|
Sets the AAC audio bitrate to 128 kilobits per second, a standard quality level that provides clean, transparent audio reproduction for speech and music in most content types. |
output.mkv
|
Specifies the output file as an MKV (Matroska) container. The .mkv extension tells FFmpeg to mux the re-encoded H.264 video and AAC audio into the Matroska format, which supports subtitles, chapters, and multiple audio tracks — features the source AVI format cannot provide. |
Common Use Cases
- Preparing old AVI home videos or archived footage for modern media players like VLC, Plex, or Jellyfin, which handle MKV's richer metadata and chapter support far better than AVI
- Adding subtitle tracks to a video — AVI cannot store subtitle streams at all, so converting to MKV is a prerequisite before muxing in SRT or ASS subtitle files
- Archiving legacy AVI content in a future-proof open-standard container that is not tied to any single operating system or vendor
- Consolidating a collection of old AVI files from the early 2000s into MKV for consistency before loading them into a media server library
- Re-encoding an AVI that uses an obscure or poorly supported codec (like DivX or Xvid) into widely compatible H.264/AAC inside MKV for reliable playback on smart TVs and streaming sticks
- Preparing a video for further editing or muxing workflows where downstream tools expect MKV, such as adding chapter metadata with mkvtoolnix after conversion
Frequently Asked Questions
Yes, there is a re-encoding step, which means some generation loss is mathematically unavoidable. However, the default CRF 23 setting with libx264 is specifically tuned to be perceptually transparent for most content — meaning visible quality loss is minimal for the vast majority of videos. If you want to minimize quality loss further, you can lower the CRF value (e.g., CRF 18) in the FFmpeg command, which increases file size but preserves more detail. There is no lossless passthrough option here because AVI and MKV handle their streams differently at a structural level.
Many AVI files store audio as MP3 (encoded with libmp3lame), and while MKV technically supports MP3 audio, the AAC codec is a better default for MKV: it delivers higher quality at equivalent bitrates and has broader hardware decoder support on modern devices including phones, smart TVs, and streaming players. Transcoding to AAC at 128k is a safe default that balances quality and compatibility. If you prefer to keep the original MP3 audio stream, you could modify the command to use '-c:a libmp3lame' instead.
Absolutely — that is one of the main reasons to convert. AVI has no native support for subtitles, chapter markers, or multiple audio tracks in any practical modern sense. MKV supports all of these natively. After converting to MKV, you can use a tool like mkvtoolnix to add SRT or ASS subtitle files, define chapter points, or mux in additional audio tracks such as commentary or alternate language dubs — none of which would be possible inside the original AVI container.
To adjust video quality, change the '-crf 23' value. Lower numbers (e.g., '-crf 18') mean higher quality and larger file size; higher numbers (e.g., '-crf 28') mean smaller files with more compression. The usable range for libx264 is 0 (lossless) to 51 (lowest quality). For audio, replace '128k' in '-b:a 128k' with your preferred bitrate — common choices are '192k' for higher quality or '96k' to reduce file size. For example: 'ffmpeg -i input.avi -c:v libx264 -c:a aac -crf 18 -b:a 192k output.mkv'.
Yes. On Linux or macOS, you can loop over all AVI files in a directory with a shell one-liner: 'for f in *.avi; do ffmpeg -i "$f" -c:v libx264 -c:a aac -crf 23 -b:a 128k "${f%.avi}.mkv"; done'. On Windows Command Prompt, use: 'for %f in (*.avi) do ffmpeg -i "%f" -c:v libx264 -c:a aac -crf 23 -b:a 128k "%~nf.mkv"'. The browser-based tool processes one file at a time, so the FFmpeg command is especially useful for batch jobs or files over 1GB.
FFmpeg will attempt to copy global metadata tags from the AVI container into the MKV output automatically. However, AVI has very limited metadata support compared to MKV, so fields like title or comment may transfer while more detailed fields simply do not exist in the source to begin with. MKV supports rich metadata including title, language tags per track, and chapter titles — but those need to be added separately after conversion if they were not present in the AVI. You can inspect what metadata transferred using 'ffprobe output.mkv'.
Technical Notes
AVI uses Microsoft's RIFF (Resource Interchange File Format) structure, which imposes a strict interleaving of audio and video data and has a hard file size limit of 2GB for standard AVI (mitigated in OpenDML AVI extensions). Because of this structural difference, converting to MKV is always a full transcode — the raw interleaved stream cannot be remuxed directly. The chosen video codec, libx264, produces H.264 Baseline/Main/High profile output that is universally supported by hardware decoders. The CRF 23 default is the libx264 project's own recommended default and represents an excellent quality-to-filesize balance. One known tradeoff: depending on the original AVI's video codec (DivX, Xvid, or older MPEG-4 variants were common in AVI files from the 2000s), the re-encode will always involve a generation of quality loss, so starting from the highest-quality AVI source available is recommended. AVI does not support subtitles or chapters, so none will be carried into the MKV output from the source — but the MKV output is fully ready to have those added afterward via mkvtoolnix or a subsequent FFmpeg mux command. Multiple audio tracks in the AVI, if present, will be handled by FFmpeg's default stream selection, which picks the best single audio stream; use '-map 0' in the command to force all streams to be processed.