How to know audio file lenght?
Does anyone know how to know audio file lenght in shell command line without opening it in audioplayer?
I need it for a shell script. Files are in this formats: wav, wav49, mp3, ogg, gsm. Please help me. Thank you. :study: :study: :study: |
you can calculate the file length from the file size if it`s not a strongly compressed format like mp3.
A WAV File has a bitwidth (mostly 16 bit) and a sample rate (mostly 44 kHz). This two values determine the filesize (plus some header data which you`ll have to find out by comparing the result of the calculation with the actual file sizes) in this way: length of the sound (in s) = Size of the file (in MByte) / 44100 / 16 * 8 * 1024 * 1024 (if a Byte has 8 Bit (is so in 99.9999999% of the cases :-) )) I`ve never tried this out, it`s just theory, so please counter check before using productivly. |
All times are GMT -5. The time now is 01:46 PM. |