Created
August 26, 2014 15:44
-
-
Save ryanfb/311ac8ee04cf5c4af11a to your computer and use it in GitHub Desktop.
Script to convert and join a directory of youtube-dl flv files from Twitch to mp4 for upload/archiving to YouTube
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| function join { local IFS="$1"; shift; echo "$*"; } | |
| outfile="$(basename "$(ls -1 *.flv|head -1)" .flv).mp4" | |
| if [ ! -f outfile ]; then | |
| i=0 | |
| lnfiles=() | |
| for j in *.flv; do | |
| echo $j | |
| targetfile="file$i.flv" | |
| ln -sv "$j" $targetfile | |
| lnfiles[$i]=$targetfile | |
| i=$(($i+1)) | |
| done | |
| declare -p lnfiles | |
| ffmpeg -n -i "concat:$(join "|" ${lnfiles[@]})" -threads 0 "$outfile" | |
| for lnfile in "${lnfiles[@]}"; do | |
| rm -v $lnfile | |
| done | |
| else | |
| echo $outfile exists, skipping | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment