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 a
A solution based on mplayer from commandlinefu by syssyphus that works with both audio and video files:
sudo apt-get install mplayer
find -type f -name "*.mp3" -print0 | xargs -0 mplayer -vo dummy -ao dummy -identify 2>/dev/null | perl -nle '/ID_LENGTH=([0-9\.]+)/ && ($t +=$1) && printf "%02d:%02d:%02d\n",$t/3600,$t/60%60,$t%60' | tail -n 1
Get the total length of all video / audio in the current dir (and below) in H:m:s
Change the
*.mp3
to whatever you want to match (e.g.,*.avi
,*.wav
), you can remove it altogether if you want to check all files.
Example of output: 00:00:37