Questions tagged [avcapture]

iOS video capture API for both Swift and Objective-C

Some common high-level objects used with this API:

  • AVCaptureDevice
  • AVCaptureSession
  • AVCaptureVideoPreviewLayer

related tags:

223 questions
3
votes
2 answers

Custom camera iOS

I got an app, where i tried to implement custom camera. This is source code: AVCaptureVideoPreviewLayer *captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; captureVideoPreviewLayer.frame =…
Eugene Trapeznikov
  • 3,220
  • 6
  • 47
  • 74
3
votes
2 answers

AVCaptureMovieFileOutput -- trimming the file while writing

I am recording video using AVCaptureMovieFileOutput. Instead of retaining the captured video for the entire recording time, however, I would like only to retain the last 2 minutes of video. In essence, I would like to create a trailing buffer of…
James
  • 2,272
  • 1
  • 21
  • 31
3
votes
1 answer

How to compare AVCaptureDevice.DeviceType to understand which one is the best option?

AVCaptureDevice.DeviceType has a set of camera options and allows us to list available devices and pick one of them. For example, the code block below lists available devices on my iPhone. let discoverySession =…
amone
  • 3,712
  • 10
  • 36
  • 53
3
votes
1 answer

Apple's AVCamera Night Mode

I've been building a camera app using the AVFoundation and wanted to add NightMode support to it. Apple features a stunning implementation for this, more about it can be read here: https://www.macrumors.com/guide/night-mode/ Now, the only…
MartinJK
  • 78
  • 1
  • 6
3
votes
1 answer

Correctly Record Video Using AVCaptureVideoDataOutput

Background: I am using AVCaptureVideoDataOutput in alignment with AVCaptureSession and other various AV tools to create a video session such that I can create a camera session. I have a live feed of what the camera sees it is on the screen. I use…
3
votes
1 answer

AVCaptureVideoPreviewLayer is not visible on the screenshot

I have an application that adds some live animations and images to preview view in AV Foundation camera. I can do "hardware screenshot" (holding the Side button and Volume Up button) and it's ok. However, I need a button that makes a screenshot.…
rng13
  • 111
  • 1
  • 6
3
votes
1 answer

QRCode Scanner Not Working in iOS 11, only showing camera preview

It only shows output of camera, but nothing is happning. I don't know what's the problem. My code is: class QRScannerController: UIViewController, AVCaptureMetadataOutputObjectsDelegate { var captureSession:AVCaptureSession? var…
Uday Babariya
  • 1,031
  • 1
  • 13
  • 31
3
votes
0 answers

Any way to convert UIImage to CMSampleBuffer on Swift?

I'm using ABBYY OCR SDK and it's great at text recognition direct from camera from CMSampleBuffer in: func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, from connection: AVCaptureConnection!)…
Dmitrii Z
  • 145
  • 1
  • 5
3
votes
2 answers

AVCaptureSession resolution doesn't change with AVCaptureSessionPreset

I want to change the resolution of pictures I take with the camera on OS X with AV Foundation. But even if I change the resolution of my AVCaptureSession, the output picture size doesn't change. I always have a 1280x720 picture. I want a lower…
3
votes
0 answers

Swift - Asking for microphone permission

Within my swift app, this is the code I have to request for microphone and camera permissions. class func requestCameraPermission(completionBlock:(Bool throws -> Void)) rethrows { if…
Katie H
  • 2,283
  • 5
  • 30
  • 51
3
votes
1 answer

How to record the exact time of the first and last movie frame captured with AVCaptureSession?

I'm using AVCaptureSession to capture a video into a movie file. I want to get the exact timestamp of the first and last frame of the movie. How do I do this? In AVCaptureFileOutputRecordingDelegate, the method…
algal
  • 27,584
  • 13
  • 78
  • 80
3
votes
2 answers

Saving video at 120/240fps

I'm making an app to record videos at the device maximum frame rate (i.e., 120fps in the iPhone 5s and 240 in the 6 and 6s). I've managed to configure the AVCaptureDevice to set the maxFrameRateDuration, I print to the logs the…
CarlosBF
  • 384
  • 1
  • 17
3
votes
1 answer

Random error when capturing a photo on iOS

I am trying here to capture an image : var stillImageOutput = AVCaptureStillImageOutput() stillImageOutput!.outputSettings = [AVVideoCodecKey: AVVideoCodecJPEG] [...] if let videoConnection =…
Cherif
  • 5,223
  • 8
  • 33
  • 54
3
votes
2 answers

Inactive/invalid connection passed when attempting to take a photo

I am attempting to take a photo using a custom view (without using UIImagePickerController), but whenever I attempt to take the photo, the app crashes, and this error is thrown: Terminating app due to uncaught exception…
Jojodmo
  • 23,357
  • 13
  • 65
  • 107
3
votes
1 answer

AVCaptureSession blocking UI on main thread in ios8

Our app uses AVCaptureSession for qr/barcode scanning. There is a simple close button that has become unresponsive in iOS 8. It appears the output buffer is overloading the main UI thread. It looks like the current output is on the main…
josh k
  • 268
  • 1
  • 11