Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Downloading a video stream with curl, I ended up with ~400 *.ts files, each about 1MB in size. They are sequentially numbered video1.ts, video2.ts, ...video400.ts. I now need to concatenate them into one file, obviously in the right order (so video10.ts should be followed by video11.ts and not video110.ts).

I've tried to come up with something like "for i in *.ts; do ...." but I just can't figure it out. Also ffmepg and avconv are too complicated for me.

Who knows how to join these 400 files in the right oreder, into a new file? Thx!

share|improve this question

2 Answers 2

What sort of does the trick:

for i in `seq 1 400`; do cat "video$i.ts" >> newvideo.ts; done

but now the audio is out of sync by ~0.5s and there are ~0.5s silences every few seconds (presumably when fragments are glued together).

share|improve this answer

This is an old question but I hope the answer may add value for others.

Based on this reference, the following script will do the job, assuming ffmpeg 1.1 and later.

#!/bin/bash

for i in `seq 0 $totalNumberOfTsFiles`; do echo  file "'${i}.ts'" >> Input.txt ; done
/home/hq6/bin/ffmpeg-2.3.3/ffmpeg -f concat -i Input.txt  -c copy output.ts
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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