You could use something like avconv
/ffmpeg
which you should be able to then grep
down. I recommend it because it's fairly robust and should look beyond broken headers:
$ avconv -i ~/Music/Aqua/Aquarium/*03*
avconv version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
built on Mar 30 2013 22:20:06 with gcc 4.7.2
[mp3 @ 0x733ce0] Header missing
[mp3 @ 0x732960] max_analyze_duration reached
[mp3 @ 0x732960] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '/home/oli/Music/Aqua/Aquarium/Aqua - 03 - Barbie Girl.mp3':
Metadata:
title : Barbie Girl
track : 03/11
artist : Aqua
album : Aquarium
genre : European Pop
TLEN : 198008
album_artist : Aqua
TBPM : 130
date : 1999
Duration: 00:03:50.32, start: 0.000000, bitrate: 128 kb/s
Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
At least one output file must be specified
Then just apply awk
liberally:
$ avconv -i ~/Music/Aqua/Aquarium/*03* 2>&1 | awk '/Duration/ {print $2}' | tr -d ,
00:03:50.32