[LAU] robust command line tool to determine duration of sound file using more than the header

Dan Hitt dan.hitt at gmail.com
Thu Aug 18 02:19:08 UTC 2016


I'm looking for a command line tool that can determine the length
(duration in seconds) of a sound file using more than just the file
header.

The situation is that some of the files have incorrect headers.

The data is intact, and they play correctly, but if you attempt to
determine the length based solely on the header, it will be incorrect.

I've tried soxi, mediainfo, and ffprobe (on xubuntu 16.04), and all
seem to rely exclusively on the header.

soxi is good enough that it warns if there's a discrepancy between
what the header says and what is present in the file, in a message to
stderr, but the value to stdout (from soxi -D) is the incorrect header
value.

I suppose i could write code to parse soxi's error message, but would
much prefer to have some option to pass to the program that says "use
file length instead of header info in the event of a conflict".

TIA for any suggestions!

dan


More information about the Linux-audio-user mailing list