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.
Page Index Toggle Pages: 1
What to do to process a movie file (Read 824 times)
What to do to process a movie file
Oct 22nd, 2006, 7:37pm
 
Hello

I'd like to create big still images with processing using movies as a database.

I have used differents techniques before settling with processing.
Now, before i can use processing to do what I want I must extract each frame to a file (using virtualdub) and it's time and space consuming. Furthermore windows don't deal very well when you put many files (more than a few 10.000) in one folder.

So, is there a way to be able to directly load movie frames in processing ? I have seen that it's possible to load .mov with some libraries but will they work on more standard movie formats (divx, xvid or mpeg2) ?

I have tried to look on JMyron and LibCV but I keep getting lost as I don't have any programming experiences.
As LibCV use JMF I tried to see if that could be of some use and i seem to be able to open .avi files ( http://java.sun.com/products/java-media/jmf/2.1.1/formats.html ) but I don't understand how (if it's possible).

In short : could I load movies (.avi ou mpeg2) frames directly in processing or is there another way to use theses data in processing ?
Re: What to do to process a movie file
Reply #1 - Oct 22nd, 2006, 9:34pm
 
Processing has one video library for .mov only. JMyron and LibCV are for capturing data from web cams and video cameras.

Open your version of Procesing. Goto the menu bar and select:

File > Sketchbook > Examples > Library-Video > Movie

This loads a sketch with a .mov file for you to work on. From the menu bar goto Sketch > Show Sketch Folder or press Ctrl+K. Note that the .mov file is in a folder called "data". The .mov you will work on is going to go here.

Replace the code you have loaded with this:
Code:

import processing.video.*;
Movie myMovie;
float pos = 0.0;
float step = 1.0 / 24;

void setup()
{
size(200, 200);
background(0);
// Load and play the video in a loop
myMovie = new Movie(this, "station.mov");
myMovie.loop();
// The pause() command is problematic for frame advance,
// use this syntax instead.
myMovie.speed(0);
}

void movieEvent(Movie myMovie) {
myMovie.read();
}

void draw() {
image(myMovie, 20, 40);
}

void mousePressed(){
// This code advances the movie by 1/24 of a second.
pos = (pos + step) % myMovie.duration();
myMovie.jump(pos);
}

Use your 3rd party software to convert your movies to .mov or export them as frames and tackle the frames one by one.

Few people have tackled .mov file analysis in Processing but if you look up projects involving web-cams you will find yourself at the precipice of a chasm full of projects. Hands up who's done a Processing web-cam project (*sea of hands go up).

Shiffman has a library for recording sketches as movies if you want to export back out as a movie.
Re: What to do to process a movie file
Reply #2 - Oct 23rd, 2006, 7:56pm
 
Well I hoped there was other ways.
Anyway thanks for your answer and code, I'll try it.
Page Index Toggle Pages: 1