Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i save a video (mp4 format) using AVCaptureVideoDataOutput?

I have set up the input, and the output for the AVCapture session and also the delegate

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection

is getting called. How do I convert the frames to a mp4 video file and save it?

like image 280
MaheshShanbhag Avatar asked Nov 03 '22 02:11

MaheshShanbhag


1 Answers

Use an AVAssetWriter to compress the data and write to MP4. These two samples contain code that does this:

http://www.gdcl.co.uk/2013/02/20/iPhone-Pause.html

http://www.gdcl.co.uk/2013/02/20/iOS-Video-Encoding.html

G

like image 110
Geraint Davies Avatar answered Nov 08 '22 04:11

Geraint Davies