Convert MP4 to TS — Free Online Tool
Convert MP4 files to MPEG-2 Transport Stream (TS) format using H.264 video and AAC audio — the standard container for broadcast television, HLS live streaming, and DVR systems. This tool runs entirely in your browser using FFmpeg.wasm, so your video files never leave your device.
to
FFmpeg Command
Copy this command to run the same conversion locally with FFmpeg on your desktop. Download FFmpeg
Drop your MP4 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
MP4 and TS both natively support H.264 (libx264) and AAC audio, which means this conversion is largely a container swap rather than a full re-encode. The H.264 video stream is re-encoded using CRF 23 (a perceptually lossless quality setting for most content) and AAC audio is encoded at 128k bitrate — this ensures the output is properly structured for the TS container's fixed packet-size transport layer. Unlike MP4, which uses a seekable moov atom structure, TS organizes data into 188-byte packets with Program Association and Program Map Tables, making it inherently suitable for streaming and broadcast without needing the file to be fully downloaded before playback. Note that MP4-specific metadata like chapter markers will not carry over, as the TS format does not support chapters.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg binary. When run in the browser, this is executed via FFmpeg.wasm (WebAssembly), producing identical output to the desktop version of FFmpeg without any server upload. |
-i input.mp4
|
Specifies the input file as an MP4 container, which FFmpeg parses to extract the H.264 video stream, AAC or other audio stream, and any subtitle or chapter metadata present in the file. |
-c:v libx264
|
Encodes the video output using the libx264 encoder, producing an H.264 video stream compatible with the TS container and required for HLS compatibility. This re-encodes the video rather than copying it, ensuring the stream is properly structured for TS packetization. |
-c:a aac
|
Encodes the audio output using FFmpeg's native AAC encoder, producing an AAC audio stream encapsulated as ADTS within the TS container — the standard audio format for broadcast TS and HLS streams. |
-crf 23
|
Sets the Constant Rate Factor for the H.264 encoder to 23, which is the libx264 default and produces high-quality output for most video content at a reasonable file size. Lower values (e.g., 18) increase quality and file size; higher values (e.g., 28) reduce both. |
-b:a 128k
|
Sets the audio bitrate to 128 kilobits per second for the AAC stream, which is the standard quality level for broadcast and streaming audio — sufficient for stereo music and speech content in a TS transport stream. |
output.ts
|
Specifies the output filename with the .ts extension, which tells FFmpeg to use the MPEG-2 Transport Stream muxer and structure the encoded H.264 and AAC streams into 188-byte TS packets with the appropriate PAT and PMT program tables. |
Common Use Cases
- Preparing MP4 recordings for ingestion into an HLS (HTTP Live Streaming) pipeline, where segment muxers expect MPEG-TS input
- Archiving video content to TS format for compatibility with broadcast equipment, DVRs, or set-top boxes that do not accept MP4
- Converting MP4 files for playback on media servers or IPTV systems that require MPEG-2 Transport Stream input
- Packaging MP4 footage for upload to broadcast playout systems used in television production workflows
- Splitting or segmenting video for live streaming infrastructure where TS segments are the required intermediate format
- Converting MP4 screen recordings or lecture videos into TS for use with streaming middleware that wraps segments into an HLS manifest
Frequently Asked Questions
Yes, there is some generation loss because the video is re-encoded rather than simply copied, even though both containers support H.264. The default CRF 23 setting produces visually high-quality output that is indistinguishable from the source for most content, but it is not mathematically lossless. If you need to minimize quality loss, you can lower the CRF value (e.g., CRF 18) at the cost of a larger file size.
MPEG-2 Transport Stream has a fixed 188-byte packet structure with per-packet headers and padding, which introduces overhead compared to MP4's more compact container structure. Additionally, if the re-encoding CRF setting produces a bitrate higher than the original MP4's video bitrate, the output will be larger. You can reduce file size by increasing the CRF value (e.g., CRF 28), though this will reduce quality slightly.
No. MPEG-2 Transport Stream does not support the chapter metadata format used by MP4. Chapter information stored in the MP4 container is dropped during conversion. If chapters are important for your workflow, you will need to manage them at the player or streaming layer separately, for example using an HLS manifest with discontinuity tags.
Yes. TS files encoded with H.264 video and AAC audio are fully compatible with Apple's HLS specification and can be directly segmented using FFmpeg's segment muxer or hls muxer. The H.264 + AAC codec pairing used in this conversion is the baseline required for HLS compatibility across iOS, macOS, and Apple TV devices.
To adjust video quality, change the CRF value: lower numbers (e.g., -crf 18) give higher quality at larger file sizes, while higher numbers (e.g., -crf 28) reduce file size at the cost of some quality. The valid range is 0 (lossless) to 51 (worst). To adjust audio bitrate, change the -b:a value — for example, use -b:a 192k for higher-fidelity audio or -b:a 96k for smaller files. The command would become: ffmpeg -i input.mp4 -c:v libx264 -c:a aac -crf 18 -b:a 192k output.ts
Yes, on Linux or macOS you can use a shell loop: for f in *.mp4; do ffmpeg -i "$f" -c:v libx264 -c:a aac -crf 23 -b:a 128k "${f%.mp4}.ts"; done. On Windows Command Prompt, use: for %f in (*.mp4) 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 the recommended approach for batch jobs.
Technical Notes
The MPEG-2 Transport Stream format was designed for lossy transmission environments — its 188-byte fixed-packet structure allows receivers to resync after packet loss, which is why it remains the standard for broadcast television and HLS streaming. Unlike MP4, TS has no concept of a global file header, so it can be streamed indefinitely without buffering the entire file first. This conversion uses H.264 (libx264) with CRF-based encoding, which is variable bitrate and targets a constant perceptual quality level rather than a fixed bitrate — appropriate for file-based workflows but note that broadcast systems requiring CBR (Constant Bit Rate) output will need an additional -b:v and -maxrate/-bufsize constraint. Multiple audio tracks are supported in TS via separate PIDs, and subtitle tracks can be carried as DVB or SCTE streams, though the default command does not map additional streams — add -map 0 to pass all streams from the MP4. The TS container does not support MP4's 'faststart' optimization (the -movflags +faststart flag) because TS is inherently streamable by design. Chapter metadata from MP4 is silently discarded. AAC audio in TS is typically encapsulated as ADTS, which is slightly less efficient than the MP4/LATM encapsulation but universally supported by broadcast and streaming decoders.