Created
June 27, 2016 18:38
-
-
Save alexanderwallin/1e56d8420bf394ac3ba2ff347dee39a2 to your computer and use it in GitHub Desktop.
Unpacks stems into folders with cover art and separate tracks using ffmpeg
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
#!/bin/bash | |
# | |
# Extracts tracks from stems files and puts them in folders | |
# named after the stem filenames. | |
# | |
for stem in *.mp4 | |
do | |
name=${stem%\.*} | |
echo $name | |
# Create a directory | |
rm -R ./"$name" | |
mkdir $name | |
# Album cover | |
coverFilename="$name"/"$name"_cover.jpg | |
echo " - Extracting album cover to $coverFilename" | |
ffmpeg -i "$stem" -an -vcodec copy "$coverFilename" | |
# Audio tracks | |
for trackNo in 1 2 3 4 | |
do | |
trackFilename="$name"/"$name"_"$trackNo".m4a | |
echo " - Extracting audio track $trackNo to $trackFilename" | |
ffmpeg -i $stem -map 0:$trackNo -vn "$trackFilename" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment