Last active
January 7, 2018 19:09
-
-
Save alecjacobson/b4e8f59bbd251ed81df4c5fe8441f630 to your computer and use it in GitHub Desktop.
Concatenate mp3s in a directory and subdirectories into a .m4b file
This file contains 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
# https://gist.github.com/alecjacobson/b4e8f59bbd251ed81df4c5fe8441f630 | |
# | |
# brew install ffmpeg --with-fdk-aac | |
OLDPWD=$( pwd ) | |
cd "$1" | |
paths=$( find . -name "*.mp3" | sed 's/\([0-9]\)/;\1/' | sort -n -t\; -k2,2 | tr -d ';') | |
echo "$paths" | |
concat_paths=$( echo "$paths" | tr '\n' '|' ) | |
ffmpeg -i "concat:$concat_paths" -c:a libfdk_aac -b:a 128k -f mp4 "$2" | |
cd "$OLDPWD" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment