avcapturesession

Support for background recording of video using AVCaptureSession

二次信任 提交于 2019-12-04 03:46:22
问题 I am trying to record video also in background but currently my code is recording video in foreground when the app goes background the method. -(void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error fires immediately with error as error:Error Domain=AVFoundationErrorDomain Code=-11818 "Recording Stopped" UserInfo=0x176aa180 {NSLocalizedRecoverySuggestion=Stop any other

Getting actual NSString of AvCaptureVideoDataOutput availableVideoCVPixelFormatTypes

限于喜欢 提交于 2019-12-04 03:18:28
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 inserting a breakpoint right after and: po [self.theOutput availableVideoCVPixelFormatTypes] and I get this: (NSArray *) $5 = 0x2087ad00 <__NSArrayM 0x2087ad00>( 875704438, 875704422, 1111970369 ) How do I get the string values of these format types? Thanks On an iPhone5 running iOS6, here are the AVCaptureVideoDataOuput availableVideoCVPixelFormatTypes:

Cropping AVCaptureVideoPreviewLayer output to a square

喜夏-厌秋 提交于 2019-12-04 02:44:59
问题 I am having issues with my AVCaptureVideoPreviewLayer method when grabbing a cropped UIImage of the viewable screen. Currently it is working but not outputting the correct crop that I require. I am trying to output a square but it (by the looks of it) seems to be giving the full height and compressing the image. The before image shows the LIVE screen and the after image shows the image once the capture button has been pressed. You can see that it has been changed vertically to fit the square

CALayer - Place sublayer below storyboard UIButtons?

ε祈祈猫儿з 提交于 2019-12-03 22:10:49
I've got a view controller in my storyboard with several UIButtons. One of them activates an AVFoundation camera preview layer shown in a sublayer: captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; captureVideoPreviewLayer.frame = self.view.bounds; [self.view.layer addSublayer:captureVideoPreviewLayer]; This works correctly except for the fact that the preview layer is rendered on top of my buttons so even though the buttons are still clickable they are not able to be seen by the user. Is there an easy way to place the sublayer below the buttons? Or an

iPhone how hide volume overlay when press volume key

↘锁芯ラ 提交于 2019-12-03 21:07:51
I have do lots to solve it,like add MPVolumeView,someone says that system volume HUD will hide if you add a instance of MPVolumeView in current,but that not work i add obsever to observe the volume's change,and take picture but now i lost in how hide the volume HUD I had tried the solution that add MPVolumeView instance but won't WORK please give me another way to solve it Any suggestions would be appreciated. Julian Król You need to put volume overlay like this: MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame: CGRectZero]; [self.view addSubview: volumeView]; Now the custom

setPreferredHardwareSampleRate doesn't work

筅森魡賤 提交于 2019-12-03 20:48:13
I'm using the code that can be found here . I've tried to change sample rate using: [[AVAudioSession sharedInstance] setPreferredHardwareSampleRate:SAMPLE_RATE error:nil]; Inside the init function on SoundRecoder.m file. (SAMPLE_RATE is 16000.0) When I'm checking the file it seems that still the metadata says the sample rate is 44100, I've tried also to use (as suggested here ): AudioSessionSetProperty ( kAudioSessionProperty_PreferredHardwareSampleRate ,sizeof(F64sampleRate) , &F64sampleRate ); When F64sampleRate is 16000 but still same failure. Does the device can choose which rate to sample

iPhone Camera Focussing

僤鯓⒐⒋嵵緔 提交于 2019-12-03 17:13:14
I used the below code for focusing the iphone camera. But it is not working. I take this code from the AVCam sample code of Apple. Am I doing anything wrong? Is there any method to detect if the iPhone did focussing? -(void) focusAtPoint:(CGPoint)point { AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];; if (device != nil) { if ([device isFocusPointOfInterestSupported] && [device isFocusModeSupported:AVCaptureFocusModeAutoFocus]) { NSError *error; if ([device lockForConfiguration:&error]) { [device setFocusPointOfInterest:point]; [device setFocusMode

Play system sound while recording video/audio

孤街浪徒 提交于 2019-12-03 16:58:23
I'm trying to play a "beep" sound as required by apple when I start recording a video. I've found through SO and other sources that you can't play a sound while you have an audio input going without some configuration. Here's my attempt at the configuration method: private void SetupAudio() { beepSound = AssetBank.GetSystemSoundWav("video_record", "video_beep"); AudioSession.Initialize(); AudioSession.Interrupted += delegate { Console.WriteLine("Interrupted handler"); }; AudioSession.Category = AudioSessionCategory.PlayAndRecord; AudioSession.OverrideCategoryMixWithOthers = true; NSError err;

AVCaptureSession rotate | orientation while video transmitting

北战南征 提交于 2019-12-03 16:49:26
I am developing video streaming application, in which i need to capture front camera video frame and encode then transfer to other end, a typical flow is like this AVCaptureSession -> AVCaptureDeviceInput -> AVCaptureVideoDataOutput -> capture frame --> encode frame --> send frame to other end, it works fine, i have setup the kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange as a frame format. also preview layer being used to show the preview, the problem comes when device orientation gets changes, if device moved from portrait to landscape, then on the other end frames gets rotate by 90, i was

How to record video and maintain music playing in the background?

泄露秘密 提交于 2019-12-03 15:50:52
Sorry if this is a duplicate, but I couldn't find a question similar to this. I have a custom camera/recorder that I made with AVFoundation and I was wondering how to keep the audio running from other apps while recording a video because right now it stops the audio (doesn't even pause it) and then records the video If I am thinking correctly, could this be solved by adding something similar to this: [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil]; Sample Code: AVAudioSession *session = [AVAudioSession sharedInstance]; session.delegate = self; NSError