Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recording Audio and Video using AVFoundation frame by frame

How to record audio and video using AVFoundation frame by frame in iOS4?

like image 533
sach Avatar asked Nov 08 '11 04:11

sach


2 Answers

The AVCamDemo you mention is close to what you need to do and should be able to use that as reference, among those these are the following classes you need to use in order to achive what you are trying... All the classes are part of AVFoundation, you need

  • AVCaptureVideoDataOutput and AVCaptutureAudioDataOutput - use these classes to get raw samples from the video camera and the microphone

  • Use AVAssetWriter and AVAssetWriterInput in order to encode the raw samples into a file - the following sample mac OS X project shows how to use these classes (the sample should work for ios too), however they use an AVAssetReader for input (it reencodes a movie file) instead of the Camera and microphone... You can use the outputs mentioned above as the input in your case to write what you want

That should be all you need in order to achieve what you want to do...

Heres a link showing how to use VideoDataOutput

Hope it helps

like image 150
Daniel Avatar answered Nov 10 '22 01:11

Daniel


If you are a registered developer, look at the videos from the 2011 WWDC (which you can find by searching in the developer portal). There are two sessions relating to AVFoundation. There was also some sample code from one of the WWDC sessions, which was extremely useful.

like image 39
grfryling Avatar answered Nov 09 '22 23:11

grfryling