Issue
I need to check the duration of a group of audio files. Is there a simple way to do this on the unix command-line?
> duration *
I have the amazing SoX app which has an option called stats that generates a set of audio info including duration. I am looking for a way to get only duration. I am flexible on output format, could be any of sample length, hh:mm:ss, or seconds. The latter would be my preference.
Solution
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 }'
Answered By - 0xbadc0de Answer Checked By - Gilberto Lyons (WPSolving Admin)