avcapturesession

Crash when using front camera ONLY on pre-iPhone 7 devices

混江龙づ霸主 提交于 2020-04-18 04:02:38
问题 I've recently started running beta on my camera-based app. Everything is working as expected except on iPhone 6 devices. The session starts on the back camera, and each time an iPhone 6 user switches to the front camera the app crashes. (And just to be really clear: no one on any other iPhone model is experiencing the issue.) I've gotten my hands on a 6 to test and can consistently reproduce the error, resulting in libc++abi.dylib: terminating with uncaught exception of type NSException . I

Corrupt video capturing audio and video using AVAssetWriter

南楼画角 提交于 2020-01-24 21:30:07
问题 I am using an AVCaptureSession to use video and audio input and encode an H.264 video with AVAssetWriter . If I don't write the audio, the video is encoded as expected. But if I write the audio, I am getting a corrupt video. If I inspect the audio CMSampleBuffer being supplied to the AVAssetWriter it shows this information: invalid = NO dataReady = YES makeDataReadyCallback = 0x0 makeDataReadyRefcon = 0x0 formatDescription = <CMAudioFormatDescription 0x17410ba30 [0x1b3a70bb8]> { mediaType:

Creating copy of CMSampleBuffer in Swift returns OSStatus -12743 (Invalid Media Format)

╄→гoц情女王★ 提交于 2020-01-24 05:46:05
问题 I am attempting to perform a deep clone of CMSampleBuffer to store the output of a AVCaptureSession . I am receiving the error kCMSampleBufferError_InvalidMediaFormat (OSStatus -12743) when I run the function CMSampleBufferCreateForImageBuffer . I don't see how I've mismatched the CVImageBuffer and the CMSampleBuffer format description. Anyone know where I've gone wrong? Her is my test code. func captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer

iPhone how hide volume overlay when press volume key

拜拜、爱过 提交于 2020-01-22 16:28:13
问题 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. 回答1: You need to put volume overlay like this: MPVolumeView *volumeView = [

AVCaptureSession is not giving a good photo quality and good resolution

自作多情 提交于 2020-01-22 07:35:11
问题 I'm working with AVCaptureSession for capturing the image. Its working fine but not giving a good resolution. I compared it with the image captured by iPhone Camera and I found that the iPhone Camera Image is much better than AVCaptureSession image. I have seen 3-4 links on stackOverflow about this but could not find any solution. also I have tried all the presets AVCaptureSessionPresetPhoto, AVCaptureSessionPresetHigh, AVCaptureSessionPresetMedium, AVCaptureSessionPresetLow,

Changing AVCaptureDeviceInput leads to AVAssetWriterStatusFailed

风格不统一 提交于 2020-01-20 04:55:09
问题 I am trying to change the Camera View Front and Back .it is working well.if video is recorded without flipping with Pause/Record Option it is working fine.But if we Flip Camera View once then, further recording video is not saving which leads to AVAssetWriterStatusFailed - The operation could not be completed . Can anybody help me to find where i have gone wrong ? Below is my code. Camera.m - (void)flipCamera{ NSArray * inputs = _session.inputs; for ( AVCaptureDeviceInput * INPUT in inputs )

Preventing AVCaptureVideoPreviewLayer from rotating, but allow UI layer to rotate with orientation

大城市里の小女人 提交于 2020-01-20 03:34:31
问题 I have two view controllers. One is the root VC and contains the UI interface such as the record button. On this view controller, I also display the view of another VC at index 0. This view contains a AVCaptureVideoPreviewLayer. I would like my video camera to mimic the Apple video camera app, where the interface layout adjusts with the rotation, but the video preview layer does not. You can see how the recording timer (UILabel) in the stock video app disappears and reappears at the top

Run multiple AVCaptureSessions or add multiple inputs

流过昼夜 提交于 2020-01-20 01:44:30
问题 I want to display the stream of the front and the back facing camera of an iPad2 in two UIViews next to each other. To stream the image of one device I use the following code AVCaptureDeviceInput *captureInputFront = [AVCaptureDeviceInput deviceInputWithDevice:[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo] error:nil]; AVCaptureSession *session = [[AVCaptureSession alloc] init]; session addInput:captureInputFront]; session setSessionPreset:AVCaptureSessionPresetMedium]; session

Run multiple AVCaptureSessions or add multiple inputs

痞子三分冷 提交于 2020-01-20 01:41:27
问题 I want to display the stream of the front and the back facing camera of an iPad2 in two UIViews next to each other. To stream the image of one device I use the following code AVCaptureDeviceInput *captureInputFront = [AVCaptureDeviceInput deviceInputWithDevice:[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo] error:nil]; AVCaptureSession *session = [[AVCaptureSession alloc] init]; session addInput:captureInputFront]; session setSessionPreset:AVCaptureSessionPresetMedium]; session

AVCaptureSession, AVCaptureAudioDataOutput and background Music

[亡魂溺海] 提交于 2020-01-16 04:05:05
问题 I record audio/video with AVFoundation using AVCaptureVideoDataOutput and AVCaptureAudioDataOutput . But when I add my AVCaptureAudioDataOutput to my AVCaptureSession , AVFoundation stop background music (in my case from iPod app). So I'm looking for a solution to let my music playing during my record ? Thanks, Alak ps: I'm targeting iOS8 and I user Swift 2.0 回答1: do { try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: