Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a bunch of ts segments described by a single index.m3u8 file:


I know they are all encoded the same way. ffprobe gives me the following:

Input #0, mpegts, from 'segment1_0_av.ts':
  Duration: 00:00:10.00, start: 0.100511, bitrate: 1251 kb/s
  Program 1 
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 12.50 fps, 25 tbr, 90k tbn, 25 tbc
    Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 105 kb/s
    Stream #0:2[0x102]: Unknown: none ([21][0][0][0] / 0x0015)

I'd like to combine them into a single mp4 container. But when I try commands like:

ffmpeg -f concat -i filelist.txt -c copy output.mp4

where the generate the filelist.txt from the index.m3u8 file, it complains about not being able to read various files. But converting the ts files themselves seem to work fine. I think I'm not using ffmpeg properly.

How do I use ffmpeg to combine the ts files described by index.m3u8 into a single mp4 container using the copy codec?

share|improve this question
Please show your complete ffmpeg console output from your ffmpeg command and the contents of filelist.txt. – LordNeckbeard Dec 25 '13 at 21:25

I'm not sure why ffmpeg is giving you an error. However ts is one of the few formats that can simply be concatenated. Then, once you have a single ts, transmux to mp4.

Under windows:

copy /b segment1_0_av.ts+segment2_0_av.ts+segment3_0_av.ts all.ts
ffmpeg -i all.ts -acodec copy -vcodec copy all.mp4

Under GNU/Linux, using bash:

cat segment1_0_av.ts segment2_0_av.ts segment3_0_av.ts > all.ts
ffmpeg -i all.ts -acodec copy -vcodec copy all.mp4
share|improve this answer
You may also need -bsf:a aac_adtstoasc. – Camilo Martin Jul 3 at 20:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .