Pull the last 2 highlights from a users channel:
https://api.twitch.tv/kraken/channels/ennopp112/videos?limit=2
Get a single video:
https://api.twitch.tv/kraken/videos/c3473004
Scrape request to get .flv links:
http://download.twitchapps.com/listparts.php?id=a491359489
http://download.twitchapps.com/listparts.php?id=c3507928
transcode videos down to a reasonable size:
ffmpeg -y -i enop2.flv -c:v libx264 -preset ultrafast -crf 40 -c:a copy output2.mp4
Bash command to convert all .flv files into a directory:
for f in ./*.flv; do ffmpeg -y -i $f -c:v libx264 -preset ultrafast -crf 18 -c:a copy "$f".mp4; done
Bash script to create mylist.txt:
for f in ./*.mp4; do echo "file '$f'" >> mylist.txt; done
Or this command:
printf "file '%s'\n" ./*.mp4 > mylist.txt
Now join all the video files:
ffmpeg -f concat -i mylist.txt -c copy output
Some notes on shortening clips:
There are two ways how to split video files by ffmpeg. The first one is good in itself, more than that - it is faster, but sometimes creates output files with certain flaws. So for those cases there is the second way of splitting video files: it is considerably slower, the output files are bigger, but it seems they are always of the same quality level as input files used.
Way 1:
ffmpeg -ss <start> -i in1.avi -t <duration> -c copy out1.avi
Way 2:
ffmpeg -ss <start> -i in1.avi -t <duration> out1.avi
<start> – the beginning of the part of a video ffmpeg is to cut out. Format: 00:00:00.0000, meaning hours:minutes:seconds.milliseconds
<duration> – the duration of the part of a video ffmpeg is to cut out. Same format as above.
Examples:
ffmpeg -ss 01:19:00 -i in1.avi -t 00:05:00 -c copy out1.avi
ffmpeg -ss 01:19:00 -i in1.avi -t 00:05:00 out1.avi
ffmpeg cuts out a part of the video file starting from 1 hour 19 minutes 0 seconds. The duration of the video sequence cut out is 5 minutes 0 seconds.