Code looks fine, no error shown, but video not playing !!

hi,

I am trying to run simple processing program in eclipse to play video. this is the code:

import processing.core.*; import processing.video.*;

public class BackgroundSubtraction extends PApplet {

Movie video;

public void setup(){
     size(720,480);
      video = new Movie(this, "/home/gurinderbeer/Desktop/new/Gurbinder/data/mv2_002.avi");
      video.loop();
      video.play();
}

public void draw() {
    image(video, 0, 0); 
}

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

}

when I run the program, it gives no error. Applet pops-up but video is not playing in applet. I can hear the audio when i run the program, but no visuals on applet. Can anyone please help...! Thanks

Tagged:

Answers

  • Maybe you could try putting video.loop() and video.play() in public void draw(){, and if that doesn't work, try moving only video.play() to public void draw(){ , if STILL no, then try putting video.play() before video.loop() in each, what you have and the changes.

  • code looks fine, i would try another video.

    if you're getting sound but not picture then maybe the avi is using a video codec that the library doesn't like.

  • I have never worked with video or eclipse before, so this might be a stupid question, but don't you have to run public void movieEvent(movieM){ in draw?

  • edited February 2016

    i believe not. the 'this' as first argument in the Movie constructor is the class containing a callback method movieEvent(). the Movie will call this method when it's ready.

    that code is straight out of the reference:
    https://processing.org/reference/libraries/video/Movie.html
    https://processing.org/reference/libraries/video/movieEvent_.html

  • edited February 2016

    The 'this' as first argument in the Movie's constructor is the class containing a callback method movieEvent().

    It's not any class. Gotta be some PApplet instance! :-B

    public Movie(PApplet parent, String filename) {
      super(0, 0, RGB);
      initGStreamer(parent, filename);
    }
    
    // ...
    
    protected void initGStreamer(PApplet parent, String filename) {
      // ...
    }
    
  • Thanks everyone for your help. code works fine now. the ffmpeg plugin for gstreamer was required...

Sign In or Register to comment.