I want to extract each audio channel in QuickTime video with QuickTime-API. This means that if the file has 5.1 surround, I want 6 audio files at the end. But at the moment I do not know how to do this. So far, I:
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 do not know how to get mBufferListand how to export each channel as a 48 kHz WAV. Could you help me? Example: this page .
source
share