I'm looking for a little advice: I have an app that captures video
and (sometimes) also audio to QuickTime files. Most of the app has
undergone a recent redesign and I'm quite happy with it.
No so the audio capturing: it's based on the old Sequence Grabber
SoundMediaType channel... I know it's long deprecated and I even
wonder it still works.
Note that I'm writing the QuickTime file myself - so I just need the
audio as PCM buffers so they can be directly written to the MOV file
- no fancy mp4 needed.
Audio is coming from the line in port, video from a FireWire camera
- so these are not synced in any way. All I require is that the
audio buffers are tagged with some timecode, and well, that no
packets are lost.
It looks like there are many choices to accomplish this:
1 use CoreAudio
The most configurable choice -- also the most code to write,
probably. This choice will not help you with the video side at all,
so you'll have to handle all sync yourself.
2 use MTCoreAudio (a CoreAudio Cocoa wrapper)
Definitely do not recommend. This library uses locks on the real-time
CoreAudio thread. A definite no-no, and an unexpected glitch waiting
to happen.
3 use old Sequence Grabber with SGAudioMediaType
This would probably require the least number of changes to your
existing code, and you'd get "high-res" audio support (high sample
rates, multichannel, modern codecs such as AAC if desired). Staying
within the Sequence Grabber family will get you reasonably good sync
if you let SG write the movie. If you write the movie yourself,
you're probably going to have to deal with a/v sync problems
yourself. Note that going to SGAudioMediaType gives you the benefit
of getting the real timestamps from the CoreAudio HAL device, if you
use one of the SGAudioCallbacks to gather your audio rather than the
SGDataProc. See kQTSGAudioPropertyID_PostConversionCallback and
friends in QuickTimeComponents.h. An example of SGAudioCallback usage
is found in WhackedTV, where they are used to insert audio effects
into the record chain.
4 QTKitCapture
Probably the most forward-looking choice. We have done _a lot_ of
work in the QTKit Capture engine to get very good sync. We have
sophisticated start-up sync correction, and we correct for drift sync
using a lot better timing information than can be propagated in
Sequence Grabber. Note that the audio portion of the QTKit Capture
API is not currently as configurable as, say, SGAudio. But it may
suit all of your needs, and we'd appreciate enhancement requests for
anything that's important to you and currently missing.
Which one would you recommend me?
I'd recommend QTKit Capture.
Besides, I'd also like to display an "audio meter" on the GUI, can
any of these API's easily do this.
QTKit Capture and SGAudio can both do this. CoreAudio obviously can
do it if you have the right units in your chain, but they're a lot
harder to configure.
-Brad Ford
QuickTime Engineering
_______________________________________________
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