Reputation: 2655
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.
Upvotes: 3
Views: 1917
Reputation: 101
Not sure if this helps - there's a method of doing this without using Quicktime-SDK:
You need to parse Quicktime "moov" atom to get the audio track types/bps/sample rate/endian etc., find then "stsc" and "stco" atoms to samples_per_chunk and each chunk offset. Then you just read "mdat" atom raw data using these offsets and write the samples to destination files.
This is not the easy way - but it works for me.
Upvotes: 0