Copyright © 2005-2018 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.

 

The call to this method will generate an AudioExtractFromVideoStart event followed by a number of AudioExtractFromVideoPerc events (that will inform about extraction advancement) and, finally, a AudioExtractFromVideoDone event.

 

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 bOutputSwitchedToFile parameter of the AudioExtractFromVideoDone event

 

 

 

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.