Extract each audio channel in a QuickTime file

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 .

+3
source share
2 answers

Have you checked with this ?

+2
source

Not sure if this helps - there is a way to do this without using the Quicktime-SDK:

"moov" Quicktime, // /endian .., "stsc" "stco" samples_per_chunk . "mdat" .

, .

0

Source: https://habr.com/ru/post/1753263/


All Articles