capture frame-rate slows down

Hi guys.

A brief introduction: I recently bought a Canon HV40 Legria to eventually switch off my webcam (in my experience, frame rate with webcam is too much flickle). I made a test application in order to understand which is the frame rate of the camcorder, in order to set the correct frames duration in the encoding procedure (using MemoryMovieMaker), and according to my test, frame rate is about 24 fps.

Now, I made some capturing and I got a bad surprise: if my capturing lasts some minutes, my encoded video file lasts some minutes less. And that’s because…the frame rate is NOT constant! What I mean is that the grabber grabs less and less frames, while the encoder always put the same frame duration, since I assumed that is constant.

By logging the capturing to a file, I discovered that the frame rate seriously goes down while I’m recording. First, a new frame is captured every 33 ms (update rate is 30 fps), apart from when a new frame is not found (1 frame on 6 is captured every 66 ms). Then the rate progressively slows down, up to 5 frames per second after a few minutes!! Or in other words, update() is called less and less frequently. Hey, this happens just when I’m encoding!

Why does it happen? What can slow down performance so drastically? Please, help. I’m lost :shock:

Hi guys,

do you think it can be due to the frame compression technique (codec)? If so, how to manage that? Thanks again,

…and sorry, I forgot an important clue: my camera width and height are 720x576 pixels (coming from 576i DV format). Anyone?

hmm… can you possibly post the code as a zip? I wonder if there’s some other problem there, like a memory leak.

also, if you save every frame to an image, ie:

myImage.saveImage(“img_” + ofToString(counter) “.png”);

do you get similar slow down?

take care,

Hi Zach,

first, thanks for your support. [attachment=0:22wisd0c]Here[/attachment:22wisd0c] there’s a .zip file containing both my project source directory and a binary directory that just contains the settings file (settings.xml).

For what concerning saving each frame as images, yes, I get the same slow down effect (even stronger): with 25fps application rate, after a few seconds update() is called two or three times per second.



No solution for me? :frowning: