avcapturesession

AVCapturesession handling after returning from background

喜夏-厌秋 提交于 2019-12-07 14:13:38
问题 I am implementing a VideoRecorder using the AVCaptureSession. I am starting AVCaptureSession at viewWillAppear and tearing it down at viewWillDisappear on recommendation of this question AVCaptureSession fails when returning from background . Now when the Video is Recording and the app goes to background I want to stop recording and pause the capture session. But each time the app comes to foreground at this point I get one of the following Capture Session is not paused but recording and the

What is the recommended way to deal with AVCaptureVideoDataOutput image data regarding orientation

余生长醉 提交于 2019-12-07 09:47:33
I am writing an application that does some real-time processing on image data it gets from AVCaptureVideoDataOutput within an AVCaptureSession. I am currently able to start the session, add input & output and then retrieve image data, convert it to UIImage and display it on the screen live. The main problem I'm having is that the image's orientation is awkward. It's rotated and mirrored and it also looks skewed. I've done some research into it, I've found some related questions , and I've tried the code that has been suggested but it doesn't fix the rotation problem. I think the questions

How to set audio sample rate on AVCaptureSession?

随声附和 提交于 2019-12-07 08:23:41
问题 I am using AVCaptureSession to record video and audio into sample buffers using AVCaptureVideoDataOutput and AVCaptureAudioDataOutput . The default audio sample rate for the iPhone (4 and 4S) is 44100Hz. I would like to set this to 48000Hz however AVCaptureSession does not seem to have any settings for audio sample rate. I have tried to use AVAudioSession to change the hardware sample rate (using setPreferredHardwareSampleRate) but though it reports the hardware sample rate as changed (after

Set a custom AVFrameRateRange for an AVCaptureSession

▼魔方 西西 提交于 2019-12-07 04:42:40
问题 I'm trying to take 5 pictures every second with AVCaptureSession and I'm not sure I understand what AVFrameRange means. Currently I have some code that sets up the device: AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; and tries to set the activeVideoMinFrameDuration and activeVideoMaxFrameDuration to a custom value of CMTimeMake(1, 5) . Apple tells me I can only use one of the AVFrameRanges that they've provided. When I NSLogged them, I get (2, 30),

AVCaptureSession exact time stamp when a frame is grabbed

≯℡__Kan透↙ 提交于 2019-12-07 04:38:03
问题 I am inside of a AVCaptureSession and I need to know the number of the frame being captured. When the capture starts, I will reset a frame number counter to zero. So, the timestamp of the first frame will be zero. Subsequent frames will have capture timestamps like this, for example: 0 0.033 0.066 0.099 etc but these are not exact numbers, because frames can be dropped and slight differences may happen. I need to know the exact time when a frame was captured. I have this method that is called

AVCaptureSession fails when returning from background

浪尽此生 提交于 2019-12-07 03:29:07
问题 I have a camera preview window which is working well 90% of the time. Sometimes however, when returning to my app if it's been in the background, the preview will not display. This is the code I call when the view loads: - (void) startCamera { session = [[AVCaptureSession alloc] init]; session.sessionPreset = AVCaptureSessionPresetPhoto; AVCaptureVideoPreviewLayer *captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; captureVideoPreviewLayer.frame =

AVCaptureSession barcode scan

元气小坏坏 提交于 2019-12-07 02:17:19
问题 I'm currently working with AVCaptureSession and AVCaptureMetadataOutput . It works perfectly, but I just want to know how to indicate to scan and analyze metadata objects only on a specific region of the AVCaptureVideoPreviewLayer ? 回答1: Here is a sample of code from a project I have that may help you on the right track // where 'self.session' is previously setup AVCaptureSession // setup metadata capture AVCaptureMetadataOutput *metadataOutput = [[AVCaptureMetadataOutput alloc] init]; [self

Why is my audio AVCaptureConnection not active for highest-resolution formats?

情到浓时终转凉″ 提交于 2019-12-07 01:51:00
问题 I'm working on an iOS project which uses AVAssetWriter and AVAssetWriterInput to record audio and video to file. Everything seemed to work fine when the video resolution was limited to 720x1280. I'm now trying to take advantage of the AVCaptureDeviceFormats for higher resolutions available on newer iOS devices. The video continues to work fine using any of the AVCaptureDeviceFormats available on the device. However, the audio does not work. I've tracked this down to the active property of my

UIScrollView displaying Camera

橙三吉。 提交于 2019-12-06 15:16:17
问题 I have created a camera view to be displayed on the screen by creating a AVCaptureVideoPreviewLayer and now I would like it to be able to be displayed inside of my scroll view. Currently my scroll view is set up to handle UIImageViews but not the camera layer. Here is how it all works together: //Set Up the Camera View [self setCaptureManager:[[CaptureManager alloc] init]]; [[self captureManager] addVideoInput]; [[self captureManager] addVideoPreviewLayer]; CGRect layerRect = [[[self view]

iPhone checking for existence of AVCaptureSession Class

佐手、 提交于 2019-12-06 14:56:17
问题 I have integrated a library that uses AVCaptureSession to capture a photo from the camera. As the AVCaptureSession is only available on iOS 4 devices, I want to disable this integrated functionality for older devices. I know that it should be done by weak-linking the AVFoundation Framework and checking for function existence. Weak-linking is easy to do, but which function should I check for existence here? AVCaptureSession is a class and not a function. Are there some sample code available?