5

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?

MaheshShanbhag
  • 1,484
  • 15
  • 14

1 Answers1

2

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

Geraint Davies
  • 2,847
  • 15
  • 9
  • thanks @Geraint Davies. This link [Video Recorder](http://stackoverflow.com/questions/4944083/can-use-avcapturevideodataoutput-and-avcapturemoviefileoutput-at-the-same-time) also helped me – MaheshShanbhag Mar 19 '13 at 12:03
  • Hi Geraint, I used iOS Video Encoding to live video broadcast video to rtsp server using the code of "Encoder demo" of "GTCL" site. please help me. When I am using your code, only video gets uploaded using RTSP server not audio. When I am adding audio to this code, then get crash in "onNALU" method. – Name is Nilay Apr 17 '14 at 11:41
  • @NameisNilay i have same issue , did u manage to overcome with this ?? – Mr.G Mar 25 '15 at 13:14