Problems loading movies

Status
Not open for further replies.

ejohns

Member
I keep getting the error "Could not load movie file Rune.mov" whenever I try to play my sketch. Does anyone have any idea what might be causing this? The file, Rune.mov, is located in the data folder within the sketch folder. Also I'm using Processing 2.2.1.

Also the code is very much a hodge-podge of a bunch of different codes so I apologize because it's probably a bit difficult to make it. I'm very new to this. To offer a brief explanation, the sketch creates two windows. One window is a webcam feed that searches for certain colors in the feed. If one of the colors is detected in it, a corresponding video will play in the other window.



Code:
import java.util.HashMap; 
import java.util.ArrayList; 
import java.io.File; 
import java.io.BufferedReader; 
import java.io.PrintWriter; 
import java.io.InputStream; 
import java.io.OutputStream; 
import java.io.IOException; 
import processing.core.*; 
import processing.data.*; 
import processing.event.*; 
import processing.opengl.*; 



import javax.swing.*; 
SecondApplet s;


import processing.video.*;
Movie Rune1;

Capture video;

// Colors being tracked
color trackColor2 = color (255, 0, 0);
color trackColor3 = color (0, 0, 255);
  float worldRecord1 = 500;
  float worldRecord2 = 500;
  float worldRecord3 = 500;
  float worldRecord4 = 500;
  float worldRecord5 = 500;
  float worldRecord6 = 500;

public void setup() {
  
Rune1 = new Movie (this, "Rune1.mov");
     
  
  frameRate (200);
  size(1280, 720);
  PFrame f = new PFrame(width, height);
  frame.setTitle("first window");
  f.setTitle("second window");
  
  
//Changes WebCam source

  video = new Capture(this, "name=Logitech HD Webcam C615,size=1280x720,fps=30");

 video.start(); 
 // Start off tracking for red
 trackColor2 = color(255,41,3);
 smooth();
}
public void draw() {
 // Capture and display the video
 if (video.available()) {
   video.read();
}
 video.loadPixels();
 image(video,0,0);
 
  // Before we begin searching, the "world record" for closest color is set to a high number that is easy for the first pixel to beat.
  float worldRecord0 = 500;
 

 // XY coordinate of closest color
 int closestX = 0;
 int closestY = 0;

 // Begin loop to walk through every pixel
 for (int x = 0; x < video.width; x ++ ) {
   for (int y = 0; y < video.height; y ++ ) {
     int loc = x + y*video.width;
     // What is current color
     color currentColor = video.pixels[loc];
      float r1 = red(currentColor);
      float g1 = green(currentColor);
      float b1 = blue(currentColor);
      

      float r3 = red(trackColor2);
      float g3 = green(trackColor2);
      float b3 = blue(trackColor2);
      
      float r4 = red(trackColor3);
      float g4 = green(trackColor3);
      float b4 = blue(trackColor3);    


     // Using euclidean distance to compare colors
     float d2 = dist(r1,g1,b1,r3,g3,b3); // We are using the dist( ) function to compare the current color with the color we are tracking.

     float d3 = dist(r1,g1,b1,r4,g4,b4);

     // If current color is more similar to tracked color than
     //closest color, save current location and current difference
     if (d2 < worldRecord1) {
        worldRecord1 = d2;
      }
      
     if (d3 < worldRecord2) {
        worldRecord2 = d3;
      }
           
   }
 }

 // We only consider the color found if its color distance is less than 10.
 // This threshold of 10 is arbitrary and you can adjust this number depending on how accurate you require the tracking to be.

}

public class PFrame extends JFrame {
  public PFrame(int width, int height) {
    setBounds(100, 100, width, height);
    s = new SecondApplet();
    add(s);
    s.init();
    show();
  }
}
public class SecondApplet extends PApplet {
  int ghostX, ghostY;
  public void setup() {

    
    background(0);
    noStroke();
  }

