avassetwriter

Pixel formats, CVPixelBufferRefs and glReadPixels

萝らか妹 提交于 2019-12-29 04:54:15
问题 I'm using glReadPixels to read data into a CVPixelBufferRef . I use the CVPixelBufferRef as the input into an AVAssetWriter . Unfortunately the pixel formats seem to be mismatched. I think glReadPixels is returning pixel data in RGBA format while AVAssetWriter wants pixel data in ARGB format. What's the best way to convert RGBA to ARGB ? Here's what I've tried so far: bit manipulation along the lines of argb = (rgba >> 8) | (rgba << 24) using a CGImageRef as an intermediate step The bit

Writing video + generated audio to AVAssetWriterInput, audio stuttering

时光毁灭记忆、已成空白 提交于 2019-12-29 03:31:50
问题 I'm generating a video from a Unity app on iOS. I'm using iVidCap, which uses AVFoundation to do this. That side is all working fine. Essentially the video is rendered by using a texture render target and passing the frames to an Obj-C plugin. Now I need to add audio to the video. The audio is going to be sound effects that occur at specific times and maybe some background sound. The files being used are actually assets internal to the Unity app. I could potentially write these to phone

How do I control AVAssetWriter to write at the correct FPS

那年仲夏 提交于 2019-12-28 15:26:48
问题 Let me see if I understood it correctly. At the present most advanced hardware, iOS allows me to record at the following fps: 30, 60, 120 and 240. But these fps behave differently. If I shoot at 30 or 60 fps, I expect the videos files created from shooting at these fps to play at 30 and 60 fps respectively. But if I shoot at 120 or 240 fps, I expect the video files creating from shooting at these fps to play at 30 fps, or I will not see the slow motion. A few questions: am I right? is there a

AVAudioSession ducking stops when AVAssetWriter.startWriting is called

偶尔善良 提交于 2019-12-25 00:51:02
问题 When I call startWriting for a video capture session, the ducking for my audio session stops, and the external audio goes back to full volume. How can I prevent this from happening? Audio session setup: try! AVAudioSession.sharedInstance().setCategory(.playback, mode: .spokenAudio, options: [.duckOthers, .interruptSpokenAudioAndMixWithOthers]) try! AVAudioSession.sharedInstance().setActive(true) // ducking starts here, as expected Video session setup: let videoSettings:[String: Any] =

AVAssetWriterInput does not currently support AVVideoScalingModeFit - IOS Error

心已入冬 提交于 2019-12-23 21:50:11
问题 I'm attempting to use the AVAssetWriterInput to crop a video that I read in a screencast of my application. Here is my current configuration. NSDictionary *videoCleanApertureSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:320], AVVideoCleanApertureWidthKey, [NSNumber numberWithInt:480], AVVideoCleanApertureHeightKey, [NSNumber numberWithInt:10], AVVideoCleanApertureHorizontalOffsetKey, [NSNumber numberWithInt:10], AVVideoCleanApertureVerticalOffsetKey, nil];

how to add fade in/out effect in avassetwriter (img to video) in iphone

半世苍凉 提交于 2019-12-23 07:42:32
问题 I'm creating a .mov from the array of images with audio using avassetwriter and i want to add the fade in/out effect in the creating video, have anyone used any code? Thanks in advance for any help! ... for(UIImage * img in imageArray) { //UIImage * img = frm._imageFrame; buffer = [self pixelBufferFromCGImage:[img CGImage]]; BOOL append_ok = NO; int j = 0; while (!append_ok && j < 30) { if (adaptor.assetWriterInput.readyForMoreMediaData) { //print out status: NSLog(@"Processing video frame (

AVAssetWriter has an audio 'crackle' only on iOS 13 devices

与世无争的帅哥 提交于 2019-12-23 03:44:14
问题 I use AVCaptureSession to write to a mov file using AVAssetWriter. The same code on a pre-iOS 13 devices does not have the crackle. On all iOS 13 devices, regardless of iPhone/iPad model, have the audio crackle. I've submitted this to Apple as a bug, but I'm worried I'm missing something simple. Is there anyone else experiencing this? Any ideas of settings I could change? Things I've tried Changed mov -> mpeg Tried multiple audio codecs (particularly AppleLossless and AAC) Pushed to main

AVAssetWriter goes AVAssetWriterStatusFailed after appendSampleBuffer:

隐身守侯 提交于 2019-12-22 09:03:45
问题 I am trying to perform screen-recording using AVAssetWriter, which also accepts audio input. However, I have been stuck on this error, where AVAssetWriter sometimes becomes AVAssetWriterStatusFailed after a few calls on appendSampleBuffer: (inside encodeAudioFrame: ) Failed: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x32b570 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x70d710 "The operation couldn’t be

How to add static and dynamic overlays to video with AVAssetWriter?

喜欢而已 提交于 2019-12-22 06:49:38
问题 What's the right way to add an image overlay to a video created with AVAssetWriter? It's possible to do so with AVAssetExportSession, but this question is about how to do so with AVAssetWriter so there is more control over the quality and output. There are two scenarios: 1) Simple: Add single overlay that is present the entire duration of the video (similar to a watermark). 2) Complex: Add different overlays that animate in and out of the video at different times (similar to using

GPUImageMovieWriter - crashing with “Cannot call method when status is 2”

与世无争的帅哥 提交于 2019-12-21 16:57:40
问题 Trying to get started with the really great GPUImage framework so graciously shared by Brad Larson, but having an issue. When running the SimpleVideoFileFilter sample it always crashes at completion with the following error: [AVAssetWriterInput markAsFinished] Cannot call method when status is 2 Anyone know how to correct this? Also do not see the video when run in simulator, does it not work for simulator? Running iOS 6.1 and Xcode 4.6 Thanks! I am noticing that