Convert AVI to TS — Free Online Tool
Convert AVI files to MPEG-2 Transport Stream (TS) format, re-encoding the video with H.264 and switching the audio from MP3 to AAC — the codec combination expected by broadcast pipelines, HLS streaming workflows, and digital TV systems. This is especially useful when legacy AVI content needs to enter a modern broadcast or streaming chain.
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 Microsoft container that typically stores video encoded with older codecs (DivX, Xvid, or MJPEG) alongside MP3 audio, using a fixed interleave structure that is incompatible with streaming protocols. During this conversion, the video stream is re-encoded from whatever codec is inside the AVI (commonly MPEG-4 Part 2 or H.264) into H.264 using libx264 with a CRF of 23, which produces a visually clean result at a reasonable file size. The audio is transcoded from MP3 (the AVI default) to AAC at 128k bitrate, since AAC is the audio standard required by TS-based broadcast and HLS workflows. The output is wrapped in the MPEG-2 Transport Stream container, which uses a packetized structure designed for reliable transmission over lossy channels — a fundamentally different architecture from AVI's interleaved RIFF structure. Because both video and audio are being re-encoded rather than copied, this is a full transcode, not a remux.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg tool. In this browser-based tool, FFmpeg runs locally via WebAssembly (FFmpeg.wasm) — no data is sent to a server. The same command can be run on your desktop FFmpeg installation for files over 1GB. |
-i input.avi
|
Specifies the input AVI file. FFmpeg reads the RIFF container, identifies the interleaved video and audio streams inside, and prepares them for transcoding into the TS output format. |
-c:v libx264
|
Re-encodes the video stream using the libx264 H.264 encoder. This is necessary because the TS container's broadcast and streaming use cases demand H.264, and the source AVI may contain an older codec like MPEG-4 Part 2, MJPEG, or DivX that is not suitable for modern delivery pipelines. |
-c:a aac
|
Transcodes the audio from the AVI's typical MP3 audio to AAC, which is the audio codec standard for broadcast TS streams and Apple HLS. AAC delivers better audio fidelity than MP3 at the same bitrate and is required by most modern broadcast and streaming systems that consume TS files. |
-crf 23
|
Sets the Constant Rate Factor for the H.264 encode to 23, which is libx264's default and produces a good balance of visual quality and file size. A lower value (e.g., 18) would increase quality and file size; a higher value (e.g., 28) would reduce both for the TS output. |
-b:a 128k
|
Sets the AAC audio bitrate to 128 kilobits per second, which is the standard bitrate for stereo AAC audio in streaming and broadcast TS files. This replaces the MP3 audio that was in the source AVI with an AAC stream at a quality level appropriate for most distribution use cases. |
output.ts
|
Specifies the output filename with the .ts extension, which tells FFmpeg to mux the re-encoded H.264 video and AAC audio into an MPEG-2 Transport Stream container — the packetized format used in broadcast television, DVB, and HLS streaming segments. |
Common Use Cases
- Ingesting archived AVI footage from legacy DV camcorders or capture cards into a broadcast playout system that requires TS-wrapped H.264/AAC streams
- Preparing AVI video files for HLS (HTTP Live Streaming) delivery, where the TS container is the standard segment format used by .m3u8 playlists
- Converting old AVI training videos or recordings into a format compatible with digital signage systems and IPTV middleware that expect MPEG-TS input
- Transcoding AVI files from legacy Windows-based editing software into TS for ingest into modern NLE systems or broadcast encoders that do not accept AVI
- Archiving AVI content into TS format to future-proof it for streaming infrastructure while standardizing on the widely supported H.264 + AAC codec pair
- Converting AVI recordings from surveillance or screen capture software into TS segments suitable for live streaming pipelines or CDN delivery
Frequently Asked Questions
Yes, this conversion involves a full re-encode of the video stream, which introduces some generation loss. The default CRF value of 23 used by libx264 produces visually good quality that is indistinguishable from the source for most content, but it is not lossless. If your AVI source already contains H.264 video, you could potentially copy it without re-encoding, but because AVI's index structure and TS's packetized transport structure are fundamentally incompatible, the re-encode is typically necessary for a well-formed TS output.
AVI files commonly carry MP3 audio (libmp3lame), but the MPEG-2 Transport Stream format is most commonly used in broadcast and HLS streaming contexts where AAC is the dominant and often required audio codec. AAC provides better audio quality than MP3 at the same bitrate, and it is the audio standard specified by Apple's HLS protocol and most digital broadcast systems. The conversion tool therefore switches the audio to AAC at 128k, which is the standard bitrate for stereo streaming audio.
The output TS file uses H.264 video and AAC audio, which is exactly the codec combination required by Apple's HLS specification. However, HLS delivery requires the video to be segmented into multiple short TS files and referenced by an .m3u8 playlist — a single TS file is not a complete HLS stream on its own. You can use FFmpeg's -hls_time and -hls_list_size flags to segment an AVI into HLS-ready TS chunks if that is your end goal.
Both AVI and TS support multiple audio tracks, and the MPEG-2 Transport Stream format is particularly well-suited for carrying them since it is designed for broadcast use cases with multi-language audio. However, the default FFmpeg command shown here maps only the default audio stream. To preserve all audio tracks from the AVI source, you would need to add -map 0:v -map 0:a:0 -map 0:a:1 (and so on) to the command, plus additional -c:a aac and -b:a 128k flags for each audio stream.
The -crf flag controls the quality of the H.264 encode: lower values mean higher quality and larger file sizes, while higher values mean lower quality and smaller files. The default of 23 is a good general-purpose setting. For archival or broadcast-quality output, use -crf 18 or lower. For web delivery where file size matters more than perfect fidelity, -crf 28 to 30 is a reasonable trade-off. Values below 18 approach visually lossless quality but produce significantly larger files, while values above 35 will produce noticeable compression artifacts.
Yes. On Linux or macOS you can run a shell loop such as: for f in *.avi; do ffmpeg -i "$f" -c:v libx264 -c:a aac -crf 23 -b:a 128k "${f%.avi}.ts"; 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.ts". The browser-based tool processes one file at a time, so the FFmpeg command is especially valuable for batch processing large collections of AVI files locally.
Technical Notes
AVI uses the RIFF container structure with fixed interleave chunks, which means it has no concept of the packetized, PID-based stream multiplexing that defines MPEG-2 Transport Stream. The TS format was designed for broadcast transmission over unreliable channels (satellite, DVB-T, cable) and uses 188-byte fixed-size packets with error correction metadata — a completely different structural approach from AVI. When re-encoding, the libx264 encoder writes Annex B formatted H.264 bitstream, which is the correct format for TS encapsulation (as opposed to AVCC format used in MP4). AVI files do not support subtitles or chapter markers, and TS does support subtitles (DVB, Teletext, or CEA-608/708), so no subtitle data will carry over from the source. Metadata embedded in the AVI (such as title or author tags in the INFO chunk) is not preserved in the TS output since TS has no equivalent metadata structure for descriptive tags. File size after conversion will vary considerably depending on the codec inside the source AVI — files originally encoded with old MPEG-4 Part 2 codecs like Xvid may actually shrink noticeably when re-encoded with the more efficient H.264 at CRF 23, while source AVI files that already contain H.264 at a similar quality level may see a slight size increase due to the overhead of re-encoding.