Use Case: I want to capture input from the camera, draw on top of the captured frames (and sound) and save the result as a .mov file.
- I see that I can capture input for the camera using AVCaptureSession.
- I can save this to a .mov file using AVCaptureMovieFileOutput.
- AVVideoComposition can be used to add Core Animation for playback. I assume for recording somehow too?
Problem: I can't see how to modify the input before it is saved to file.
AVCaptureMovieFileOutput
does not let you process captured frames. To do that, replace it withAVCaptureVideoDataOutput
and encode the input to a .mov file using anAVAssetWriter
.As for the
AVVideoComposition
, I think you may have to apply it in a separate pass with anAVAssetExportSession
.The RosyWriter was almost doing what I wanted. Adding the following code to captureOutput:didOutputSampleBuffer:fromConnection: enabled me to draw onto the frame using Quartz.