Compress MKV Online — Free File Size Reducer

Compress an MKV file into a smaller MKV using H.264 video encoding and AAC audio at CRF 23 — reducing file size while preserving the container's full support for subtitles, chapters, and multiple audio tracks. Ideal for shrinking large Matroska files without switching formats or losing structural features.

FFmpeg Command

Copy this command to run the same conversion locally with FFmpeg on your desktop. Download FFmpeg

Free — no uploads, no signups. Your files never leave your browser.

Estimated output:

Conversion Complete!

Download

How It Works

Because both the input and output are MKV containers, the container itself does not change — what changes is the video stream. The input MKV may contain video encoded with H.265, VP9, or another codec; this tool re-encodes that video stream using libx264 (H.264) with a Constant Rate Factor of 23, which targets a consistent perceptual quality level and discards data the encoder deems visually redundant. The audio is re-encoded to AAC at 128k, regardless of the original audio codec. Subtitle tracks, chapter markers, and additional audio tracks embedded in the MKV are passed through to the output. The result is a fully valid MKV file that is typically significantly smaller than the source, especially when the original used a lossless or high-bitrate codec.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg binary — the open-source multimedia processing engine that handles decoding the input MKV, re-encoding the streams, and writing the compressed output MKV.
-i input.mkv Specifies the input Matroska file. FFmpeg reads all streams present in the MKV — video, audio, subtitles, and chapters — and makes them available for processing or passthrough.
-c:v libx264 Re-encodes the video stream using the libx264 H.264 encoder. This replaces whatever video codec was in the source MKV (H.265, VP9, lossless PNG, etc.) with H.264, which is the most hardware-compatible codec and a primary reason file sizes decrease significantly.
-crf 23 Sets the Constant Rate Factor to 23 for the H.264 encoder — the libx264 default. This targets a consistent perceptual quality level rather than a fixed bitrate, so complex scenes get more bits and simple scenes get fewer, efficiently balancing quality against file size.
-c:a aac Re-encodes the audio stream to AAC (Advanced Audio Coding), replacing the original audio codec whether it was FLAC, Opus, Vorbis, or MP3. AAC is broadly supported by hardware decoders and is the standard lossy audio format for media containers including MKV.
-b:a 128k Sets the AAC audio bitrate to 128 kilobits per second — a standard quality level that produces transparent or near-transparent audio for most content types including speech and music, while keeping the audio contribution to the overall file size modest.
output.mkv Defines the output file as a Matroska container. By specifying .mkv, FFmpeg retains the container format and preserves MKV-native features such as embedded subtitles, chapter markers, and multiple audio tracks that would be lost or unsupported in other container formats.

Common Use Cases

  • Shrinking a large H.265 or VP9 MKV download to a more manageable size for archiving on a storage-limited drive, while keeping subtitle and chapter data intact.
  • Compressing a raw screen recording or gameplay capture saved as MKV before sharing it with collaborators or uploading to a media server.
  • Reducing the file size of a multi-episode rip that contains multiple audio tracks and subtitles, without needing to remux into a different container that might drop those tracks.
  • Preparing an MKV with a lossless FLAC audio track for playback on a device that supports AAC but not FLAC, while keeping the file in MKV format.
  • Creating a smaller preview or rough-cut version of an MKV project file to send for review before delivering the full-quality master.
  • Compressing an MKV whose original video bitrate is excessively high (e.g., from a Blu-ray remux) to a streaming-friendly size suitable for a local Plex or Jellyfin library.

Frequently Asked Questions

Yes. The MKV container natively supports subtitles, chapters, and multiple audio tracks, and this tool passes those streams through to the output file without re-encoding them. The video and audio streams are re-encoded, but the structural metadata embedded in the Matroska container — including chapter markers and subtitle tracks — is preserved in the output MKV.
H.264 video is compatible with both MKV and MP4, but keeping the output as MKV ensures that features unique to the Matroska format — such as multiple audio tracks, embedded subtitles, and chapter markers — are not lost. MP4 has limited subtitle support and cannot carry certain track types that MKV handles natively. If your original MKV uses those features, remuxing to MP4 could silently drop them.
CRF stands for Constant Rate Factor, and it controls the quality-to-size tradeoff in libx264 encoding. A CRF of 23 is the default for H.264 and produces a good balance between visual quality and file size for most content. Lower values (e.g., CRF 18) produce larger, higher-quality files, while higher values (e.g., CRF 28 or 35) produce smaller files with more visible compression artifacts. The actual output file size depends on the complexity and motion of your video, not a fixed bitrate target.
To adjust video compression, change the number after -crf. For example, replace -crf 23 with -crf 18 for higher quality (larger file) or -crf 28 for more aggressive compression (smaller file). The valid range for libx264 is 0 (lossless) to 51 (maximum compression). To change audio quality, replace 128k after -b:a with a value like 96k for smaller audio or 192k for better fidelity. For example: ffmpeg -i input.mkv -c:v libx264 -crf 18 -c:a aac -b:a 192k output.mkv
Yes. On Linux or macOS, you can run a shell loop: for f in *.mkv; do ffmpeg -i "$f" -c:v libx264 -crf 23 -c:a aac -b:a 128k "compressed_$f"; done. On Windows Command Prompt, use: for %f in (*.mkv) do ffmpeg -i "%f" -c:v libx264 -crf 23 -c:a aac -b:a 128k "compressed_%f". This applies the same quality settings to every MKV in the current directory. The browser-based tool processes one file at a time, so the FFmpeg command is the recommended approach for bulk compression.
Yes — re-encoding is a lossy process even when the source is already H.264, because the video is fully decoded and then re-compressed. The degree of quality loss depends on the CRF value and the quality of the original encode. If the source MKV uses a lossless codec like PNG or FLAC for video, the H.264 output will be visibly lossy by comparison. If the source is already a high-bitrate H.264 or H.265 encode, CRF 23 will typically produce a smaller file with minimal perceptible quality difference at normal viewing distances.

Technical Notes

This MKV-to-MKV compression tool re-encodes the video stream with libx264 using CRF 23 and the audio stream with AAC at 128 kbps, regardless of the original codecs present in the input file. This means input files using H.265 (libx265), VP9 (libvpx-vp9), or lossless video codecs will all be transcoded to H.264 — which is more universally compatible with hardware decoders and media players, but will not produce files as small as H.265 at equivalent visual quality. The MKV container is retained, so subtitle tracks (ASS, SRT, PGS, etc.), chapter metadata, and additional audio tracks are preserved in the output. One important limitation: if the input MKV contains multiple audio tracks, all tracks are passed through structurally, but only the default audio stream is re-encoded to AAC; behavior with complex multi-track inputs may vary depending on stream mapping. The H.264 output produced by libx264 at CRF 23 is compatible with virtually all modern software players, smart TVs, and media servers including Plex, Jellyfin, and Kodi. For files larger than 1GB, the displayed FFmpeg command can be run locally on any machine with FFmpeg installed, producing byte-for-byte equivalent results to the browser tool.

Related Tools