Last active
June 3, 2016 15:08
-
-
Save bepcyc/ccd6321c3a2e8e1cae3d7579f617f61d to your computer and use it in GitHub Desktop.
Determine audio file overall bit rate in Kbps.
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
# sudo apt-get install mediainfo | |
# input is a file or a glob mask (first file is taken in this case) | |
# output is one decimal number - bitrate of a file. Zero if file not found. | |
get_bitrate() { | |
F="${1}" | |
FOUND=$(compgen -G "${F}" | head -n1) | |
if [ -z "${FOUND}" ] | |
then | |
echo 0 | |
else | |
echo $(mediainfo "${FOUND}" | grep "Overall bit rate " | tail -n1 | sed 's/.*: \(.*\) .*/\1/' | sed 's/[^0-9\\.]//g') | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment