|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
Ugh, I figured this out, thanks. As I was writing the mail back to the list, I realized my issue.
So, I’m using the mNumberChannelDescriptions to assign m_dwChannels (the # of source channels), and then m_dwSampleRate, m_dwBitsPerSample are pulled from the asbd on the media sample description. In the case where the source file has four separate tracks, mChannelsPerFrame on the media sample description just comes back with 1 channel, and that was causing problems if I used that value.
This code seems to work correctly for 4 channel audio contained in one track or in four separate tracks:
BailIfOSErr( MovieAudioExtractionGetProperty(m_audioExtractionSession, kQTPropertyClass_MovieAudioExtraction_Audio,
kQTMovieAudioExtractionAudioPropertyID_AudioChannelLayout, size, layout, NULL) );
m_dwChannels = layout->mNumberChannelDescriptions;
asbd.mFormatID = 'lpcm';
asbd.mSampleRate = m_dwSampleRate;
asbd.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked | kAudioFormatFlagsNativeEndian;
asbd.mChannelsPerFrame = m_dwChannels;
asbd.mBitsPerChannel = m_dwBitsPerSample;
asbd.mFramesPerPacket = 1;
asbd.mBytesPerPacket = asbd.mBytesPerFrame = ((asbd.mBitsPerChannel >> 3) * asbd.mChannelsPerFrame);
// Set the new audio extraction ASBD
sizeof (asbd), &asbd) );
On Feb 4, 2008, at 2:05 PM, Kirk Marple wrote:
I’m still having an issue extracting audio from a file which has an audio channel layout with kAudioChannelLayoutTag_DiscreteInOrder, and four channels, and each of the channels is labeled kAudioChannelLabel_Discrete_0/1/2/3
I’m setting kQTMovieAudioExtractionMoviePropertyID_AllChannelsDiscrete to disable any mixing, but what I want to get is a single interleaved buffer with these 4 mono channels.
If I use a source file with the first audio format listed below (four separate audio tracks), I get a badCallOrderErr from MovieAudioExtractionFillBuffer. But if I use the source file shown below that, which is a single track with four channels, I’m able to extract the audio correctly. Both files report the exact same audio channel layout.
The channel layout would be identical for these two cases (channel layouts don't care if the channels are interleaved or not -- channel layouts are just about spatial placement on play back). You're likely not setting the correct kQTMovieAudioExtractionAudioPropertyID_AudioStreamBasicDescription property on the extraction session, but you haven't shared code, so it's hard to say conclusively.
Is this by design? Am I only able to extract audio from a track at a time, or should I be able to get a resulting audio buffer that interleaved the available audio tracks? I thought this should be possible.
Movie Audio Extraction extracts from the movie as a whole. It's designed to do exactly what you want it to do.
_______________________________________________ Do not post admin requests to the list. They will be ignored. QuickTime-API mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
|>UNANSWERED: audio extraction problem: single track works, four separate tracks doesn't (From: "Kirk Marple" <email@hidden>)|
|>Re: UNANSWERED: audio extraction problem: single track works, four separate tracks doesn't (From: Brad Ford <email@hidden>)|
Visit the Apple Store online or at retail locations.
Copyright © 2011 Apple Inc. All rights reserved.