Hacker News new | ask | show | jobs
by ww520 1457 days ago
Most streaming sites break a video into many small fragments, which are listed in a m4mu file. I have a script to download the fragments one by one using curl. To merge the video fragments back into one file, I do the following.

  Merge video files with ffmpeg
  - Make a file listing all the videos in sequence. E.g.
     file 'video01.ts'
     file 'video02.ts'
     file 'video03.ts'
     ...
  - Generate the file list for files in the current directory.
      (for %i in (*.ts) do @echo file '%i') > filelist.txt
  - ffmpeg command to combine videos
     ffmpeg -f concat -safe 0 -i filelist.txt -c copy output.mp4
1 comments

For anyone needing this youtube-dl (and ffmpeg if you need post-dl conversion) can do this for you if it's any easier, point it at the index file and let it do its thing
Youtube-dl is great. I just wanted to build it from scratch, and it was very simple once the underlying streaming tech was understood.