avfoundation

AVCaptureStillImageOutput never calls completition handler

最后都变了- 提交于 2019-12-02 07:21:26
问题 Following code doesn't work. Whats wrong? AVCaptureDevice * videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; AVCaptureDeviceInput * videoInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:nil]; AVCaptureSession * captureSession = [[AVCaptureSession alloc] init]; captureSession.sessionPreset = AVCaptureSessionPresetMedium; if (![captureSession canAddInput:videoInput]) NSLog(@"Can't add input"); [captureSession addInput:videoInput]; self

Deep Copy of CMImageBuffer or CVImageBuffer

血红的双手。 提交于 2019-12-02 07:11:46
问题 Hi I am currently working on an app which needs to capture a Video and at the same time should be able to take frames to blend them. The problem I am having is that my frames coming from: func captureOutput( captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection: AVCaptureConnection! ) will drop after blending about 10-12 frames. I tried blending every 10th frame but it will still drop after 10-12 blended frames. I know that I should

Video Editing issues in iOS

廉价感情. 提交于 2019-12-02 06:24:45
问题 I am currently working on an iOS app which merges desired number of videos. Once the user taps the button to merge the videos, the videos are joined and then played using AVPlayer as: CMTime nextClipStartTime = kCMTimeZero; NSInteger i; CMTime transitionDuration = CMTimeMake(1, 1); // Default transition duration is one second. // Add two video tracks and two audio tracks. AVMutableCompositionTrack *compositionVideoTracks[2]; AVMutableCompositionTrack *compositionAudioTracks[2];

Error Domain=AVFoundationErrorDomain Code=-11800 “The operation could not be completed” {Error Domain=NSOSStatusErrorDomain Code=-16976 “(null)”}

梦想的初衷 提交于 2019-12-02 05:45:25
I am working on Video application in Swift3 iOS. Basically I have to merged the Video Assets and Audios into one with Fade Effect and save this to iPhone gallery. To achieve this, I am using below method: private func doMerge(arrayVideos:[AVAsset], arrayAudios:[AVAsset], animation:Bool, completion:@escaping Completion) -> Void { var insertTime = kCMTimeZero var audioInsertTime = kCMTimeZero var arrayLayerInstructions:[AVMutableVideoCompositionLayerInstruction] = [] var outputSize = CGSize.init(width: 0, height: 0) // Determine video output size for videoAsset in arrayVideos { let videoTrack =

Can't use AVCaptureDevice with a flash

二次信任 提交于 2019-12-02 05:43:52
问题 I am having difficult times, for something which I think ought to be simple. I just want to light the flash when taking a picture in my iOS app. And all I tried failed or works only 20 percent. Here is the code fired to light the flash up: // Here we have: captureDevice.hasFlash && captureDevice.isFlashModeSupported(.On) do {try captureDevice.lockForConfiguration() captureDevice.flashMode = .On captureDevice.unlockForConfiguration() } catch let error as NSError { print("captureDevice

Using AVCaptureDevice as SCNScene background content

試著忘記壹切 提交于 2019-12-02 05:07:50
问题 During the SceneKit: What's New presentation at WWCD2017 (44:19) it was stated that we can now use AVCaptureDevice as background content for SCNScene . Snippet from the presentation: let captureDevice: AVCaptureDevice = ... scene.background.contents = captureDevice However the following code let captureDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back)! scene.background.contents = captureDevice produces an error: [SceneKit] Error: Cannot get pixel buffer

Using AVMutableComposition iPhone

限于喜欢 提交于 2019-12-02 04:59:14
问题 I am using the below code, for streaming the two videos sequentially. But it is not showing any video in the simulator, its totally blank. Also how can I seek through these two videos. Like, if one video is of 2 minutes and the second is 3 minutes. Now I need to get the total time of these videos and seek through them. When I slide the slider bar to 4 minutes so the 2nd video should be played from minute 2 to onward. Is it possible? - (void)viewDidLoad { [super viewDidLoad]; // Do any

How do I record a maker note or user comment in EXIF?

你离开我真会死。 提交于 2019-12-02 04:51:55
I'm building a camera app, and want to record in the EXIF the settings that the user selected. Most settings have standard fields, but one doesn't, so I thought I'll record it in the maker notes field. I tried let attachments = NSMutableDictionary(dictionary: CMCopyDictionaryOfAttachments(nil, buffer, kCMAttachmentMode_ShouldPropagate) as! NSDictionary) let exif = NSMutableDictionary(dictionary: attachments[kCGImagePropertyExifDictionary] as! NSDictionary) exif[kCGImagePropertyExifMakerNote] = "Blah blah" attachments[kCGImagePropertyExifDictionary] = exif But when I try exiftool photo.JPG |

AVCaptureStillImageOutput never calls completition handler

最后都变了- 提交于 2019-12-02 04:47:26
Following code doesn't work. Whats wrong? AVCaptureDevice * videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; AVCaptureDeviceInput * videoInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:nil]; AVCaptureSession * captureSession = [[AVCaptureSession alloc] init]; captureSession.sessionPreset = AVCaptureSessionPresetMedium; if (![captureSession canAddInput:videoInput]) NSLog(@"Can't add input"); [captureSession addInput:videoInput]; self.stillImageOutput = [[AVCaptureStillImageOutput alloc] init]; [self.stillImageOutput setOutputSettings:@

Choosing the right AVCaptureSessionPreset for different devices

泄露秘密 提交于 2019-12-02 04:45:27
I am a little confused which preset I should use for different devices. Currently I am using AVCaptureSessionPresetMedium for all devices. However, I want to take advantage of different resolutions for different phones. For example the new iPhone 6s can take 4K video, and in this case I would use AVCaptureSessionPreset3840x2160 . What I am asking is an elegant way to choose the right preset for different devices. Thanks you can use like below. [CaptureSession setSessionPreset:AVCaptureSessionPresetMedium]; if ([CaptureSession canSetSessionPreset:AVCaptureSessionPreset640x480]) //Check size