The following works very nicely to determine the length of various audio/video files:
mplayer -identify file.ogg 2>/dev/null | grep ID_LENGTH
FFMPEG can give you the same information in a different format (and doesn't attempt playing the file):
ffmpeg -i