1

Currently I am using both an AVCaptureMovieFileOutput and an AVCaptureVideoDataOutput in my AVCaptureSession. I am trying to use the functionality of both delegate methods at once. The problem is that when I add both types of outputs to the AVCaptureSession, only one delegate method is called.

The reason I am doing this is so I can record a video (with the capture delegate method of the AVCaptureMovieFileOutput) and process the frames of the video (with the captureOutput delegate method of the AVCaptureVideoDataOutput) at the same time.

Is there a way I can incorporate both the captureOutput and capture delegate methods in my AVCaptureSession?

And if this is not possible, is there a way to get around this?

Any help would be appreciated.

NFarrell
  • 255
  • 1
  • 17
  • did you manage to get this working? – Ankit Sachan Mar 20 '22 at 09:32
  • 1
    Hi Ankit. This was a while ago but I believe I got rid of the AVCaptureMovieFileOutput and used AVAsetWriter to write the frames to a video within the `captureOutput` delegate method – NFarrell Mar 21 '22 at 22:59

2 Answers2

0

You need to use AVCaptureVideoDataOutput, it has a delegate method captureOutput:didOutputSampleBuffer:fromConnection:. Here you can find an example of usage. And this link can be useful

Tiko
  • 485
  • 4
  • 10
  • Hello Tiko. Thanks for the response. My problem right now is I have an AVCaptureVideoDataOuput and an AVCaptureMovieFileOutput working together. Both of which have delegate methods. But if you add them both as the output of the AVCaptureSession, they don't work together and you can't use both the captureOutput and capture delegate methods together. My question is that is there a way I can use the functionality of both delegate methods in one? – NFarrell Jun 19 '17 at 14:18
  • https://stackoverflow.com/questions/3968879/simultaneous-avcapturevideodataoutput-and-avcapturemoviefileoutput See this answer. It seems you cannot use both delegates together, you can try to export video with AVAssetWriter – Tiko Jun 19 '17 at 20:17
0

Here is a working example with AVAssetWriter, we cannot use AVDataOutput and AVFileOutput together in iOS

https://github.com/ankits16/CVRecorderFinal/blob/main/README.md

Ankit Sachan
  • 7,690
  • 16
  • 63
  • 98