Skip to content

Instantly share code, notes, and snippets.

@rbanffy
Created March 18, 2017 19:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rbanffy/c6b8fb7caf7090f615105bfdc67cbd44 to your computer and use it in GitHub Desktop.
#!/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