Code Block swift func fileOutput(_ output: AVCaptureFileOutput, didFinishRecordingTo outputFileURL: URL, from connections: [AVCaptureConnection], error: Error?) {
Thank You!
Code Block swift func fileOutput(_ output: AVCaptureFileOutput, didFinishRecordingTo outputFileURL: URL, from connections: [AVCaptureConnection], error: Error?) {
Use AVCaptureMultiCamSession + 2 VideoDataOutputs + 1 AVAssetWriter. Get buffers from each of the video data outputs and then composite them into a larger buffer (positioning them side by side), and then pass that new buffer to AVAssetWriter to record to a movie. This is very similar to the sample code we published last year called AVMulticamPip (https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/avmulticampip_capturing_from_multiple_cameras). This app composites the second camera as a picture-in-picture in the corner of the screen, and changes the primary camera as you double tap on the screen.
Use two different AVCaptureMovieFileOutputs to write 2 different movie files to disk -- one representing each camera. After recording, read the two movies back frame by frame and composite them together, and re-write using AVAssetWriter.