====== ffmpeg - Conversions - Convert TS to MP4 ======
===== Software Encoding =====
This will [[https://ffmpeg.org/ffmpeg.html#Stream-copy|stream copy]] (re-mux) all streams:
ffmpeg -i input -map 0 -c copy output.mp4
* If your inputs formats are not compatible with MP4 you will get an error.
* Your player/device may not support all arbitrary, less common, or legacy formats even if they are supported by MP4.
* If in doubt re-encode to H.264 + AAC as shown below.
This will re-encode the video to H.264 and stream copy the audio:
ffmpeg -i input.ts -c:v libx264 -c:a copy output.mp4
The next example will re-encode both video and audio:
ffmpeg -i input.ts -c:v libx264 -c:a aac output.mp4
Lossless H.264 example:
ffmpeg -i input.ts -c:v libx264 -crf 0 -c:a copy output.mp4
**WARNING:** Lossless files will be huge.
See [[https://trac.ffmpeg.org/wiki/Encode/H.264|FFmpeg Wiki: H.264]] for more info.