How to Use TSremux for Lossless TS to MP4 Conversion
Converting Transport Stream (TS) files to MP4 without recompressing preserves original audio and video quality and is fast. TSremux is a compact tool that remuxes TS containers to MP4 while keeping streams intact. This guide shows a practical, step-by-step workflow, troubleshooting tips, and common options to ensure a lossless conversion.
What “lossless remux” means
- Lossless remux: Moving audio/video/subtitle streams from one container (TS) into another (MP4) without re-encoding. Frame data and bitrate remain unchanged, so there’s no quality loss and conversion is fast.
Prepare: requirements
- A recent build of TSremux (download from the project’s releases).
- FFmpeg (optional — useful to inspect streams or fix minor stream issues).
- Basic command-line familiarity (Windows Command Prompt, macOS Terminal, or Linux shell).
Step 1 — Inspect the TS file
Use FFmpeg to list streams (optional but recommended):
Code
ffmpeg -i input.ts
This shows video/audio codec, codec parameters, stream indices, and subtitles. Note the stream codecs (e.g., H.264/HEVC for video, AAC/AC3 for audio) and which streams you want to keep.
Step 2 — Basic TSremux command
A simple remux keeping all streams:
Code
tsremux -i input.ts -o output.mp4
- -i : input file
- -o : output file
This command copies streams into MP4 without re-encoding. If TSremux completes without errors, output.mp4 will contain the same video/audio data in an MP4 container.
Step 3 — Select-specific streams
If you want only certain streams, specify them by track ID or index (TSremux syntax may vary by version; the example below shows a common pattern):
Code
tsremux -i input.ts -o output.mp4 –video 0 –audio 1 –subtitle 2
- Replace indices with the correct stream numbers from Step 1. This reduces output size and removes unwanted tracks.
Step 4 — Fix common issues
- Audio/video out of sync: remuxers can preserve timestamps, but if input has broken timestamps use FFmpeg to generate a clean TS first:
Code
ffmpeg -i input.ts -c copy -bsf:v h264mp4toannexb -fflags +genpts clean.ts
Then remux clean.ts with TSremux.
- Unsupported codecs in MP4 (e.g., MPEG-2 video or certain subtitles): convert or remove incompatible streams. For example, re-encode video to H.264 with FFmpeg (this is no longer lossless):
Code
ffmpeg -i input.ts -c:v libx264 -c:a copy output.mp4
Only re-encode when necessary.
Step 5 — Batch processing
Use a shell loop to remux multiple files:
- Linux/macOS:
Code
for f in.ts; do tsremux -i “\(f" -o "\){f%.ts}.mp4”; done
- Windows PowerShell:
Code
Get-ChildItem *.ts | ForEach-Object { tsremux -i \(_.FullName -o (\).BaseName + “.mp4”) }
Step 6 — Verify result
Play output.mp4 in VLC or MPV to confirm video, audio, and subtitles are present and synced. Use ffprobe for technical verification:
Code
ffprobe output.mp4
Common TSremux options (examples)
- –help : show usage
- –video : include specific video track
- –audio : include specific audio track(s)
- –subtitle : include subtitle track(s)
- -o, –output : output filename
(Option names vary by TSremux version—use –help to confirm.)
Troubleshooting quick reference
- Remux fails with “unsupported codec”: remove or re-encode that stream.
- Missing subtitles in MP4: many subtitle formats in TS aren’t supported by MP4 — extract and convert (e.g., convert DVB subtitles to SRT) or keep them in a separate sidecar file.
- Corrupted timestamps: re-mux via FFmpeg with genpts before TSremux.
Summary
- Use TSremux to copy streams from TS to MP4 for a fast, lossless container conversion.
- Inspect streams first with ffmpeg/ffprobe.
- Select only the streams you need.
- If input has codec or timestamp issues, pre-process with FFmpeg.
- Batch process with simple shell loops and verify outputs with players or ffprobe.
If you tell me your OS and TSremux version (or paste tsremux –help output), I can provide exact command syntax tailored to your setup.
Leave a Reply