Search code examples
c++caudioexportquicktime

extract every audio-channel in a quicktime file


I want to extract every audio channel in a quicktime movie with the QuickTime-API. That means if the file has 5.1 surround, i want 6 audio files in the end. But at the moment I don't know how to manage that. Until now I have:

OSStatus err = noErr;
MovieAudioExtractionRef extractionSessionRef = nil;
Boolean allChannelsDiscrete = true;
int flags;
int numFrames;
AudioBufferList *mBufferList;
err = MovieAudioExtractionBegin(movie, 0, &extractionSessionRef); 


// disable mixing of audio channels
err = MovieAudioExtractionSetProperty(extractionSessionRef,
  kQTPropertyClass_MovieAudioExtraction_Movie,
  kQTMovieAudioExtractionMoviePropertyID_AllChannelsDiscrete,
  sizeof (Boolean), &allChannelsDiscrete);

err = MovieAudioExtractionFillBuffer(extractionSessionRef, &numFrames, 
  mBufferList, &flags);
if (flags & kQTMovieAudioExtractionComplete)
{
    // extraction complete!
}
err = MovieAudioExtractionEnd(extractionSessionRef);

The problem is that I don't know how to get mBufferList and how to export every channel as WAV 48kHz. Can you help me? The example is from this page.


Solution

  • Have you checked with this?