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

Can AVCaptureSession use custom resolution

I'm using AVCaptureSession to capture and record a video. I need to record the video at a 4:3 ratio, and with a good resolution. Is there a way to specify a custom resolution when capturing using AVCaptureSession? I tried using the native presets…
Eyal
  • 10,777
  • 18
  • 78
  • 130
14
votes
5 answers

`[AVCaptureSession canAddOutput:output]` returns NO intermittently. Can I find out why?

I am using canAddOutput: to determine if I can add a AVCaptureMovieFileOutput to a AVCaptureSession and I'm finding that canAddOutput: is sometimes returning NO, and mostly returning YES. Is there a way to find out why a NO was returned? Or a way to…
Drew
  • 12,578
  • 11
  • 58
  • 98
14
votes
3 answers

How do I convert from a CVPixelBufferRef to an openCV cv::Mat

I would like to perform a few operations to a CVPixelBufferRef and come out with a cv::Mat crop to a region of interest scaled to a fixed dimension equalised the histogram convert to greyscale - 8 bits per pixel (CV_8UC1) I am not sure what the…
Robert
  • 37,670
  • 37
  • 171
  • 213
14
votes
1 answer

Using vibrate and AVCaptureSession at the same time

I'm trying to vibrate the phone while recording video, but I'm finding that AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); doesn't play nicely with AVCaptureSession. Is there any other way to vibrate the phone or am I stuck with losing the…
snownskate
  • 231
  • 1
  • 8
13
votes
1 answer

iPhone image ratio captured from AVCaptureSession

I am using somebody's source code for capturing image with AVCaptureSession. However,I found that CaptureSessionManager's previewLayer is shotter then the final captured image. I found that the resulted image is always with ratio 720x1280=9:16.…
Cullen SUN
  • 3,517
  • 3
  • 32
  • 33
13
votes
2 answers

How to disable camera microphone on AVCapture device input

I am setting a microphone on a AVCaptureSession and I am in need of a switch for the mic. How should I proceed with this? Do I really need to the captureSession?.removeInput(microphone), or is there an easies way? let microphone =…
dre_84w934
  • 678
  • 8
  • 27
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
13
votes
5 answers

Scanning Barcode or QR code in Swift 3.0 using AVFoundation

I am following this tutorial and tried to convert codes form Swift 2.0 to 3.0. But when I launched the application, the app doesn't work! I mean, nothing happens! Here is my code: ViewController: class ViewController: UIViewController…
iOS.Lover
  • 5,923
  • 21
  • 90
  • 162
13
votes
1 answer

Using maxRecordedFileSize to limit AVCaptureSession record time

I've been writing a camera app for iOS 8 that uses AVFoundation to set up and handle recording and saving (not ImagePickerController). I'm trying to save use the maxRecordedFileSize attribute of the AVCaptureMovieFileOutput class to allow the user…
13
votes
2 answers

AVAudioSession AVAudioSessionCategoryPlayAndRecord glitch

I would like to record videos with audio using AVCaptureSession. For this I need the AudioSessionCategory AVAudioSessionCategoryPlayAndRecord, since my app also plays back video with sound. I want audio to be audible from the default speaker and I…
12
votes
1 answer

Device torch turns off when starting AVCaptureSession

I'm using AVCaptureSession to capture video. I want to light on the torch during the whole session, but once the session is started, the light turns automatically off. There is a lot of posts here showing how to turn on the torch. It works, unless…
Martin
  • 11,881
  • 6
  • 64
  • 110
12
votes
2 answers

AVCaptureSession Crashing when using webRTC

I am using WebRTC and its using AVCaptureSession. It works fine a few times but sometimes its getting crashed with this Exception. Assertion failed: (_internal->figCaptureSession == NULL), function -[AVCaptureVideoPreviewLayer…
Tina
  • 307
  • 2
  • 11
12
votes
4 answers

How to get the Y component from CMSampleBuffer resulted from the AVCaptureSession?

Hey there, I am trying to access raw data from iphone camera using AVCaptureSession. I follow the guide provided by Apple (link here). The raw data from the samplebuffer is in YUV format ( Am I correct here about the raw video frame format?? ), how…
Nihao
  • 199
  • 1
  • 2
  • 11
12
votes
3 answers

AVCaptureSession pause?

I am using the AV Foundation for capturing images continuously after Apple released iOS 4.0 by following the codes given by, http://developer.apple.com/iphone/library/qa/qa2010/qa1702.html However, when I call "[session startRunning];" it takes…
chathuram
  • 616
  • 2
  • 5
  • 23
12
votes
2 answers

Avoiding blurriness at start & end of video (even after using setPreferredVideoStabilizationMode:AVCaptureVideoStabilizationModeAuto)?

We capture video on iOS while using setPreferredVideoStabilizationMode:AVCaptureVideoStabilizationModeAuto, but the video still sometimes comes out blurry at the start and at the end (fine in the middle, though), which is very problematic because we…
Crashalot
  • 33,605
  • 61
  • 269
  • 439