Problems with video

import processing.video.*;

Movie movie;
void setup() {
  size(320,240);
  movie = new Movie(this, "cat.mov"); 
  movie.loop();
}
void draw() {

  if ( movie.available())
     movie.read();

  image(movie,0,0);
}

The file "cat.mov" is in the right position and program run but sketch don't display nothing. :(

Answers

  • edited April 2015

    Your window is small and your video might be large. Perhaps you are only seeing the top left corner of your video?

    Try:

    import processing.video.*;
    
    Movie movie;
    
    void setup() {
      size(320,240);
      background(255,0,255);
      // Load and play the video in a loop
      movie = new Movie(this, "cat.mov");
      movie.loop();
    }
    
    //void movieEvent(Movie m) {
    //  m.read();
    //}
    
    void draw() {
      if (movie.available()) movie.read();
      image(movie, 0, 0, width, height);
    }
    
  • sketchEs

    @TfGuy44 Thanks for your answer, I tried your solution but how you see to the image nothing has changed

  • edited April 2015
    // forum.processing.org/two/discussion/10541/problems-with-video
    // by GoToLoop (2015/Apr/28)
    
    import processing.video.Movie;
    Movie mv;
    
    void setup() {
      if (mv == null)  (mv = new Movie(this, "cat.mov")).loop();
      while (mv.width == 0)  delay(10);
    
      size(mv.width, mv.height, JAVA2D);
      noLoop();
      frameRate(40);
      background(#FF00FF);
    }
    
    void draw() {
      background(mv);
    }
    
    void movieEvent(Movie m) {
      m.read();
      redraw = true;
    }
    
  • @GoToLoop I've tried your solution but sketch doesn't run; maybe is because the OS is Ubuntu ..

    • I use both Win8.1 & Linux/Ubuntu too!
    • Perhaps the "cat.mov" file is corrupted?
    • Remember that in Linux there are 2 Javas: OpenJDK & Oracle's JDK!
    • Try your luck w/ other Processing versions too, like 1.5.1, 2.0.3, 2.2.1, 3.0a5, etc.
  • The sketch don't run. But, @GoToLoop I've installed only processing on my pc, maybe I've not installed any libreries yet?

  • Probably I should install gstreamer?

  • edited May 2015 Answer ✓

    Well, worth a try... But don't forget to test other Processing versions. Who knows? :-/

  • @GoToLoop sorry but I've accidentally delet your replay. I've tried other version but the problem persists. However I've install some package and now work! :)>-

  • When a post is marked as an "answer", it goes to the top of the page. It's not deleted!
    It'd be nice if you tell us which package(s) got your issue fixed! ~O)

  • I've installed : gstreamer0.10-plugins-ugly
    gstreamer0.10-plugins-ugly-multiverse
    gstreamer0.10-plugins-bad
    gstreamer0.10-plugins-bad-multiverse
    gstreamer0.10-ffmpeg

    But gstream0.10-ffmepg is not available for ubuntu 14.04 so I found this:

    $sudo add-apt-repository ppa:mc3man/trusty-media
    $sudo apt-get update
    $sudo apt-get install gstreamer0.10-ffmpeg

    However I'm not sure which package have fixed my issue :-S

Sign In or Register to comment.