How To Easily Save The Last Few Seconds Of A Captured Video (AVCaptureSession)

I want the user to record 240 FPS continuous video using the iPhone 6. When the user presses a button, he should just save the last 10 seconds to the file system for later enjoyment.

How can I achieve this? I haven't found a good answer to this problem.

I am playing with AVCaptureSession

and AVCaptureMovieFileOutput

, which automatically writes the stream to disk.

  • One approach is to not use AVCaptureMovieFileOutput

    and create a circular buffer in memory, and when a button is pressed, just save those 10 seconds to disk. Achievable with NSData

    ?
  • The second approach I can think of is to just use it AVCaptureMovieFileOutput

    as is, but when the button is pressed, just hold the last 10 seconds and disable the rest to save space.

I currently don't know how I can do either of these two approaches. Can anyone point me in the right direction?

+3


source to share





All Articles