We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Processing skips frames... [solved]
Page Index Toggle Pages: 1
Processing skips frames... [solved] (Read 652 times)
Processing skips frames... [solved]
Jul 16th, 2008, 10:12am
 
Hi everebody
I'm having a problem with my processing sketch (in Eclipse with linux Ubuntu). I've just finished a "white glove tracking" ( http://www.whiteglovetracking.com/ ) sketch and in order to export it as a video I'm trying to save each frames (60fps).

It seems to work but I get only about 8000 frames if I do save them in TGA (about 2 gigos !) and it's worst with PNG files (about 2000). The white gloves data have 10,060 frames...

I saw on the discourse that the 1.6 java may drop frames but event with the 1.5 sdk it drops frames too...

As I'm on linux I use the GSVideo library.

Is there a another way to export all frames ?
Re: Processing skips frames...
Reply #1 - Jul 17th, 2008, 9:25am
 
Ok, I reply to mySelf but...

I tried to draw my frames in PGraphics instances but it gives the same result... I only have about 6000 TGA.


Re: Processing skips frames...
Reply #2 - Jul 17th, 2008, 11:41am
 
There is something I don't get, but maybe I will just show my ignorance of video stuff... Wink
My question is: why do you try to work at 60fps if that's for video output? I thought standard video framerate was 25fps.
Not sure if such lowering would be enough, but it would be already a step in the right direction.

Next, I was about to advice to use QuickTime video library instead, but I see it isn't supported on Linux. Sad I had good results exporting videos with it: the visible framerate drops a lot, as the computer has to write megabytes to the disk, but result video has the wanted framerate.
I don't know the GSVideo library, how it works. Do you have to export each frame as image before making the movie? That means you don't use this library in Processing itself, right? If so, do you need to draw and export the frames in real time?

Sorry for the naive questions, experience shows that such dumb questions might trigger some ideas when trying to answer them... Wink
Re: Processing skips frames...
Reply #3 - Jul 17th, 2008, 1:53pm
 
Hi Philho !

GSvideo "record function" isn't available yet. I use it to grab frames from the video. There's no problem with that, I can easily play it and draw a lot of thing in realtime and I assume having near to 60fps.

All I need is to export this video at 60fps and no matter how long it takes or the way I go. My problem isn't to keep a constant framerate or displaying the video in realtime while I'm exporting it, I just want all the 10,060 frames.

To save cpu charge I tried to draw things (video + geometry) only in memory with PGraphics but I lose frames too...

In order to make a Video I try to export each frames and then import them in a movie editor software like cinelerra, kino... and finally export it in theora/ogg. Working with free softwares is not so easy Wink

I don't know why I lose those frames... but thanks for your answer ! I'm not alone in this forum Wink

I'll post the source code soon... I'm at work.
Re: Processing skips frames...
Reply #4 - Jul 17th, 2008, 3:05pm
 
i think you're mixing up the idea of "skipped frames". what other people have seen is certain instances where running code visually skips because it doesn't draw to the screen properly before a new frame starts. that's different from your case because you're saving the images to a file, which isn't affected by the rate at which the screen updates.

more likely, if you're using video/movie input, your machine cannot save files quickly enough, while also handling the video input. this results in missing frames in your output, because no matter how long the sketch is taking to process each frame of video, the video input continues.

to improve things, you might try writing the output with moviemaker, which may be more efficient than saving multi-megabyte uncompressed TGA files.

but fundamentally, you need to set it up so that you're only processing a single frame of input per each trip through draw(), and calling saveFrame() (or MovieMaker's add() method) at the end of each draw().
Re: Processing skips frames...
Reply #5 - Jul 17th, 2008, 5:08pm
 
Yeah ok ! I understand...
thanks for the explanation it seems obvious now !

I have to work frame by frame and not at my video fps...
Re: Processing skips frames... [solved]
Reply #6 - Jul 17th, 2008, 11:57pm
 
yo, thanks a lot I finaly made it Wink
Here's the final result... not so complicated but fun to do !

http://www.vimeo.com/1359844
Page Index Toggle Pages: 1