I have several similarly-encoded .ts video files that I would like to concatenate and encode into a single .mp4 file.

The .ts files look like

Input #0, mpegts, from 'input1.ts':
  Duration: 00:01:24.14, start: 0.066778, bitrate: 15941 kb/s
  Program 1 
    Stream #0:0[0x44]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:1[0x45]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 251 kb/s

The output should be 640x480, 29.97fps video. (The .ts files contain digitized old Hi8 camcorder video, digitized at a much-too-generous bitrate & resolution for the Hi8 video format.)

I can encode a single .ts file like this:

$ ffmpeg -i input1.ts -c:v libx264 -vf scale=640:480 -aspect 4:3 -preset slow -crf 22 -r 29.97 output.mp4

What is the correct way to concatenate several .ts files into a single .mp4 without creating a huge intermediate .ts file?

This ffmpeg documentation presents three concatenation methods: filter, demuxer, and protocol. I think I want the "filter" flavor. However, their example of it is confusing.

1 Answer 1


You can just use the protocol

ffmpeg -i "concat:in1.ts|in2.ts|in3.ts" -c:v libx264 -r 30000/1001 -vf scale=640:480 -aspect 4:3 -preset slow -crf 22 output.mp4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.