Created
November 20, 2017 10:00
-
-
Save Nepomuk/07daa4fb286d6168d56841703369aa36 to your computer and use it in GitHub Desktop.
Keep only the English audio track of a mkv 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
#!/bin/bash | |
directory=$1 | |
dest=/Volumes/Andre_800G/Serien/ready/ | |
destBin="done" | |
cd $directory | |
if [ ! -d "$destBin" ]; then | |
echo "Creating folder $destBin..." | |
mkdir $destBin | |
fi | |
shopt -s nullglob | |
for f in *.mkv | |
do | |
echo "Processing file $f..." | |
trackID=$(mkvmerge -I "$f" | sed -En 's/Track ID ([0-9]*): audio.*language:eng.*/\1/p') | |
mkvmerge -o "$dest/$f" -a $trackID "$f" | |
echo "Move the file to the \'$done\' folder." | |
mv "$f" $destBin | |
echo "" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment