avcapturesession

Red audio recording status bar “flashes” while app in *foreground*

和自甴很熟 提交于 2019-12-03 15:00:59
问题 There are many questions (here, here) regarding the double height red audio recording status bar, but all of them reference flashes when the app resigns into the background. I'm getting a flash, I'm assuming from an AVCaptureSession setup, while the app is in foreground. Has anyone experienced this before? 回答1: You have to remove the audio input from the AVCaptureSession [self.captureSession removeInput:audioIn]; in which the audioIn is the AVCaptureDeviceInput object, that is initialised in

Camera Freeze when open app while call is running

感情迁移 提交于 2019-12-03 13:13:28
问题 I have created a camera using AVCaptureSession . I have configured that for both Photo and Video recording modes . Camera and App is running fine. Also I allowed background music play (If user play song using Music App in iPhone) while open camera or recording video. It is also working fine. (Attached image 2) I allowed background Music play with the help of this code AVAudioSession *session1 = [AVAudioSession sharedInstance]; [session1 setCategory:AVAudioSessionCategoryPlayAndRecord

iOS AVCaptureSession - How to get/set the number of frames per second recorded?

╄→гoц情女王★ 提交于 2019-12-03 11:50:50
问题 I'm new to AVCaptureSession and wish to better understand how to work with it. So I managed capturing the video stream as separated CIImages and convert them to UIImages. Now I wish to be able to get the number of Frames Per Second captured and preferably to be able to set it. Any idea how to do that? 回答1: You could use AVCaptureConnection 's videoMinFrameDuration accessor to set the value. See the AVCaptureConnection documentation Consider output be AVCaptureVideoDataOutput object.

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

扶醉桌前 提交于 2019-12-03 11:39:38
I've implemented the code below to change the orientation of an AVCaptureVideoSession based upon the UIInterfaceOrientation : - (AVCaptureVideoOrientation)interfaceOrientationToVideoOrientation:(UIInterfaceOrientation)orientation { switch (orientation) { case UIInterfaceOrientationPortrait: return AVCaptureVideoOrientationPortrait; case UIInterfaceOrientationPortraitUpsideDown: return AVCaptureVideoOrientationPortraitUpsideDown; case UIInterfaceOrientationLandscapeLeft: return AVCaptureVideoOrientationLandscapeLeft; case UIInterfaceOrientationLandscapeRight: return

AVCaptureMovieFileOutput - no active/enabled connections

泪湿孤枕 提交于 2019-12-03 10:36:28
I am trying to record video in my iPhone app using AVFoundation. But whenever I click the Record button app crashes with this message -[AVCaptureMovieFileOutput startRecordingToOutputFileURL:recordingDelegate:] - no active/enabled connections. I know same question asked in SO, but none of its answers helped me. My problem is the same code works with another application perfectly, and when I try using exactly same code in this app - crashes. But still photo capture is working fine. Adding my codes here - please help me, Thanks in advance -(void)viewDidLoad { [super viewDidLoad]; self

Real time face detection with Camera on swift 3

一世执手 提交于 2019-12-03 09:11:27
How can I do face detection in realtime just as "Camera" does? like white round shape around and over the face. I use AVCapturSession . I found that the image I saved for facial detection. Below I have attached my current code. it only captures image when I press the button and save it into the photo gallery. some please help me to create real-time round shape over according to the person's face! code class CameraFaceRecongnitionVC: UIViewController { @IBOutlet weak var imgOverlay: UIImageView! @IBOutlet weak var btnCapture: UIButton! let captureSession = AVCaptureSession() let

Modify AVCaptureSession before saving with AVCaptureMovieFileOutput

╄→尐↘猪︶ㄣ 提交于 2019-12-03 08:49:06
Use Case: I want to capture input from the camera, draw on top of the captured frames (and sound) and save the result as a .mov file. I see that I can capture input for the camera using AVCaptureSession. I can save this to a .mov file using AVCaptureMovieFileOutput. AVVideoComposition can be used to add Core Animation for playback. I assume for recording somehow too? Problem: I can't see how to modify the input before it is saved to file. The RosyWriter was almost doing what I wanted. Adding the following code to captureOutput:didOutputSampleBuffer:fromConnection: enabled me to draw onto the

Converting BGRA to ARGB

纵饮孤独 提交于 2019-12-03 08:35:49
I'm reading this tutorial on getting pixel data from the iPhone camera. While I have no issue running and using this code, I need to take the output of the camera data (which comes in BGRA) and convert it to ARGB so that I can use it with an external library. How do I do this? If you're on iOS 5.0, you can use vImage within the Accelerate framework to do a NEON-optimized color component swap using code like the following (drawn from Apple's WebCore source code ): vImage_Buffer src; src.height = height; src.width = width; src.rowBytes = srcBytesPerRow; src.data = srcRows; vImage_Buffer dest;

Hold multiple Frames in Memory before sending them to AVAssetWriter

三世轮回 提交于 2019-12-03 08:06:27
I need to hold some video frames from a captureSession in memory and write them to a file when 'something' happens. Similar to this solution , i use this code to put a frame into a NSMutableArray: - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection*)connection { //... CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); uint8 *baseAddress = (uint8*)CVPixelBufferGetBaseAddress(imageBuffer); NSData *rawFrame = [[NSData alloc] initWithBytes:(void*)baseAddress length:(height *

AVAudioSession AVAudioSessionCategoryPlayAndRecord glitch

耗尽温柔 提交于 2019-12-03 07:30:24
问题 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 want it to mix with other audio. So I need the options AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionMixWithOthers . If I do the following while other audio is playing there is a clear audible glitch in the audio from