Is this a rounding problem?
My default check of an audio input file gives 0:03:14
➜ ~/Downloads/Image-ExifTool-9.56/exiftool -X 1-22-dallas.wav| grep Duration
<Composite:Duration>0:03:14</Composite:Duration>
If I compare with Apple Finder or iTunes I get 0:03:15
So I checked again with -n
➜ ~/Downloads/Image-ExifTool-9.56/exiftool -n -X 1-22-dallas.wav| grep Duration
<Composite:Duration>194.907125</Composite:Duration>
The numerical value of 194.907125 is closer to the iTunes value 0:03:15
➜ perl -le 'my $rest3 = 194.907125/60-3; print "0:03:", $rest3*60'
0:03:14.907125
So is exiftool not rounding properly?
Thanks,
Axel.
Hi Axel,
ExifTool is not rounding. By design it is reporting the whole number of seconds (ie. truncating the fraction). If you wish, we can debate the design decision, but I don't see a problem with this.
- Phil
Hi Phil,
understood.
I'd love to see this rounding as a new feature or even a change of the existing time value conversions.
Otherwise I'd need to change all my parsing done for HH:MM:SS values ...
Thanks, Axel.
Hi Axel,
What is your requirement? Do you require agreement with the iTunes values? I would like to understand why the rounding is important to you. Note that ExifTool will report the fractional seconds to 2 decimal places for durations less than 30 seconds (where fractional seconds become more significant).
- Phil
Yes. Agreement with the time value shown in other apps (I just think of iTunes, Apple Finder, Apple QuickLook)
is important to me since the length is prominently shown in my app and otherwise users will wonder and ask me ...
OTOH I should have used "-n" long before.
For AIFF I now just calculate "AIFF:NumSampleFrames" / "AIFF:SampleRate" myself.
For WAV, MP3 etc I rely on Composite:Duration.
Regards, Axel.
Hi Axel,
I think that -n (or -duration#) is what you should be doing. This is the computer-readable value you are meant to use when reading this via other software.
But I will add a Composite Duration tag for AIFF. Thanks for mentioning this.
- Phil