Created
June 18, 2019 10:42
-
-
Save kescherCode/11bf1b3ef5aa62de69f13243c4949a9a to your computer and use it in GitHub Desktop.
List 24-bit and 16-bit FLACs in current directory.
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
#!/usr/bin/env bash | |
# Check if mediainfo is installed. That tool is needed to parse the bit depth of flac files in your current directory. | |
if ! `hash mediainfo &>/dev/null`; then | |
echo "Install mediainfo prior to using this script!" | |
exit 1; | |
fi | |
bit24="24-bit:\n" | |
bit16="16-bit:\n" | |
for f in *.flac; do | |
# --Inform="Audio;%BitDepth%" parses the depth, and nothing else. | |
depth=`mediainfo --Inform="Audio;%BitDepth%" "$f"` | |
if [ "$depth" == "16" ]; then | |
bit16="${bit16}${f}\n" | |
elif [ "$depth" == "24" ]; then | |
bit24="${bit24}${f}\n" | |
else | |
# This really shouldn't happen. If it does, well, check the bit depth of that file, and add another variable and case. | |
echo "unknown bit depth for file $f!" | |
fi | |
done | |
echo -e $bit24 | |
echo -e $bit16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment