Created
November 7, 2016 19:45
-
-
Save ldante86/2416471986d52205c288314d3ec29a36 to your computer and use it in GitHub Desktop.
Get running length of media files
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
#!/bin/bash - | |
which mediainfo >/dev/null || { | |
echo mediainfo is not installed | |
exit 1 | |
} | |
[ $# -eq 0 ] && set -- * | |
for i | |
do | |
case "$i" in | |
*.[Mm]*|*.[Aa][Vv][Ii]|*.ogg|*.[Ff][Ll]*|*.ape|*.[Ww][Aa][Vv]) | |
if [ -f "$1" ]; then | |
echo -n "$1 -------- " | |
/usr/bin/mediainfo "$1" | | |
grep Duration | | |
awk -F: '{ print $2 }' | | |
head -n 1 | | |
sed 's/^ *//' | |
fi ;; | |
esac | |
shift | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment