avassetwriter

AVAssetWritter does not work with audio

Deadly 提交于 2019-12-04 15:13:32
问题 I'm trying to get audio to work with the video for an iOS application. The video is fine. No audio is recorded to the file (My iPhone speaker works.) Here's the init setup: session = [[AVCaptureSession alloc] init]; menu->session = session; menu_open = NO; session.sessionPreset = AVCaptureSessionPresetMedium; camera = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; microphone = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio]; menu->camera = camera; [session

Save AVCaptureVideoDataOutput to movie file using AVAssetWriter in Swift

断了今生、忘了曾经 提交于 2019-12-04 12:09:07
问题 I've been looking all over the web and can't seem to find a tutorial or help in what I need. Using AVFoundation and the Dlib library I've created an app that can detect a face from real time video using the front camera on the phone. I'm doing this using Shape Predictor 68 Face Landmark s. For this to work I'm pretty sure I have to use AVCaptureVideoDataOutput as opposed to AVMovieFileOutput so that each frame can be analysed. I now want to be able to save the video to file and from what I

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

↘锁芯ラ 提交于 2019-12-04 08:51:49
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 finishRecordingWithCompletionHandler is being called twice, it crashes on second call 来源: https://stackoverflow.com/questions

How to write a movie with video AND audio using AVAssetWriter?

陌路散爱 提交于 2019-12-04 07:52:32
问题 I want to export a movie with AVAssetWriter and can't figure out how to include video and audio tracks in sync. Exporting only video works fine, but when I add audio the resulting movie looks like this: First I see the video (without audio), then the video freezes (showing the last image frame until the end) and after some seconds I hear the audio. I tried some things with CMSampleBufferSetOutputPresentationTimeStamp (subtracting the first CMSampleBufferGetPresentationTimeStamp from the

CMSampleBuffer from OpenGL for video output with AVAssestWritter

孤者浪人 提交于 2019-12-04 07:00:47
I need to get a CMSampleBuffer for the OpenGL frame. I'm using this: int s = 1; UIScreen * screen = [UIScreen mainScreen]; if ([screen respondsToSelector:@selector(scale)]){ s = (int)[screen scale]; } const int w = viewController.view.frame.size.width/2; const int h = viewController.view.frame.size.height/2; const NSInteger my_data_length = 4*w*h*s*s; // allocate array and read pixels into it. GLubyte * buffer = malloc(my_data_length); glReadPixels(0, 0, w*s, h*s, GL_RGBA, GL_UNSIGNED_BYTE, buffer); // gl renders "upside down" so swap top to bottom into new array. GLubyte * buffer2 = malloc(my

AVfoundation Reverse Video

我的梦境 提交于 2019-12-04 05:14:36
I tried to make video in reverse. While playing asset in AVPlayer i set the rate = -1 to make it work in reverse format. But how to export that video? I looked into docs. read about avassetwrite, sambuffers , compositions but didn't find any way to do this. Below links are refered by me http://www.raywenderlich.com/13418/how-to-play-record-edit-videos-in-ios Reverse video demo - https://github.com/mikaelhellqvist/ReverseClip Above example to no longer works in IOS 8. and even it is not reversing audio. If anyone give me little hint on it then i can do further. I am stuck up here from last 5

Using AVAssetWriter with raw NAL Units

家住魔仙堡 提交于 2019-12-04 03:18:02
I noticed in the iOS documentation for AVAssetWriterInput you can pass nil for the outputSettings dictionary to specify that the input data should not be re-encoded. The settings used for encoding the media appended to the output. Pass nil to specify that appended samples should not be re-encoded. I want to take advantage of this feature to pass in a stream of raw H.264 NALs, but I am having trouble adapting my raw byte streams into a CMSampleBuffer that I can pass into AVAssetWriterInput's appendSampleBuffer method. My stream of NALs contains only SPS/PPS/IDR/P NALs (1, 5, 7, 8). I haven't

How do I use AVAssetWriter?

五迷三道 提交于 2019-12-03 22:49:56
I’d like to take some video frames and encode them into a video. It looks like that’s exactly what AVAssetWriter was meant for, but no matter how I eyeball the docs and Google I can’t find any way to actually use it. From the docs it looks like I need an input ( AVAssetWriterInput ) to feed the writer from. Fine. But the AVAssetWriterInput class is abstract and the only subclass that I know of in 4.1 is AVAssetWriterInputPixelBufferAdaptor that requires a AVAssetWriterInput in its initializer…? Am I missing something obvious here? zoul Ah yes, I have to acquire an instance using +

How to convert AudioBufferList to CMSampleBuffer?

醉酒当歌 提交于 2019-12-03 18:05:25
问题 I have an AudioTapProcessor attached to AVPlayerItem. which will call static void tap_ProcessCallback(MTAudioProcessingTapRef tap, CMItemCount numberFrames, MTAudioProcessingTapFlags flags, AudioBufferList *bufferListInOut, CMItemCount *numberFramesOut, MTAudioProcessingTapFlags *flagsOut) when processing. I need to convert the AudioBufferList to CMSampleBuffer so I could use AVAssetWriterAudioInput.appendSampleBuffer to write it into a movie file. So how to convert AudioBufferList to

Video Compression ios : Reduce the size of a video usin AVAssetWriter

寵の児 提交于 2019-12-03 17:03:10
I am Successful in encoding a series of image captured by AVCaptureVideoPreviewLayer of AVFoundation Framework into a Video using AVAssetWriter and AVAssetWriterInput. But the size of the video is too large, Can anyone of you suggest me a tutorial or atleast a direct me in this case or give me the correct Video output Settings for video compression. I am using the following VideoOutputSetting. videoOutputSettings = @{ AVVideoCodecKey: AVVideoCodecH264, AVVideoWidthKey: [NSNumber numberWithInt:width], AVVideoHeightKey: [NSNumber numberWithInt:height], AVVideoCompressionPropertiesKey: @{