Skip to content

Instantly share code, notes, and snippets.

@rbanffy rbanffy/mp3reduce.sh
Created Mar 18, 2017

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.