Getting Audio and Video Stream Metadata

This tutorial describes how to get audio and video stream metadata.

Purpose

The purpose of this tutorial is to show you how to get metadata from audio and video streams. This tutorial looks at two of the 3GP Parser metadata functions: GetVideoProperties() and GetAudioProperties().

Required background

The 3GP Library Overview introduces the 3GP Parser.

Introduction

You can use the 3GP Parser to get the following metadata:

  • Video properties (video type, length of video, frame rate, bit rate, width/height of image, and timescale)

  • Audio properties (audio type, length of audio, frames per sample, average bit rate, and timescale)

  • Stream properties (stream size, stream average bit rate)

  • Video decoder specific information

  • Audio decoder specific information

  • User data atom

  • QCELP (Qualcomm CELP Codec) storage mode

  • Video clip properties.

Using GetVideoProperties() and GetAudioProperties()

The following tasks are covered in this tutorial:

Getting video stream properties

To return the properties that describe a video stream:

  • Call C3GPParse::GetVideoProperties(T3GPVideoType&, TUint&, TReal&, TUint&, TSize&, TUint&):

    TInt GetVideoProperties(T3GPVideoType& aType, TUint& aLength, TReal& aFrameRate, TUint& aAvgBitRate, TSize& aSize, TUint& aTimeScale) const;

    This function returns video type, length of video, frame rate, bit rate, width/height of image, and timescale.

    Notes:

    • In buffer mode, make sure there is enough data supplied to the 3GP Parser before you call C3GPParse::GetVideoProperties(). For more information, see Supplying Data to a 3GP Parser.

    • Getting metadata does not change the position of the video data cursor. For optimisation purposes, metadata values are cached in the 3GP Parser until C3GPParse::Complete() is called.

Getting audio stream properties

To return the properties that describe an audio stream:

  • Call C3GPParse::GetAudioProperties(T3GPAudioType&, TUint&, TInt&, TUint&, TUint&):

    TInt GetAudioProperties(T3GPAudioType& aType, TUint& aLength, TInt& aFramesPerSample, TUint& aAvgBitRate, TUint& aTimeScale) const;

    This function returns audio type, length of audio, frames per sample, average bit rate, and timescale.

    Notes:

    • In buffer mode, make sure there is enough data supplied to the 3GP Parser before you call C3GPParse::GetAudioProperties(). For more information, see Supplying Data to a 3GP Parser.

    • Getting metadata does not change the position of the audio data cursor. For optimisation purposes, metadata values are cached in the 3GP Parser until C3GPParse::Complete() is called.

Example

The following example shows you how to get audio and video property metadata:

CMyApp::ReadFileL(const RFile& aFile)
{
...
// see example setup code in Setting up a 3GP Parser. 
...
// retrieve video properties of the content
User::LeaveIfError(parser->GetVideoProperties(...));

// retrieve audio properties of the content
User::LeaveIfError(parser->GetAudioProperties(...));
...
}