Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using the audio extraction API



To answer my own question,
When setting the sample rate, I must also set "mChannelsPerFrame" to 1, then it works.
No idea if that is the correct thing to do.


I also have found another quirk.
It seems if I ask for a small enough chunk of samples, MovieAudioExtractionFillBuffer returns with no error, but the data is all 0. I have to trace this down more since it could be me doing something odd, so unless there is another undocumented limitation, don't look into this too closely till I can be sure its not me :)



On 22-May-06, at 3:29 PM, Steve Israelson wrote:

- I want to extract and convert the audio from a single track. How do I specify this? I can see how to specify left or right etc, but that mixes all left and rights together, but I want say the left of a single track only.

There are two ways.

1) iterate through the tracks in the source movie, get the track layout, and set the channel labels you want to exclude to kAudioChannelLabel_Unused. Note that if you leave, say, multiple "Left's" labelled as "Left", they will still all mix into a single "Left", unless you specify:

2) kQTMovieAudioExtractionMoviePropertyID_AllChannelsDiscrete on the MovieAudioExtractionSession. This causes QuickTime to do _no_ mixing. You get all the source channels in all the audio tracks in the movie (in order) if you set this property.

So, if the track in question is stereo, and all others are set to "unused", then I just pick out the left or right track as needed.

Just pick out the left or right _channel_ as needed. I think that's what you meant though.


Is there any other track layouts, like say 5.1 where I have more options than just left and right PER TRACK?

I'm not sure I understand the question. QuickTime audio tracks now allow any number of channels of audio, and those channels can be labelled using any of the AudioChannelLabels supported by CoreAudio (see CoreAudioTypes.h). You need to be prepared for strange things -- for instance, you could have an audio track with 10 channels of audio, each one labelled "Right". QTPro Users can relabel audio channels at will in the Movie Jinfo window.


Ok, so here is what I am doing:
MovieAudioExtractionBegin(...)
MovieAudioExtractionGetProperty (kQTMovieAudioExtractionAudioPropertyID_AudioStreamBasicDescription)
// here I set the sample rate to what I want: 44,100
MovieAudioExtractionSetProperty(...) // for above sample rate change
// choose left channel
AudioChannelLayout layout;
layout.mChannelLayoutTag = kAudioChannelLayoutTag_UseChannelBitmap;
layout.mChannelBitmap = kAudioChannelBit_Right;
MovieAudioExtractionSetProperty(...)


// finally, extract some data:
MovieAudioExtractionFillBuffer()

And it then returns an improper call order error. Huh?
Should I set it to left, then set the sample rate?

Essentially all I want is ONE specific channel of audio at a sample rate I specify. I am using "left" for testing, but the user can choose any channel.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/sisraelson% 40mac.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. QuickTime-API mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quicktime-api/email@hidden

This email sent to email@hidden
References: 
 >Using the audio extraction API (From: Steve Israelson <email@hidden>)
 >Re: Using the audio extraction API (From: Brad Ford <email@hidden>)
 >Re: Using the audio extraction API (From: Steve Israelson <email@hidden>)
 >Re: Using the audio extraction API (From: Brad Ford <email@hidden>)
 >Re: Using the audio extraction API (From: Steve Israelson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.