ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Mariano Grau on July 27, 2012, 12:29:25 PM

Title: How can i read duration tag in a ogg audio file?
Post by: Mariano Grau on July 27, 2012, 12:29:25 PM
Hi Phil!

My favorite command to read all metadata is:
exiftool -X <file>

So i can easily process the xml file to get metadata.
However, in ogg audio files I not found the file duration tag.
In other formats as wav or mp3 i find the tags QuickTime:Duration or Composite:Duration.


Thanks, Mariano Grau
Title: Re: How can i read duration tag in a ogg audio file?
Post by: Phil Harvey on July 27, 2012, 12:39:12 PM
Hi Mariano,

In many a/v file formats Duration is not stored in the metadata.  However, it will attempt to calculate Duration from other extracted information if possible.  If this is possible for your ogg file, then I should add this ability.  Please tell me if you know how to do this.

- Phil
Title: Re: How can i read duration tag in a ogg audio file?
Post by: Mariano Grau on July 27, 2012, 02:11:19 PM
Hi Phil,

I have found that VLC calculates the duration of the ogg file from the metada System:FileSize and Vorbis:NominalBitrate according to the formula:

Duration = System:FileSize / Vorbis:NominalBitrate

previous conversion to bits and bits/s

For mp3 uses Composite:AudioBitrate


Thanks, Mariano Grau
Title: Re: How can i read duration tag in a ogg audio file?
Post by: Phil Harvey on July 27, 2012, 08:15:37 PM
Hi Mariano,

Thanks.  I'll add a new Composite Duration tag in ExifTool 8.98 which does this calculation.

- Phil
Title: Re: How can i read duration tag in a ogg audio file?
Post by: Mariano Grau on August 10, 2012, 04:06:04 PM
Hi Phil,

Thanks you for the speed to incorporate this new feature. I have downloaded the new version.

However, VLC calculates wrong the duration in some ogg files.

It is more correct to use the 'Overall bit rate' metadata than 'Nominal bit rate' for to compute the duration.

Thanks,
Title: Re: How can i read duration tag in a ogg audio file?
Post by: Phil Harvey on August 10, 2012, 05:02:08 PM
Hi Mariano,

There is no Vorbis tag called "OverallBitrate" that is extracted by ExifTool.

I can only work with the metadata that is available.  Use "exiftool -a -s FILE" to see what is available, and let me know if there is something better to use than NominalBitrate.

Thanks.

- Phil
Title: Re: How can i read duration tag in a ogg audio file?
Post by: Mariano Grau on August 10, 2012, 05:51:11 PM
Hi Phil,

I can not find the metadata OverallBitRate or any similar running "exiftool -a -s FILE" .

This information is showed by mediainfo tool (http://mediainfo.sourceforge.net/en). It is not a vorbis tag but is included in general segment.

U:\Temp>mediainfo video.ogg
General
ID                               : 29949 (0x74FD)
Complete name                    : U:\Temp\video.ogg
Format                           : OGG
File size                        : 34.6 MiB
Duration                         : 3mn 23s
Overall bit rate                 : 1 431 Kbps
Writing application              : ffmpeg2theora-0.28
...


Thanks,
Mariano Grau
Title: Re: How can i read duration tag in a ogg audio file?
Post by: Phil Harvey on August 10, 2012, 07:59:10 PM
This information certainly exists in the video stream data, but ExifTool does not parse the video stream.  So unless this is found in the Vorbis information or somewhere in the Ogg container metadata, then I don't have access to it.

- Phil