Wav file duration calculation

Started by jovibroz, March 27, 2025, 11:11:14 AM

Previous topic - Next topic

jovibroz

I've been scratching my head to why exiftool reports a different wav file duration than the actual length. I work in Pro Tools on Mac and deliver stereo wav files (mostly 48/16) to a server that uses exiftool to calculate the wav file duration and length calculated by exiftool is longer than the actual file.

Created a ticket with AVID and they now told me that this problem needs to be fixed by exiftool and wrote me this:

Hi,

Our Engineering team has reviewed the issue and came to the conclusion that it needs to be fixed by Exiftool. They should use the size of the "data" chunk to calculate the duration of the file properly.
I will now close this case. If you have any further questions on this matter, please reply to this email to re-open the case.

Kind regards,
Avid Customer Care | Audio

StarGeek

It might be this, though that was for MP3 files. Depends upon what encoding was used for the wav file

Bug: Approximate duration doubled on mp3 files
QuoteExifTool doesn't analyze the whole stream, and just calculates an approximate duration from the header information

ffmpeg is probably a better choice if you need the exact duration.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

Can you send me a sample WAV file that reports an incorrect duration?  My email is philharvey66 at gmail.com

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jovibroz

Sent with wetransfer!

WAV file 16/48 reported length by macOS 01:30:00 (90mins)
while exiftool duration says 90:43 mins.


Phil Harvey

I got the file, thanks.

I will add a patch to ExifTool 13.26 to improve the Duration calculation for this type of file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jovibroz

Wonderful! I will tell the server admin to update when it's released. Do you mind sharing some insight to what's special with the Pro Tools files? I've encountered problems like white noise with files rendered with Pro Tools and people have said things like:

"Pro Tools seems to add a chunk at the end of the wav file, it has a strange label and an impossible size indicated."

"Since our prior contact we've further confirmed - this is a bug in Pro Tools that's breaking our audio files by modifying them, when their app is parsing the WAV file's metadata.

We've worked with Avid to confirm the problem, which they've designated as bug PT-271506. If you can recover the original files from a backup that'll be a good first step."


Thanks again!


Phil Harvey

This Pro Tools sample file contained a very large (8.2 MB) 'DGDA' chunk containing strings like "AnalysisSets" and "PacketStream".  It looks like proprietary Pro Tools information and not any sort of bug.  This accounts for most of the extra duration as calculated by ExifTool 13.25.  There are a few other smaller Pro Tools chunks as well.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).