#!/usr/bin/env bash if [ "$#" -ne 2 ] ; then echo "USAGE: $0 "; exit fi base=$(echo "$1" | rev | cut -d'/' -f2- | rev) curl -s "$1" | grep -v "^#" | sed -e "s>^>$base/>" | xargs curl -s | ffmpeg -i pipe:0 -c:v copy -c:a copy "$2"