Record audio and video using AVFoundation per frame

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

+6
source share
2 answers

The AVCamDemo you are talking about is close to what you need to do, and should be able to use this as a link, among which are the following classes that you need to use to achieve what you are trying ... All classes are part of AVFoundation , you need

  • AVCaptureVideoDataOutput and AVCaptutureAudioDataOutput - use these classes to get raw samples from your camcorder and microphone

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

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

Here is a link showing how to use VideoDataOutput

Hope this helps

+5
source

If you are a registered developer, watch the 2011 WWDC video (which you can find by searching the developer portal). There are two sessions dedicated to AVFoundation. There was also sample code from one of the WWDC sessions, which was extremely useful.

+3
source

Source: https://habr.com/ru/post/900994/


All Articles