Estimate duration of monkey audio file

Started by kiefermat, March 17, 2016, 09:06:59 AM

Previous topic - Next topic

kiefermat

Hi,

for the attached monkey audio file, exiftool does not calculate an estimated duration. I think it should be possible to calculate an approximate duration from the number of blocks and the sample rate:

total_blocks = (total_frames - 1) * blocks_per_frame + final_frame_blocks
duration = total_blocks / sample_rate


See also the estimating code in mutagen (https://bitbucket.org/lazka/mutagen/src/fc98f3270dee702884d96f8a3835dabd9dea1b8c/mutagen/monkeysaudio.py)

Would be nice, if you could include this in exiftool!

exiftool sample.ape
ExifTool Version Number         : 10.13
File Name                       : sample.ape
Directory                       : .
File Size                       : 331 kB
File Modification Date/Time     : 2016:03:17 13:59:22+01:00
File Access Date/Time           : 2016:03:17 13:59:22+01:00
File Inode Change Date/Time     : 2016:03:17 13:59:22+01:00
File Permissions                : rw-r--r--
File Type                       : APE
File Type Extension             : ape
MIME Type                       : audio/x-monkeys-audio
Compression Level               : 3000
Blocks Per Frame                : 73728
Final Frame Blocks              : 42662
Total Frames                    : 2
Bits Per Sample                 : 16
Channels                        : 2
Sample Rate                     : 44100
Track                           : 4
Year                            : 2005
Title                           : png
Artist                          : Kraftwerk
Genre                           : Electronic
Album                           : Cover Art Test
Tool Version                    : 11.1.102
Tool Name                       : Media Center
Media Jukebox Date              : 38353
Cover Art Front Desc            : E:\test\ma\Hydrogen_Audio.png
Cover Art Front                 : (Binary data 3074 bytes, use -b option to extract)


Best regards,
    Matthias

Phil Harvey

Hi Matthias,

Thanks for the suggestion.  This will appear in the next release.  For the file you sent, I get 2.64 seconds.

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

kiefermat