Convert AVI to M2TS — Free Online Tool
Convert AVI files to M2TS (BDAV MPEG-2 Transport Stream) format, re-encoding video with H.264 and audio with AAC — the standard codec pairing used on Blu-ray discs and AVCHD camcorders. This conversion brings legacy Microsoft AVI container content into a broadcast-grade, high-definition compatible transport stream format.
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 legacy container that interleaves audio and video chunks using Microsoft's RIFF structure, often carrying older codec streams like DivX, Xvid, or MJPEG. During this conversion, the video stream is fully re-encoded to H.264 (libx264) and the audio is transcoded to AAC — both of which are required for BDAV-compliant M2TS output. The output is wrapped in an MPEG-2 Transport Stream, which uses fixed-size 188-byte packets designed for reliable broadcast and disc playback. Unlike a simple remux, this is a full transcode: every frame is decoded from whatever codec the AVI source used and re-encoded to H.264 at CRF 23, meaning quality is controlled perceptually rather than by a fixed bitrate. The M2TS container also gains subtitle track support that AVI lacks, though no subtitle streams are added by this command by default.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg binary — the open-source multimedia processing engine that powers this conversion both in the browser (via FFmpeg.wasm) and on your local desktop when you run the command directly. |
-i input.avi
|
Specifies the input AVI file. FFmpeg will probe the RIFF container to detect the video and audio codecs present — which could be anything from DivX to MJPEG to H.264 — before decoding them for re-encoding. |
-c:v libx264
|
Re-encodes the video stream to H.264 using the libx264 encoder, which is the standard video codec for Blu-ray and AVCHD-compatible M2TS content, replacing whatever codec the source AVI used. |
-c:a aac
|
Transcodes the audio stream to AAC using FFmpeg's built-in AAC encoder, replacing AVI's commonly used MP3 or PCM audio with the codec preferred for BDAV M2TS compatibility across Blu-ray players and AVCHD devices. |
-crf 23
|
Sets the H.264 Constant Rate Factor to 23, the default perceptual quality target for libx264. Lower values produce higher quality and larger files — use -crf 18 for near-lossless results or -crf 28 to prioritize smaller file size. |
-b:a 128k
|
Sets the AAC audio bitrate to 128 kilobits per second, a standard quality level that provides clean audio for most AVI source material including speech and moderate music, keeping the M2TS file size reasonable. |
output.m2ts
|
Specifies the output filename with the .m2ts extension, which causes FFmpeg to write the encoded H.264 video and AAC audio into an MPEG-2 Transport Stream container formatted for BDAV (Blu-ray Disc Audio-Video) compatibility. |
Common Use Cases
- Prepare archival AVI footage from older DV camcorders or DVD rips for playback on Blu-ray players that require M2TS/BDAV-formatted files on USB drives or burned discs.
- Transcode AVI files recorded by legacy capture cards into M2TS for ingestion into professional broadcast or non-linear editing workflows that expect transport stream inputs.
- Convert MJPEG or DivX-encoded AVI home videos into H.264 M2TS for long-term archival in a modern, widely-decodable codec while retaining HD-compatible container structure.
- Repackage AVI content sourced from old gaming capture devices into M2TS format compatible with Sony PlayStation 3 or other Blu-ray-capable media players.
- Migrate a collection of AVI-format training or documentary videos into M2TS so they can be authored onto AVCHD-compatible Blu-ray discs using disc authoring software.
- Convert AVI files with multiple audio tracks into M2TS, which preserves multi-track audio support and allows Blu-ray players to switch between language or commentary tracks.
Frequently Asked Questions
Yes, this conversion involves a full re-encode of both video and audio, so some generation loss is inevitable. The video is re-encoded using H.264 at CRF 23, which is a perceptually transparent quality level for most content — you are unlikely to notice degradation on typical AVI source material. Audio is transcoded to AAC at 128k, which is generally clean for speech and moderate music. If your AVI source already used a lossy codec like DivX or MP3, you are compressing already-compressed data, so keeping the CRF value low (e.g., 18) will help preserve quality.
BDAV M2TS format has strict codec requirements inherited from the Blu-ray specification. While MP3 is technically permitted in some transport stream profiles, AAC is the preferred and more universally supported audio codec for M2TS content, especially for AVCHD compatibility. The FFmpeg command therefore transcodes the source audio — which in AVI is commonly MP3, PCM, or AC3 — to AAC at 128k to ensure reliable playback across Blu-ray players, AVCHD devices, and media software that consume M2TS files.
Yes, the -crf flag controls H.264 video quality on a scale from 0 (lossless) to 51 (lowest quality). The default is 23, which is a good general-purpose setting. For higher quality output — especially if your AVI source is already high-resolution — try -crf 18, which produces noticeably sharper results at the cost of a larger file. For smaller files where quality is less critical, -crf 28 or higher is acceptable. You can also change audio bitrate by modifying the -b:a value, for example to 192k or 320k for higher-fidelity audio in the M2TS output.
The single-file command shown works for one file at a time, but you can batch process in a shell loop. On Linux or macOS, use: for f in *.avi; do ffmpeg -i "$f" -c:v libx264 -c:a aac -crf 23 -b:a 128k "${f%.avi}.m2ts"; done. On Windows Command Prompt: for %f in (*.avi) do ffmpeg -i "%f" -c:v libx264 -c:a aac -crf 23 -b:a 128k "%~nf.m2ts". The browser-based tool processes one file at a time, but the FFmpeg command is ideal for bulk conversions of large AVI libraries on your local machine.
Yes — both AVI and M2TS support multiple audio tracks, and M2TS actually handles multi-track audio more robustly as part of its BDAV specification. By default, FFmpeg maps the first audio stream from the AVI to the output. To preserve all audio tracks from a multi-track AVI, add -map 0:v -map 0:a to the command before the output filename, which tells FFmpeg to include all available video and audio streams in the M2TS file.
This can happen when the source AVI was encoded with a very aggressive lossy codec like heavily compressed DivX or Xvid at a low bitrate. Re-encoding to H.264 at CRF 23 targets a perceptual quality level rather than matching the original bitrate, so if the source was very low quality, the H.264 output may allocate more bits to represent the content cleanly. Additionally, the MPEG-2 Transport Stream container has a small per-packet overhead from its 188-byte packet structure. To reduce output file size, increase the CRF value (e.g., -crf 28 or -crf 30).
Technical Notes
AVI files carry video and audio in a RIFF-based interleaved structure with an index chunk — a design from 1992 that imposes no codec requirements, meaning AVI files in the wild may contain nearly any codec: DivX, Xvid, MJPEG, H.264, PCM, MP3, or AC3. This command unconditionally re-encodes all streams to ensure BDAV-compliant output, using libx264 for video and AAC for audio. The M2TS container uses MPEG-2 Transport Stream packetization (188-byte fixed-length packets with 4-byte headers), which was designed for resilience against transmission errors in broadcast environments — a structural characteristic very different from AVI's sequential chunk layout. AVI does not support subtitles natively, but M2TS does; however, this command does not add subtitle streams unless you explicitly map them with -map. AVI also lacks chapter support, and M2TS similarly has no chapter metadata in this command. One notable limitation: AVI files sometimes contain VBR MP3 audio with incorrect header information that causes FFmpeg to misreport stream duration; if your output M2TS has sync issues, add -fflags +genpts to the command to force timestamp regeneration. Transparency is not supported in either format for video streams.