Caveat: After writing this post I realized that it has very little to do with Julia, but people here are super smart, maybe someone will know the answer…
I want to record video from a camera, save it to file, and at the same time have access to the last frame recorded.
VideoIO
is great but its recording functionality is geared towards grabbing frames from a video file, not a live camera (where frames can be lost due to processing lag). I therefore think using ffmpeg directly would be the best way forward. The idea would be to use ffmpeg’s tee functionality (detailed in that previous link) where I split the stream into two, one gets saved to file, one supplies the last recorded frame. Ideally, the frames won’t need to be written to disk, but I’d be able to “grab” them from within Julia.
What I don’t know is
- how to get ffmpeg to spit “the last frame” from a stream, and then
- how to grab that from an open stream in Julia…
This is tricky because the notion of “last frame in stream” is unclear for a stream that is constantly spitting out data.