Skip to content

Instantly share code, notes, and snippets.

@nstarke
Created March 22, 2016 23:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nstarke/c96624d15610a5321229 to your computer and use it in GitHub Desktop.
Save nstarke/c96624d15610a5321229 to your computer and use it in GitHub Desktop.
A short script to download Iowa House Video slices and reassemble them using FFMPEG
#!/bin/bash
# Example of Base URL: http://sg001-vod.sliq.net/00285-vod/_definst_/2016/03/House%20in%20Session_2016-03-22-13.58.50_2461_2.mp4
BASEURL=$1
# MAX only works up to 999 because of "seq -f "%03g". Change "%03g" as your order of magnitude increases.
MAX=$2
for i in $(seq -f "%03g" 0 $MAX); do
wget "$BASEURL/media_$i.ts" -O /tmp/video-$i.mp4
done
# change the ulimit -n 1024 to a higher number if your MAX ever gets higher than 900 or so.
ulimit -n 1024
# Must have FFMPEG installed for this to work
ffmpeg -i concat:"$(ls /tmp/*.mp4 | tr '\n' '|')" -codec copy -bsf:a aac_adtstoasc output.mp4
@waldoj
Copy link

waldoj commented Jan 3, 2018

This is exactly what I needed for capturing video from Virginia General Assembly subcommittee meetings. It hadn't crossed my mind that it might be as simple as concatenating all of the MP4 fragments together. :) I'll incorporate this into my video processor. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment