I'm facing a hard problem, I'm developing an app to capture video from both front and rear camera simultaneously on IPhone 4 without jail-break and save it to one video with AVI format. I'm facing 2 problems: 1. Capture videos simultaneously from both camera (front and rear). 2. Save captured videos to only 1 file with AVI format.
I have worked arround with multimedia lib in IPhone SDK and know that UIImagePicker class support me capture video on IPhone, but it only support one camera device by setting cameraDevice property of UIImagePicker . Seem UIImagePicker can't help me more....
I want to display 2 captured videos from both camera in screen, one is background video (full screen) and one foreground video, like PIP effect (picture in picture video effect on Television program), then I wanna save them (captured videos) to only 1 video file with video format, properly AVI format.
For those purpose, I did search around on google, and know that FFMPEG seem support merge 2 video with PIP effect but I don't see any tutorial about it. I don't have any exp on FFMPEG befor开发者_StackOverflow社区e....
The problem (1) & (2) are still there. I don't know how to capture videos simultaneously on IPhone, then merge and save them in only 1 video file like PIP effect.
Anyone have idea about my those problems ? please help me !
I'm fairly sure that this is not possible in the publicly available API's.
You are correct in your assertion that the UIImagePicker
only allows for a single camera to be specified.
Facetime, which can do the PiP your looking for, is a low level part of the iPhone and, being crafted by Apple, probably has a massive amount of optimisations and low level code to make this happen.
EDIT: After the comment from Nestor, I had a more detailed lookinto how Factuime works (not having an iPhone myself). Nestor is correct, it doesn't show streams from both cameras, rather the other phones video and then a PIP of your camera.
After WWDC19 we have option for this.
AVCaptureMultiCamSession
:
A capture session that supports simultaneous capture from multiple inputs of the same media type.
Apple Demo Project:
AVMultiCamPiP
Capturing from Multiple Cameras Simultaneously record the output from the front and back cameras into a single movie file by using a multi-camera capture session.
Configure the Sample Code Project You must run this sample code on one of these devices:
- An iPhone with an A12 or later processor
- An iPad Pro with an A12X or later processor
精彩评论