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

AVFoundation I use setActiveVideoMinFrameDuration didn't work

I use AVCaptureVideoDataOutput in my demo ,for take photos in loop (like scanner) without sound, so i set fps to low Level [device setActiveVideoMinFrameDuration:CMTimeMake(1, 1)]; [device setActiveVideoMaxFrameDuration:CMTimeMake(1, 1)]; In my…
Zy Zhao
  • 168
  • 1
  • 9
5
votes
0 answers

Landscape mode with AVCaptureVideoPreviewLayer

I'm trying to use AVCaptureVideoPreviewLayer to get the camera to display in landscape mode, but no matter what I do, the camera always shows up on only half of the screen in landscape mode. I have it so my app only supports Landscape Right, and…
ryanthon
  • 2,524
  • 3
  • 17
  • 18
5
votes
1 answer

How do i save a video (mp4 format) using AVCaptureVideoDataOutput?

I have set up the input, and the output for the AVCapture session and also the delegate - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection is…
MaheshShanbhag
  • 1,484
  • 15
  • 14
5
votes
2 answers

Why does jpegStillImageNSDataRepresentation throw an exception when sample buffer is NOT null?

In iOS, I am using code to capture from AVCaptureStillImageOutput thus: [_captureStillOutput captureStillImageAsynchronouslyFromConnection: _captureConnection completionHandler:…
Tom Pace
  • 2,347
  • 1
  • 24
  • 32
4
votes
1 answer

AVCapture loses ability to set focus when using ZBar SDK

This has been stumping me for days... In my app i am using AVCapture to take a photo, then i am using the ZBar SDK to scan a bar code. The problem is once I load ZBar after taking a picture, i lose the ability to auto focus when taking another…
AlBeebe
  • 8,101
  • 3
  • 51
  • 65
4
votes
2 answers

Proper way to optimize my AVCaptureSession?

I got my AVCaptureSession to work and it duplicates the Camera.app UI almost perfectly, however, after a few seconds the application will crash and I just cannot find what I'm doing wrong. I really hope someone knows how to optimize this! I AM using…
Raphael Caixeta
  • 7,808
  • 9
  • 51
  • 76
4
votes
2 answers

iOS 5 - AVCaptureDevice setting focus point and focus mode freezes the live camera picture

I'm using the following method to set point of focus since iOS 4: - (void) focusAtPoint:(CGPoint)point { AVCaptureDevice *device = [[self captureInput] device]; NSError *error; if ([device…
user1016934
  • 53
  • 1
  • 1
  • 5
4
votes
1 answer

How to record video to screen on a landscape app?

This is doing my head in. I am working from this sample project: https://github.com/jj0b/AROverlayExample This works perfectly. only problem is it is a portrait app. So when I rotate the device to landscape, the video still displays as wanted,…
P i
  • 29,020
  • 36
  • 159
  • 267
4
votes
1 answer

Appropriately Release Buffers From AVCaptureDataOutputSynchronizerDelegate Due to Out Of Buffers

I am using AVCaptureDataOutputSynchronizerDelegate to handle capturing data for video, depth and metadata private let videoDataOutput = AVCaptureVideoDataOutput() private let depthDataOutput = AVCaptureDepthDataOutput() private let…
impression7vx
  • 1,728
  • 1
  • 20
  • 50
4
votes
1 answer

Why does autoFocusRangeRestriction have no effect?

You can tell the iPhone camera to focus on near or far objects by doing: try! device.lockForConfiguration() defer { device.unlockForConfiguration() } device.autoFocusRangeRestriction = .near But whether I set near, far or leave it unset makes…
Kartick Vaddadi
  • 4,818
  • 6
  • 39
  • 55
4
votes
1 answer

How to Use Obsoleted Syntax of Swift 3 in Swift 4

To record video, while setting video codec as below: sessionOutput.outputSettings = [AVVideoCodecKey: AVVideoCodecTypeJPEG] XCode says 'AVVideoCodecTypeJPEG' has been renamed to 'AVVideoCodecType.jpeg' and 'AVVideoCodecTypeJPEG' was obsoleted in…
rick
  • 1,009
  • 2
  • 10
  • 28
4
votes
2 answers

AVCaptureDevice isFlashModeSupported deprecated iOS 10

I am using AVCaptureDevice's instance method "isFlashModeSupported" as below: NSArray *captureDeviceType = @[AVCaptureDeviceTypeBuiltInWideAngleCamera,AVCaptureDeviceTypeBuiltInMicrophone]; AVCaptureDeviceDiscoverySession *captureDevice =…
Tejas Bharambe
  • 672
  • 1
  • 12
  • 27
4
votes
1 answer

How do I record a video on iOS without using a preset?

The simpler way to record a video on iOS is by setting a AVCaptureSession.sessionPreset. But that doesn't work for me since I want to control parameters like binning, stabilization (cinematic, standard, or none) and ISO. I find the format I want and…
4
votes
0 answers

how to crop a AVCaptureVideoPreviewLayer in a shape of square in Swift?

I am using AVCaptureVideoPreviewLayer to make a camera application. For some reason, I need to use just a part of the screen capturing in a square shape to show a display output. It is something similar to the early question: Cropping…
Ares Li
  • 603
  • 1
  • 7
  • 19
4
votes
0 answers

AVCaptureVideoPreviewLayer and OpenCV

I have a problem in displaying result onto the preivewLayer using iOS SDK. I would need a little advice from you in understanding how to "substitute" the captured frame with the processed one. The fact is: I have a very standard AVCapture…
Altair Jones
  • 834
  • 1
  • 7
  • 20
1 2
3
14 15