check duration of audio files on the command-line

mp3info -p "%m:%02s\n" filename

gives you the length of the specified file in mm:ss format (mm can be greater than 59). For just the total number of seconds in the file, you'd use:

mp3info -p "%S\n" filename

To get the total length of all the mp3 files in seconds, AWK can help:

mp3info -p "%S\n" *.mp3 | awk 'BEGIN { s = 0 }; { s = s + $1 }; END { print s }'

soxi -D filename
soxi -D *

Soxi queries metadata of audio files; D is the duration option. It supports globbing. Soxi's big brother sox does command-line audio processing.

Tags:

Unix

Audio

Sox