Compress AVI Online — Free File Size Reducer
Compress an AVI file by re-encoding it with H.264 video (libx264) and MP3 audio (libmp3lame), producing a smaller AVI that retains broad compatibility with legacy Windows software and media players. This is ideal when you need to reduce file size while keeping the AVI container intact for workflows that depend on it.
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
Because both the input and output are AVI containers, this tool does not simply remux the file — it actively re-encodes both the video and audio streams. The video is compressed using the libx264 H.264 encoder at CRF 23, a visually transparent quality level that typically achieves substantial file size reduction over uncompressed, MJPEG, or older DivX/Xvid video that may have been stored in the original AVI. The audio is re-encoded to MP3 at 128 kbps using the LAME encoder. The result is a new AVI file where the H.264 video stream and MP3 audio stream are interleaved according to the AVI specification — a combination that is widely supported by legacy and modern players alike.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg binary. In the browser, this runs via FFmpeg.wasm compiled to WebAssembly, executing entirely on your local machine without any server upload. |
-i input.avi
|
Specifies the input AVI file. FFmpeg will detect the container as AVI and identify the video and audio streams inside it — which could be MJPEG, uncompressed, DivX, Xvid, H.264, or other codecs commonly found in AVI files. |
-c:v libx264
|
Re-encodes the video stream using the libx264 H.264 encoder. This replaces whatever codec the source AVI used (MJPEG, uncompressed, older MPEG-4, etc.) with the far more efficient H.264, which is the primary driver of file size reduction in this command. |
-crf 23
|
Sets the Constant Rate Factor for the H.264 encoder to 23, which is libx264's default and represents a visually high-quality setting. Increasing this number (e.g., 28–35) compresses more aggressively at the cost of visible quality degradation; decreasing it (e.g., 18) produces a larger file closer to the source quality. |
-c:a libmp3lame
|
Re-encodes the audio stream to MP3 using the LAME encoder. MP3 is the most universally supported audio codec inside AVI containers, ensuring the output file plays correctly in legacy Windows applications, old media players, and hardware devices that expect AVI. |
-b:a 128k
|
Sets the MP3 audio bitrate to 128 kbps, a standard lossy quality level that provides acceptable fidelity for most speech and music content while keeping the audio contribution to overall file size modest. Raise to 192k or 320k for higher audio quality, or lower to 96k or 64k for maximum compression. |
output.avi
|
Writes the result back to an AVI container, preserving the legacy format. FFmpeg uses the .avi extension to determine the output container, ensuring the re-encoded H.264 video and MP3 audio are packaged with proper RIFF/AVI interleaving. |
Common Use Cases
- Shrinking large uncompressed or MJPEG-encoded AVI files from older digital cameras or screen recorders before archiving them to a drive or sharing them.
- Reducing the size of raw AVI captures from older video digitization hardware (VHS-to-digital converters) without changing the container format required by legacy editing software.
- Compressing AVI files for use with Windows XP or Windows Media Player environments where AVI is the expected format but disk space is limited.
- Preparing smaller AVI files for upload to legacy video hosting platforms or industrial systems that accept only AVI container input.
- Re-encoding a bloated DivX or Xvid AVI that was compressed with an inefficient older codec to take advantage of H.264's superior compression efficiency.
- Generating a compressed AVI reference copy of footage while keeping the original, so editors working in legacy tools can preview on low-spec machines.
Frequently Asked Questions
Yes, this is a lossy re-encode — both the video and audio are decoded from their original encoding and re-compressed. The CRF 23 setting used for H.264 produces visually high quality that is difficult to distinguish from the source at normal viewing distances, but some generational quality loss does occur. If your source AVI is already H.264 at a similar or lower CRF, re-encoding will degrade quality slightly while not necessarily reducing file size significantly. For uncompressed or MJPEG source AVIs, the quality trade-off is typically very favorable given the dramatic file size reduction.
This specific tool targets workflows where the AVI container must be preserved — for example, legacy software, industrial systems, or institutional pipelines that explicitly require AVI input. If you have no constraint on the output container, converting to MP4 instead would give you a more modern container with better compatibility for web and mobile playback, but the compression efficiency of H.264 at CRF 23 will be identical either way. This tool is for situations where AVI in equals AVI out.
Yes, H.264 video and MP3 audio are both valid streams inside an AVI container, and this combination has been supported by VLC, Windows Media Player (with the right codec pack), and most DirectShow-based players for many years. However, H.264 inside AVI is technically non-standard — the AVI container predates H.264 and lacks some features that H.264 benefits from in newer containers like MP4 or MKV. Some strictly conformant AVI parsers may struggle with it, so test playback in your target environment before relying on this output for critical workflows.
The `-crf 23` flag controls video compression. CRF (Constant Rate Factor) values range from 0 (lossless) to 51 (maximum compression, lowest quality); lower numbers mean better quality and larger files. To compress more aggressively, raise the CRF value — for example, `-crf 28` will produce a noticeably smaller file at a moderate quality reduction, while `-crf 35` will compress very heavily. To change audio bitrate, modify the `-b:a 128k` flag — for example, `-b:a 96k` for smaller files or `-b:a 192k` for higher audio fidelity.
Yes. On Linux or macOS you can use a shell loop: `for f in *.avi; do ffmpeg -i "$f" -c:v libx264 -crf 23 -c:a libmp3lame -b:a 128k "compressed_$f"; done`. On Windows Command Prompt, use `for %f in (*.avi) do ffmpeg -i "%f" -c:v libx264 -crf 23 -c:a libmp3lame -b:a 128k "compressed_%f"`. This will re-encode every AVI in the current directory and prefix each output file with 'compressed_' to avoid overwriting the originals. The in-browser tool processes one file at a time.
AVI supports multiple audio tracks, and FFmpeg will map all detected streams by default, re-encoding each audio track to MP3 at 128 kbps. However, AVI has very limited metadata support compared to modern containers — it stores basic tags like title in a simple RIFF INFO chunk, but rich metadata (creation date, embedded thumbnails, extended tags) is not well-supported and may be dropped during re-encoding. If metadata preservation is critical, consider outputting to MKV or MP4 instead.
Technical Notes
AVI (Audio Video Interleave) is a RIFF-based container from 1992 that interleaves audio and video chunks at fixed intervals, which is why it requires the entire file to be written before the index is finalized — making it poorly suited for streaming. When re-encoding AVI to AVI with H.264, FFmpeg writes an OpenDML AVI (AVI 2.0) index extension for files over ~1 GB to avoid the 2 GB file size limit of the original AVI specification. The libx264 encoder at CRF 23 produces variable bitrate video where complex scenes receive more bits than static scenes, which is optimal for compression efficiency but means the output AVI's interleave timing may differ from the original. MP3 audio via libmp3lame is the most compatible audio codec for AVI; AAC inside AVI is technically possible but poorly supported by legacy players. Note that AVI does not support subtitle tracks, chapter markers, or embedded cover art — any of these present in a source file will be silently discarded. For files that push against the 1 GB in-browser processing limit, the displayed FFmpeg command can be run directly on a desktop machine with no file size restrictions.