Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Problems loading movies

  1. #1
    Junior Member
    Join Date
    Dec 2015
    Posts
    6

    Problems loading movies

    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;
        
    
      }
    }

  2. #2
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    912
    Have you tried putting the explicit full file location in the new Movie(this, xx)?

  3. #3
    Junior Member
    Join Date
    Dec 2015
    Posts
    6
    Quote Originally Posted by mortonkopf View Post
    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(JavaBuil d.java:386)
    at processing.mode.java.JavaBuild.preprocess(JavaBuil d.java:192)
    at processing.mode.java.JavaBuild.build(JavaBuild.jav a:151)
    at processing.mode.java.JavaBuild.build(JavaBuild.jav a:130)
    at processing.mode.java.JavaMode.handleRun(JavaMode.j ava:120)
    at processing.mode.java.JavaEditor$23.run(JavaEditor. java:697)
    at java.lang.Thread.run(Unknown Source)

  4. #4
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    912
    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?.

  5. #5
    Junior Member
    Join Date
    Dec 2015
    Posts
    6
    Quote Originally Posted by mortonkopf View Post
    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;
        
        
    
     
      }
    }

  6. #6
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    912
    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...ocessing+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 by mortonkopf; 12-03-2015 at 12:04 PM.

  7. #7
    Junior Member
    Join Date
    Dec 2015
    Posts
    6
    Got it working! Thanks so much!

  8. #8
    Junior Member
    Join Date
    May 2019
    Posts
    2

    Question 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\Arduin o\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\Arduin o\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.

  9. #9
    Junior Member
    Join Date
    May 2019
    Posts
    2

    Was able to run using Processing 3.5.3 but still cannot load the movie

    [QUOTE=DucDoug;206360]Here are the main changes that I tried.:
    myMovie = new Movie(this, "C:\Users\nduc\Desktop\GglWorksDev\SoftWare\Arduin o\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\Arduin o\movie2serial\Hail_inSJ.MOV");

    I tried every things that ejohns did. Just does not work for me. appreciate any help I can get.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	error.jpg 
Views:	12 
Size:	127.5 KB 
ID:	16665  
    Last edited by DucDoug; 05-21-2019 at 01:10 AM. Reason: Add screen shot (with red circle indicated the only changes)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •