Copyright © 2005-2019 MultiMedia Soft

VideoPlayer.AudioTrackExtract method

Previous pageReturn to chapter overviewNext page

Remarks

 

Starts the extraction of the audio track stored inside the media file into a destination memory buffer or into a temporary file. The format of the extracted sound is WAV PCM having the same frequency and number of channels of the original audio stream.

Once extracted, the audio track can be used to perform waveform analysis, BPM (Beats per minute) detection and sound silence detection.

 

If the size of the extracted track is less than 2 GBytes, the track is stored in uncompressed WAV PCM format; for sizes higher than 2 GBytes the W64 format is automatically used.

 

During the audio extracting session, the container application will be notified about the exporting advancement through the CallbackForPlayersEvents delegate which is invoked with the nEvent parameter set to:

 

EV_AUDIO_EXTRACT_START invoked once at the beginning
EV_AUDIO_EXTRACT_PERC invoked multiple times reporting the current advancement percentage inside the nData1 parameter
EV_AUDIO_EXTRACT_DONE invoked once at the end

 

Audio extraction can be aborted at any time through the VideoPlayer.AudioTrackExtractAbort method.

 

Once the extracted track is no more needed, you can free the memory buffer or delete the temporary file by using the VideoPlayer.AudioTrackFree method.

 

For further details about the use of the embedded video player see the VideoPlayer class section.

For details about video clips rendering refer to the How to play video files through DirectShow tutorial.

 

 

Syntax

 

[Visual Basic]

Public Function AudioTrackExtract (

nPlayerIndex as Int16,

bStoreInMemory as Boolean

) as enumErrorCodes


 

[C#]

public enumErrorCodes AudioTrackExtract (

Int16 nPlayerIndex,

bool bStoreInMemory

);


 

[C++]

public: enumErrorCodes AudioTrackExtract (

Int16 nPlayerIndex,

bool bStoreInMemory

);


 

Parameter

Description

 

 

nPlayerIndex

Number representing the zero-based index of the player that will use the video player.

bStoreInMemory

Boolean value that specifies if the audio track needs to be stored in memory or inside a temporary file.

Supported values are the following:

Mnemonic constant

Meaning

false

Store extracted audio stream inside a temporary file; once completed, the absolute pathname of the temporary file and its size in bytes can be accessed through the VideoPlayer.AudioTrackGetTempFilePathname and VideoPlayer.AudioTrackGetTempFileSize methods.

true

Store extracted audio stream inside a memory buffer; once completed, this buffer and its size in bytes can be accessed through the VideoPlayer.AudioTrackGetMemoryPtr and VideoPlayer.AudioTrackGetMemorySize methods.

In case there should be not enough memory room to store the audio stream, the control would automatically switch its output to a temporary file and this would be notified through the nData1 parameter of the CallbackForPlayersEvents delegate invoked with the nEvent parameter set to:EV_AUDIO_EXTRACT_DONE.

 

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred (see the LastError property for further error details)

enumErrorCodes.NOERROR (0)

The method call was successful.