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
2
votes
2 answers

How to add image picker with camera button to iOS app

I'm adding a button that opens a view of the saved images on device, but also has a button to open the camera. The iOS Facebook app currently does this. I've played with both AVCapture to create my own camera ui and UIImagePickerController to use…
hobosf
  • 309
  • 3
  • 12
2
votes
5 answers

AVCaptureVideoPreviewLayer, video orientation stuck

I have an iPhone camera app in which I use the AVCaptureVideoPreviewLayer. When someone takes a picture/stillImage this is shown in a new ViewController. The magic happens once this view controller is dismissed. The whole app rotates properly, both…
ophychius
  • 2,623
  • 2
  • 27
  • 49
2
votes
1 answer

How to trigger a bright flash like the Camera app?

The way I am attempting to do a flash is this: 1) Calling [device setTorchMode:AVCaptureTorchModeOn]; [device setFlashMode:AVCaptureFlashModeOn]; 2) After 0.1 seconds I call [device setTorchMode:AVCaptureTorchModeOff]; [device…
openfrog
  • 40,201
  • 65
  • 225
  • 373
2
votes
0 answers

How to implement both GPUImageWhiteBalanceFilter and uiElement blend more efficiently?

I'm working on an app which use GPUImage framework. I want to use GPUImageWhiteBalanceFilter to adjust whitebalance and record some watermark use uiElement blend, it works but the framerate is poor when capture 1080p video in iphone 4s. Codes as…
JonnyHan
  • 97
  • 4
2
votes
1 answer

IOS, AVCam, how do I preview captured image?

Using the AVCam sample, I don't see how I can get access tot he image in the AVCamViewController.m file. I want to preview the captured image, but I don't see how I can access this image in the method: - (IBAction)captureStillImage:(id)sender…
sAguinaga
  • 638
  • 13
  • 31
1
vote
0 answers

How to add 60FPS Viewfinder Custom Camera

I’m having trouble making my iOS app with a custom camera run in 60FPS or above. Does anyone know how I can achieve this? I tried setting it to 60 FPS but then the viewfinder went black. I also gave my code to ChatGPT and it could not figure it out.
1
vote
0 answers

AVCapturePhotoOutput with 60 fps and flash on causes image to be over brightened

When using AVCapturePhotoOutput with flashMode On and AVCaptureDevice with minimum frame rate set to 60 fps results in an image that is very over brightened. Using the same configuration with 30 fps results in a correct image. I have tried many…
1
vote
1 answer

SwiftUI - Resize AVCaptureVideoPreviewLayer

I have the following code: struct CameraPreview: UIViewRepresentable { @ObservedObject var camera: Camera class CameraView: UIView { override class var layerClass: AnyClass { AVCaptureVideoPreviewLayer.self …
LeonardoXUI
  • 411
  • 3
  • 10
1
vote
0 answers

How to adjust AVCaptureVideoPreview orientation to device current orientation?

I am trying to adjust AVCaptureVideoPreview orientation to device current orientation and I tried someways which I found on Stackoverflow but it didn’t work. How can I adjust AVCaptureVideoPreview orientation to device current orientation? Here are…
1
vote
1 answer

Simultaneous Long Press and Drag Gesture SwiftUI

I have an app with a camera and there is a capture button that I would like to long press on the screen to record and freely move it around and be able to zoom in and out. Now I am not worried about the recording and zooming part, what I am failing…
Denzel
  • 309
  • 1
  • 8
1
vote
1 answer

How to Apply a Scale transform to an AVCaptureVideoPreviewLayer

I have an AVCaptureVideoPreviewLayer named previewlayer that is set to a UIImageView named VideoOut that was implemented using Storyboard The code I used to connect them was as follows previewlayer.frame = VideoOut.bounds I then wanted to add…
LawlessLLC
  • 35
  • 6
1
vote
0 answers

AVAudioSession and Haptic Feedback

The main issue here is, when the microphone input is added, the device loses any haptic system sounds. I setup the audio session here: let audioSession = AVAudioSession.sharedInstance() do { try self.audioSession.setCategory(.playAndRecord,…
Gizmodo
  • 3,151
  • 7
  • 45
  • 92
1
vote
1 answer

"No active and enabled video connection" when trying to use AVCapturePhotoOutput

I need a way to take photos programmatically from a macOS app and I am using AVCapturePhotoOutput to achieve this. First I initialize the camera with class ViewController: NSViewController, AVCapturePhotoCaptureDelegate { fileprivate var…
dclipca
  • 1,739
  • 1
  • 16
  • 51
1
vote
1 answer

Why rotate Image in OpenCV without rotation code?

I am taking photo using AVCaptureStillImageOutput, AVCaptureSession, AVCaptureVideoPreviewLayer and display it in UIImageView. Its work properly. But, After display image in UIImage. I am detecting faces using OpenCV from that displayed image. It…
Chetan Bhalara
  • 10,326
  • 6
  • 32
  • 51
1
vote
1 answer

Swift iPad - AVAssetWriter AVCapture session recording video gets a green video after few seconds in iPad iOS12.4

I am using AVCaptureSession to record video with AVAssetWriter to a file and everything is working fine with iOS 13.+ devices(iPhone or iPad). But it is not working in iOS 12.4 iPad device, in that after a few seconds its video shows as a green…
Unnikrishnan
  • 158
  • 7