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:

214 questions
64
votes
19 answers

AVCaptureVideoPreviewLayer orientation - need landscape

My app is landscape only. I'm presenting the AVCaptureVideoPreviewLayer like this: self.previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; [self.previewLayer setBackgroundColor:[[UIColor blackColor]…
soleil
  • 11,239
  • 29
  • 102
  • 172
21
votes
2 answers

AVCaptureVideoPreviewLayer not filling screen

I read about one million threads about how to make a VideoPreviewLayer filling the complete screen of an iPhone but nothing works ... maybe you can help me because I'm really stuck. This is my Preview layer init: if (UI_USER_INTERFACE_IDIOM() ==…
user2135074
  • 233
  • 1
  • 2
  • 7
19
votes
5 answers

Method to find device's camera resolution iOS

Whats the best method to find the image resolution going to be captured using setting AVCaptureSessionPresetPhoto. I am trying to find the resolution before capturing the image.
thar_bun
  • 800
  • 1
  • 4
  • 20
19
votes
9 answers

AVCaptureDevice Camera Zoom

I have a simple AVCaptureSession running to get a camera feed in my app and take photos. How can I implement the 'pinch to zoom' functionality using a UIGestureRecognizer for the camera?
The Kraken
  • 3,087
  • 5
  • 25
  • 65
17
votes
1 answer

Run multiple AVCaptureSessions or add multiple inputs

I want to display the stream of the front and the back facing camera of an iPad2 in two UIViews next to each other. To stream the image of one device I use the following code AVCaptureDeviceInput *captureInputFront = [AVCaptureDeviceInput…
16
votes
3 answers

Capture Metal MTKView as Movie in realtime?

What is the most efficient way to capture frames from a MTKView? If possible, I would like to save a .mov file from the frames in realtime. Is it possible to render into an AVPlayer frame or something? It is currently drawing with this code (based…
Jeshua Lacock
  • 4,342
  • 1
  • 24
  • 48
14
votes
2 answers

AVCaptureSession specify resolution and quality of captured images obj-c iphone app

Hi I want to setup AV capture session to capture images with specific resolution (and, if possible, with specific quality) using iphone camera. here's setupping AV session code // Create and configure a capture session and start it running -…
Oleg
  • 1,355
  • 4
  • 19
  • 35
13
votes
1 answer

Swift 3 - AVCapture custom camera view

I was following through this video to make a custom camera view. https://www.youtube.com/watch?v=w0O3ZGUS3pk however due to iOS 10 and swift 3 changes many things weren't relevant anymore the following is the code I got out after changing deprecated…
Jeff Huang
  • 185
  • 1
  • 1
  • 9
11
votes
1 answer

Set GrayScale on Output of AVCaptureDevice in iOS

I want to implement custom camera into my app. So, I am creating this camera using AVCaptureDevice. Now I want to show only Gray Output into my custom camera. So I am trying to getting this using…
Meet Doshi
  • 3,983
  • 10
  • 35
  • 76
10
votes
3 answers

iOS: Torch level on iPhone 11 Pro

I'm using AVCaptureDevice.setTorchModeOn(level) method to turn on the flashlight at variable brightness. On my old iPhone SE it's working fine — I can clearly see 4 different brightness levels as I change level from 0 to 1. But on the iPhone 11 Pro…
Pavel Alexeev
  • 5,538
  • 2
  • 38
  • 48
9
votes
2 answers

how to draw grid lines when camera is open avcapturemanager

I want to display grid line like the one which appears when a camera is open.I am using AVCaptureManager.Should i use core graphics to draw grid lines?what is the size of those grid lines? thanks
sin
  • 726
  • 7
  • 16
9
votes
1 answer

AVCaptureVideoPreviewLayer front camera flip( unmirror ) the pixelbuffer before passing to opengl shader

I am using AVCaptureVideoPreviewLayer to pass the live video and apply openGL shaders in realtime. On using front camera, the video is mirrored, I want to un-mirror it before applying the shader. Can anyone help there? Added : code for switching to…
Manish Deora
  • 91
  • 1
  • 3
9
votes
3 answers

Getting actual NSString of AvCaptureVideoDataOutput availableVideoCVPixelFormatTypes

I am trying to find the accepted formats on an AVFoundation output: self.theOutput=[[AVCaptureVideoDataOutput alloc]init]; if ([self.theSession canAddOutput:self.theOutput]) [self.theSession addOutput:self.theOutput]; I am then…
8
votes
1 answer

Why is VideoDataOutput's availableVideoCodecTypes empty?

AVCaptureVideoDataOutput has a field availableVideoCodecTypes that's supposed to tell you what codecs you can use to record a video, but it's always empty. Why is this? I checked its value immediately after creating the VideoDataOutput, and after…
Kartick Vaddadi
  • 4,265
  • 5
  • 33
  • 45
8
votes
1 answer

Exporting AVCaptureSession video in a size that matches the preview layer

I'm recording video using AVCaptureSession with the session preset AVCaptureSessionPreset640x480. I'm using an AVCaptureVideoPreviewLayer in a non-standard size (300 x 300) with the gravity set to aspect fill while recording. It's setup like…
1
2 3
14 15