I am trying to write a video cache like algorithm that could save a video file starting from 60 seconds before you press record, or when record is triggered from some sensor input.
It would work something like this:
- Video is constantly recording and saving video to a place in memory.
- This area of memory holds 60 seconds of video.
- When the memory fills up, it dumps the oldest frames.
- When record is triggered, it starts outputting the video to a file with the buffered video concatenated at the beginning.
I've messed around with AVCaptureSession, and can save video from a camera source, but I don't know where to start with the buffering. Any thoughts would be very helpful.