  public void draw() {
    background(200);
    fill(0);

    
    
    //the following define what happens if colors are detected
     if (worldRecord1 < 50) {
             Rune1 = new Movie (this, "Rune1.mov");

             
            Rune1.play();
            image(Rune1, mouseX, mouseY);   
       
      }   
    
  }
  public void setGhostCursor(int ghostX, int ghostY) {
    this.ghostX = ghostX;
    this.ghostY = ghostY;
    

  }
}
 
Have you tried putting the explicit full file location in the new Movie(this, xx)?

I assume you mean like the following (sorry I'm very new to Processing):

Code:
        Rune1 = new Movie (this, "C:\Users\I\Desktop\WORKING3\data\Rune1.mov");


I tried using this, but got the following error:

processing.app.SketchException: unexpected char: 'U'
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:386)
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:192)
at processing.mode.java.JavaBuild.build(JavaBuild.java:151)
at processing.mode.java.JavaBuild.build(JavaBuild.java:130)
at processing.mode.java.JavaMode.handleRun(JavaMode.java:120)
at processing.mode.java.JavaEditor$23.run(JavaEditor.java:697)
at java.lang.Thread.run(Unknown Source)
 
is if forward slash or back slash in the file path naming, i think it is the other way to way you have in your code snippet?
Is the file name Rune.mov or Rune1.mov? capitalisation and number?.
 
is if forward slash or back slash in the file path naming, i think it is the other way to way you have in your code snippet?
Is the file name Rune.mov or Rune1.mov? capitalisation and number?.

I switched the slash directions (Thank you! I completely overlooked which way they were facing, I had just copied the path from the file properties) and switched the filetype of the video from .mov to .avi. The sketch now runs, but only the audio of the video plays, not the video itself. Here's the code I'm working with now:
Code:
import java.util.HashMap; 
import java.util.ArrayList; 
import java.io.File; 
import java.io.BufferedReader; 
import java.io.PrintWriter; 
import java.io.InputStream; 
import java.io.OutputStream; 
import java.io.IOException; 
import processing.core.*; 
import processing.data.*; 
import processing.event.*; 
import processing.opengl.*; 

import javax.swing.*; 
SecondApplet s;


import processing.video.*;
Movie Rune1;

Capture video;

// Colors being tracked
color trackColor2 = color (255, 0, 0);
color trackColor3 = color (0, 0, 255);
  float worldRecord1 = 500;
  float worldRecord2 = 500;
  float worldRecord3 = 500;
  float worldRecord4 = 500;
  float worldRecord5 = 500;
  float worldRecord6 = 500;

public void setup() {
  
        Rune1 = new Movie (this, "C:/Users/I/Desktop/WORKING3/data/Rune1.avi");
 
  
  frameRate (200);
  size(1280, 720);
  
 
  
  PFrame f = new PFrame(width, height);
  frame.setTitle("first window");
  f.setTitle("second window");
  
  
  
  
//Changes WebCam source
  
  video = new Capture(this, "name=Logitech HD Webcam C615,size=1280x720,fps=30");


 video.start(); 
 // Start off tracking for red
 trackColor2 = color(255,41,3);
 smooth();
}
public void draw() {
 // Capture and display the video
 if (video.available()) {
   video.read();
}
 video.loadPixels();
 image(video,0,0);
 
  // Before we begin searching, the "world record" for closest color is set to a high number that is easy for the first pixel to beat.
  float worldRecord0 = 500;
 

 // XY coordinate of closest color
 int closestX = 0;
 int closestY = 0;

 // Begin loop to walk through every pixel
 for (int x = 0; x < video.width; x ++ ) {
   for (int y = 0; y < video.height; y ++ ) {
     int loc = x + y*video.width;
     // What is current color
     color currentColor = video.pixels[loc];
      float r1 = red(currentColor);
      float g1 = green(currentColor);
      float b1 = blue(currentColor);
      

      float r3 = red(trackColor2);
      float g3 = green(trackColor2);
      float b3 = blue(trackColor2);
      
      float r4 = red(trackColor3);
      float g4 = green(trackColor3);
      float b4 = blue(trackColor3);    


     // Using euclidean distance to compare colors
     float d2 = dist(r1,g1,b1,r3,g3,b3); // We are using the dist( ) function to compare the current color with the color we are tracking.

     float d3 = dist(r1,g1,b1,r4,g4,b4);

     // If current color is more similar to tracked color than
     //closest color, save current location and current difference
     if (d2 < worldRecord1) {
        worldRecord1 = d2;
      }
      
     if (d3 < worldRecord2) {
        worldRecord2 = d3;
      }     
      
   }
 }

 // We only consider the color found if its color distance is less than 10.
 // This threshold of 10 is arbitrary and you can adjust this number depending on how accurate you require the tracking to be.

}

