Created
March 18, 2017 19:31
-
-
Save rbanffy/c6b8fb7caf7090f615105bfdc67cbd44 to your computer and use it in GitHub Desktop.
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/sh | |
function bitrate { | |
file $1 | sed 's/.*, \(.*\)kbps.*/\1/' | |
} | |
mp3file=$1 | |
if [ $(bitrate $mp3file) -gt 192 ]; then | |
echo 'I should compress this' | |
tempfile=$(mktemp) | |
ffmpeg -i $mp3file -b:a 192k ${tempfile}.mp3 | |
if [ $? -eq 0 ]; then | |
echo it went well | |
else | |
echo it didn\'t | |
fi | |
fi | |
echo written to $tempfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment