I m trying to create a tutorial video from ipad screen as done in this application (ShowME) Using AVAssetWriter I am able to capture a video of the screen.
I tried using AVCaptureDevice, but Its not working. I dont know what is going wrong.
I learned capturing video from iphone screen from this link - A very nice turorial.
But it does not captures any audio along with screen video. So I gave a try like this:
-(void)setUpMike{
NSError* error = nil;
// Setup the audio input
AVCaptureDevice *audioDevice = [AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeAudio];
AVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:&error ];
// Setup the audio output
_audioOutput = [[AVCaptureAudioDataOutput alloc] init];
// Create the session
_capSession = [[AVCaptureSession alloc] init];
[_capSession addInput:audioInput];
[_capSession addOutput:_audioOutput];
_capSession.sessionPreset = AVCaptureSessionPresetLow;
// Setup the queue
dispatch_queue_t queue = dispatch_queue_create("MyQueue", NULL);
// [_videoOutput setSampleBufferDelegate:self queue:queue];
[_audioOutput setSampleBufferDelegate:self queue:queue];
dispatch_release(queue);
}
I added the delegate method
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection
This is never called. Hope any one can help me around for this.
I have never used AVFoundation for video and audio purpose, So may be a newbie Question.
I read other posts relating this and found that the are merging audio with video. I think we can go through this way. Please inform me if this is not possible.
Thanks in advance :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…