News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

How can i read duration tag in a ogg audio file?

Started by Mariano Grau, July 27, 2012, 12:29:25 PM

Previous topic - Next topic

Mariano Grau

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

Phil Harvey

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

Mariano Grau

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

Phil Harvey

Hi Mariano,

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

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

Mariano Grau

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,

Phil Harvey

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

Mariano Grau

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

Phil Harvey

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