Last active
May 12, 2018 05:10
-
-
Save allenhsu/53c9a305f99e66c46c8bbfe3e79ac2c2 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/bash | |
#brew install mediainfo first | |
#chmod a+x check_audio_channels.sh for permission | |
#run ./check_audio_channels.sh dir_name to check | |
function check_dir() { | |
for file in `ls $1` | |
do | |
if [ -d $1"/"$file ] | |
then | |
check_dir $1"/"$file | |
else | |
check_file $1"/"$file | |
fi | |
done | |
} | |
function check_file() { | |
if [[ $1 == *.mp4 ]] | |
then | |
if mediainfo $1 | grep Channel\(s\) | grep -qc '2 channels' | |
then | |
echo "File: "$1" # PASS" | |
else | |
echo "File: "$1" # FAIL, audio format is wrong!" | |
fi | |
fi | |
} | |
check_dir $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment