How can I (quickly) retrieve video frames one at a time, indexed by time/frame number?

edited January 2017 in Library Questions

I am trying to synchronize an animation and video and save the output as a new video. The animation is based on data collected at arbitrary times, roughly at 20 fps (but not close enough to look right at that speed). Therefore I need to tag the data with the time it is collected and display the corresponding frame of the video each time a new data point is loaded.

It is simple to do this using Movie.jump(), but that function takes several seconds to complete, so rendering an entire video is intractably slow. I also tried using the jmcvideo library, but it only works with Processing 1.5.1 and doesn't display frames correctly.

Is there another library or function that can load video frames quickly? Rendering in real-time is acceptable, but any slower will make the whole program useless. Thanks!


  • I'm trying to find a solution to this too.

    I just want to be able to process arbitrary frames of a video file,

    There is currently no way to do this.

    In the Processing examples there is a sketch called Frames:

    Java Examples/Libraries/Video/Movie/Frames.pde

    This uses jump to go to a frame, but it is never frame accurate.

  • Do you need to create this is real time as putting all the data together in real time? One suggestion is to use a lower frameRate and slow down the movie using movie.speed(x)?

    Relevant post:


  • edited March 2017

    Thanks I will see if I can adapt that to seek back and forward one frame.

    Basically I need frame accurate control over a video - the "Frames.pde" demo is supposed to allow you to jump backwards and forwards frame by frame, but it often jumps two frames.

    I guess this is because the jump command accepts only time in seconds, not frame number.

    I tried using long rather than floats, but this did not seem to give any more accuracy.

    I can get complete frame accuracy in processing 1.51, but I need to use 3.x Maybe quicktime was more accurate than gstreamer?

  • I tried that example and I had to set the speed to 0.05 to avoid frame skipping - and this on a quadcore i7 with ssd. I can't see this as a reliable solution so I'm still keen to see if anyone else has solved it!

Sign In or Register to comment.