Questions tagged [avcapturesession]

iPhone - To perform a real-time or offline capture, you instantiate an AVCaptureSession object and add appropriate inputs (such as AVCaptureDeviceInput), and outputs (such as AVCaptureMovieFileOutput).

You use an AVCaptureSession object to coordinate the flow of data from AV input devices to outputs.

To perform a real-time or offline capture, you instantiate an AVCaptureSession object and add appropriate inputs (such as AVCaptureDeviceInput), and outputs (such as AVCaptureMovieFileOutput).

The AVFoundation Programming Guide explains how to use AVCapureSession.

1246 questions
12
votes
2 answers

Quick 180 rotation of iOS Device results in the camera viewing upside-down

I've implemented the code below to change the orientation of an AVCaptureVideoSession based upon the UIInterfaceOrientation: - (AVCaptureVideoOrientation)interfaceOrientationToVideoOrientation:(UIInterfaceOrientation)orientation { switch…
12
votes
5 answers

Camera feed slow to load with AVCaptureSession on iOS - How can I speed it up?

Right now I'm trying to allow users to take pictures in my app without using UIImagePickerController. I'm using AVCaptureSession and all the related classes to load a camera feed as a sublayer on a full-screen view I have on one of my view…
Tony Friz
  • 883
  • 1
  • 10
  • 27
12
votes
1 answer

How can I extract an AVMetadataObject from a UIImage?

I'd like to use iOS 7's new barcode scanning functionality with a UIImage instead of live capture from one of the device's camera. I already have the detection working fine with an AVCaptureDeviceInput. The best way I think to do this would be to…
jpsim
  • 14,329
  • 6
  • 51
  • 68
12
votes
1 answer

iOS: camera orientation

I want to capture an image with the camera using AVCaptureSession. It works ok, I start the camera and I can get the output. However, I have some problems with video orientation when I rotate the device. First, I want to support landscape left and…
A.Vila
  • 1,456
  • 4
  • 21
  • 32
12
votes
2 answers

AVCaptureSession and AVCaptureMovieFileOutput frame timestamp

I am recording a movie with AVCaptureSession and AVCaptureMovieFileOutput. I am also recording acceleration data and trying to align the acceleration data with the video. I am trying to figure out a way to get the time the video file recording…
Roland Rabien
  • 8,750
  • 7
  • 50
  • 67
11
votes
1 answer

AVCaptureVideoPreviewLayer wrong orientation when UI rotation is disabled

I have a AVCaptureVideoPreviewLayer instance added to a view controller view hierarchy. - (void) loadView { ... self.previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:nil]; self.previewLayer.frame = self.view.bounds; …
NikGreen
  • 700
  • 9
  • 28
11
votes
1 answer

iOS 10 - Objective-C : How to implement AVCapturePhotoOutput() to capture image and videos?

I'm trying to implement capture image and videos from my app, and now from iOS 10 onward "AVCaptureStillImageOutput" is deprecated. Please help me to implement AVCapturePhotoOutput in Objective-C. Here is my sample code: _avCaptureOutput =…
Anand Kore
  • 1,300
  • 1
  • 15
  • 33
11
votes
1 answer

UIImage from AVCaptureMetadataOutput delegate (didOutputMetadataObjects)

I am scanning QR Code & Barcode using AVCaptureMetadataOutput. When then camera is focused to barcode didOutputMetadataObjects delegate is called and I am able to get barcode metadata string. But I wonder how to get the scanned image(barcode image)…
Prashanth Rajagopalan
  • 718
  • 1
  • 10
  • 27
11
votes
1 answer

AVCaptureSession stopRunning method creates terrible hang

Using Ray Wenderlich's QRCode reader from Chapter 22 of iOS7 Tutorials, I am successfully reading QRCodes for my current app. I am now extending it that upon successfully reading a QRCode, I want to store the stringValue of the…
Maximilian
  • 1,107
  • 11
  • 20
11
votes
1 answer

Pause & resume video capture using AVCaptureMovieFileOutput and AVCaptureVideoDataOutput in iOS

I have to implement functionality to repeatedly pause and resume video capture in a single session, but have each new segment (the captured segments after each pause) added to the same video file, with AVFoundation. Currently, every time I press…
Subhasis
  • 111
  • 1
  • 3
11
votes
2 answers

Get Camera Preview to AVCaptureVideoPreviewLayer

I was trying to get the camera input to show on a preview layer view. self.cameraPreviewView is tied to a UIView in IB Here is my current code that I put together from the AV Foundation Programming Guide. But the preview never shows AVCaptureSession…
William
  • 1,033
  • 2
  • 13
  • 25
11
votes
4 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…
11
votes
1 answer

Getting desired data from a CVPixelBuffer Reference

I have a program that views a camera input in real-time and gets the color value of the middle pixel. I use a captureOutput: method to grab the CMSampleBuffer from an AVCaptureSession output (which happens to be read as a CVPixelBuffer) and then I…
bbrownd
  • 525
  • 1
  • 6
  • 14
10
votes
4 answers

How to read depth data at a CGPoint from AVDepthData buffer

I am attempting to find the depth data at a certain point in the captured image and return the distance in meters. I have enabled depth data and am capturing the data alongside the image. I get the point from the X,Y coordinates of the center of…
Allreadyhome
  • 1,252
  • 2
  • 25
  • 46
10
votes
3 answers

AVCaptureSession and AVAudioSession recording video while background music playing only works once

After looking at this question: AVAudioSession AVAudioSessionCategoryPlayAndRecord glitch, i tried to take a stab at trying to get video recording with background music playing working correctly. I'm settling for the audio glitch when recording…
Wiz
  • 4,595
  • 9
  • 34
  • 51