Question

Enviroment

  • iphone
  • arm7/sdk6.0
  • xcode 4.5

Use-case

  1. Based on the AVCam sample
  2. Capture A/V into a file using AVCaptureMovieFileOutput
  3. Add an additional AVCaptureAudioDataOutput to intercept the audio being written to the file while recording

How-to

  1. Add Video input to the Capture session
  2. Add Audio input to the Capture session
  3. Add File Output to the Capture session
  4. Add Audio Output to the Capture session
  5. Configure
  6. Start recording

The problem

It seems the audio output is mutual exclusive, thus, either I get data being written to the disk, OR, I get AVCaptureAudioDataOutput capture delegate being called, when AVCaptureMovieFileOutput is added ( order doesn't matter ), AVCaptureAudioDataOutput delegate is not called.

  • How can this be solved? how can I get 'AVCaptureAudioDataOutput' triggering it's delegate/selector while, at the same time 'AVCaptureMovieFileOutput' is used to write data to the disk?
  • Can this be done in any way other way than using a lower level API such as eg. AVAssetWriter et al ?

Any help will be appreciated!

Was it helpful?

Solution

AVAssetWriter is to be used in conjunction with AVAssetWriterInputPixelBufferAdaptor, a good example of how this can be achieved can be found here.
Then, upon 'AVCaptureAudioDataOutputSampleBufferDelegate' invocation, the raw audio buffer can be propagated out for further processing ( in parallel to having the data written to the disk ).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top