public class PFrame extends JFrame {
  public PFrame(int width, int height) {
    setBounds(100, 100, width, height);
    s = new SecondApplet();
    add(s);
    s.init();
    show();
  }
}
public class SecondApplet extends PApplet {
  int ghostX, ghostY;
  public void setup() {

    
    background(0);
    noStroke();
  }

  public void draw() {
    
    //the following define what happens if colors are detected
     if (worldRecord1 < 50) {
          
            Rune1.loop();
            image(Rune1, 1000, 563);
      
      }
        
  }
  public void setGhostCursor(int ghostX, int ghostY) {
    this.ghostX = ghostX;
    this.ghostY = ghostY;
    
    

 
  }
}
 
Glad the movie now runs. Previous Processing issues relating to sound but no video were related to gstreamer, check the answer in post #6 here https://forum.pjrc.com/threads/25329-movie2serial-sound-but-no-video?highlight=processing+sound

"I replaced the jar files gstreamer-java and jna in \modes\java\libraries\video\library in Processing 2.1.1 by similar files from processing 1.50 and movie2serial now works."

EDIT: Although, before changing any files, try and run the processing basic movie sketch and see if it works. The movie example is in the folder File>Libraries>Video>Movie and use the simplest which is the loop() example. If this works, then something about your calls code is upsetting things.

The simplest is:
Code:
/**
 * Loop. 
 * 
 * Shows how to load and play a QuickTime movie file.  
 *
 */

import processing.video.*;

Movie movie;

void setup() {
  size(640, 360);
  background(0);
  // Load and play the video in a loop
  movie = new Movie(this, "/Users/admin/Documents/Processing/laural.mov");
  movie.loop();
}

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

void draw() {
  //if (movie.available() == true) {
  //  movie.read(); 
  //}
  image(movie, 0, 0, width, height);
}
 
Last edited:
Have the same "Could not load movie problem" with Processing 2.2.1

Here are the main changes that I tried.:
myMovie = new Movie(this, "C:\Users\nduc\Desktop\GglWorksDev\SoftWare\Arduino\movie2serial\bird.avi");

Or myMovie = new Movie(this, "C:/Users/nduc/Desktop/GglWorksDev/SoftWare/Arduino/movie2serial/bird.avi");
or
myMovie = new Movie(this, "bird.avi");

or myMovie = new Movie(this, "\bird.avi");

or myMovie = new Movie(this, "C:\Users\nduc\Desktop\GglWorksDev\SoftWare\Arduino\movie2serial\Hail_inSJ.MOV");

I tried every things that ejohns did. Just does not work for me. appreciate any help I can get.


btw, if I used processing 3.5.3 before this 2.2.1. But processing 3.5.3 could not see my COM port.
 
Was able to run using Processing 3.5.3 but still cannot load the movie

Here are the main changes that I tried.:
myMovie = new Movie(this, "C:\Users\nduc\Desktop\GglWorksDev\SoftWare\Arduino\movie2serial\bird.avi");

Or myMovie = new Movie(this, "C:/Users/nduc/Desktop/GglWorksDev/SoftWare/Arduino/movie2serial/bird.avi");
or
myMovie = new Movie(this, "bird.avi");

or myMovie = new Movie(this, "\bird.avi");

or myMovie = new Movie(this, "C:\Users\nduc\Desktop\GglWorksDev\SoftWare\Arduino\movie2serial\Hail_inSJ.MOV");

I tried every things that ejohns did. Just does not work for me. appreciate any help I can get.
 

Attachments

  • error.jpg
    error.jpg
    127.5 KB · Views: 128
Last edited:
Status
Not open for further replies.
Back
Top