Feature Request: Improved precision for Duration of MP3 files

Started by WHA1949, November 09, 2012, 03:49:40 AM

Previous topic - Next topic

WHA1949

When reading duration of an mp3 file ExifTool gives something like this:

<Composite:Duration>0:02:20 (approx)</Composite:Duration>

The real duration of this example (according to foobar2000) is:

QuoteDuration : 2:20.513 (6 196 608 samples)

I would like to get real duration from Exiftool, with milliseconds duration.

Reason: I have to synchronize a series of images with mp3 files. At the start of mp3 i want to display a new image. If I have a concatenation of 10 mp3 files, then I will get more and more out of sync. The error will sum up to a total length of 5 seconds (in case you always round down). Even if you round correctly a delay of 500ms between audio and image is very disturbing.


Phil Harvey

I'm pretty sure that ExifTool would need to parse the entire audio stream to determine the exact duration of an MP3.  This isn't really ExifTool's game, which is metadata.  Also, it would slow down ExifTool considerably, and I don't think it would be worth the trade-off for most people.

- 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 ($).

WHA1949

I checked the web for a solution to my problem and encountered this:

$ sudo apt-get install libimage-exiftool-perl

$ exiftool "Stone Sour-Stone Sour-Bother.mp3"

ExifTool Version Number         : 6.93
File Name                       : Stone Sour-Stone Sour-Bother.mp3
Directory                       : .
File Size                       : 6 MB
File Modification Date/Time     : 2006:05:15 19:09:52
File Type                       : MP3
MIME Type                       : audio/mpeg
MPEG Audio Version              : 1
Audio Layer                     : 3
Audio Bitrate                   : 128000
Sample Rate                     : 44100
Channel Mode                    : Joint Stereo
MS Stereo                       : On
Intensity Stereo                : Off
Copyright Flag                  : False
Original Media                  : True
Emphasis                        : None
Album                           : Stone Sour
Artist                          : Stone Sour
Comment                         : *** / Foobar2000: MPC->MP3
Genre                           : Rock
Title                           : Bother
Track                           : 08
Recording Time                  : 2002
User Defined Text               : (sub-genre) Alt Metal
Year                            : 2002
Duration                        : 0:06:03.67 (approx)


See last line. It seems that in previous versions you output such information! I don't mind if you say "approx" but just give me the milliseconds Please. I think that in many cases (CBR) they will be exact.

Phil Harvey

This request is much easier to implement. :)

You will get the calculated Duration in seconds with no rounding by using the -n option or requesting -duration# in the command.

- 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 ($).

WHA1949