For better or worse I’m trying to record a videostream to disk on Windows. After finally achieving the basics and recording a test animation to a movie file to disk ( see issue here ), now I need to do it using the camera stream in real-time. I’m using a Mako IP camera from AVT and wrapping their Vimba SDK. I have a stream coming in at ~30fps and can convert each frame from a surface to texture and draw to the screen without any visible lag or delay. However, when I try recording the frames to disk using Quicktime’s addFrame() method in the main update() loop, the framerate drops significantly. I tried creating a vector to temporarily store the frames in memory until I’m ready to write, but the frames are 2064x1544 and I run out of memory within a few seconds and the app crashes.
The only way I can think to get around this issue is multithreading… In pesudocode:
get frame from camera
convert frame to surface
spawn worker on detached thread
call addFrame() on thread
Is this logic flawed? I’ve tried looking through the Flickr multithreaded example, but I’m not trying to load/save files to disk necessarily, instead I’m trying to add them to the qtime::MovieWriter instance. I assume I don’t need to use a concurrentCircularBuffer because I’m not trying to communicate between the worker threads and the main GL context.