HELP with GLVideo Error (memory leak?) eventually breaking RaspberryPi GPIO connection with sketch.

edited September 2017 in Raspberry PI

Sketch runs great, its acts almost like a zoetrope - We have a bike wheel set up that sends a pulse with each revolution and with that pulse scrubs to the next frame of the video. The problem is that eventually it stops reading after a few minutes. Any ideas why this is happening? Not sure if it is correct usage but using clear() to get rid of any past images that may be hanging around...

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalInput;
import com.pi4j.io.gpio.PinPullResistance;
import com.pi4j.io.gpio.RaspiPin;
import gohai.glvideo.*;

GLMovie video1;
GpioController gpio;
GpioPinDigitalInput button;
float interval = 0;

void setup() {
  size(500, 500, P2D);

  gpio = GpioFactory.getInstance();
  button = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);

  video1 = new GLMovie(this, "wheel_1.mp4");

  video1.play();
  video1.jump(0);
  video1.pause();
}

void draw() {
  //noCursor();


  //whistlesong610pm
  if (button.isHigh()) {
    println(interval);
    clear();
    // background(255);

    interval = interval + 15 ;
    if (video1.available()) {
      video1.read();

      //float moviePosition = map(mouseX, 0, 20000, 0, 3000);
      float moviePosition = interval;


      video1.jump(moviePosition);
      image(video1, 0, 0, width, height);
    }

    if  (interval >= 18000) {
      video1.jump(0);
      interval = 0;
    }
  }
}

Answers

  • edited September 2017
    Errors here:
             GLVideo: omx264dec-omxh264dec0: Could Not configure supporting library.
                    Debugging informaiton: gstomxvideodec.c(1620): gst_omx_video_dec_loop (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodeBin:
                    Unable tom reconfigure output port 
            GLVideo: omx264dec-omxh264dec0: GStreamer encountered a general supporting library error.
            Debuggin informatioin:L gstomxvideodec.c(1527)
            OpenMAX comnpoentnninn error state None (0x00000000)
    
  • edited September 2017 Answer ✓

    This is working like a charm. Use delay() after if (button.isHigh())

    import com.pi4j.io.gpio.GpioController;
    import com.pi4j.io.gpio.GpioFactory;
    import com.pi4j.io.gpio.GpioPinDigitalInput;
    import com.pi4j.io.gpio.PinPullResistance;
    import com.pi4j.io.gpio.RaspiPin;
    import gohai.glvideo.*;
    //whistlesong
    GLMovie video1;
    GpioController gpio;
    GpioPinDigitalInput button;
    int interval = 0;
    
    void setup() {
      size(636, 480, P2D);
    
      gpio = GpioFactory.getInstance();
      button = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);
    
      video1 = new GLMovie(this, "wheel_compressed.mp4");
    
      video1.play();
      video1.jump(0);
      video1.pause();
    }
    
    void draw() {
    
    
      clear();
        noCursor();
    
      //whistlesong610pm
      if (button.isHigh()) {
        delay(100);
        println(interval);
    
        // background(255);
    
        interval = interval + 15 ;
        if (video1.available()) {
          video1.read();
    
          //float moviePosition = map(mouseX, 0, 20000, 0, 3000);
          int moviePosition = interval;
    
    
          video1.jump(moviePosition);
          image(video1, 0, 0, width, height);
    
       if  (interval >= 18200) {
         delay(2000);
         interval = 0;
              video1.jump(0);
    
       }  
        }
    
      }
    }
    
Sign In or Register to comment.