Can't play video on 3.3.5 on RPi 3

edited June 2017 in Raspberry PI

I can't get videos playing in Processing 3.3.5 on my Raspberry Pi 3. It's a new install. Everything updated and upgraded.

I tried the loop example from the video library and only get a black screen. This shows the following error (Processing core video:1610): GStreamer-CRITICAL **: Trying to dispose element Movie Player, but it is in READY instead of the NULL state. You need to explicitly set elements to the NULL state before dropping the final reference, to allow them to clean up. This problem may also be caused by a refcounting bug in the application or some element.

I tried a sketch that was working on my Mac with 3.3.5, but also produces black screen, this time with no error.

Outside of Processing, in the command line, I can run omxplayer clip1.mp4 and the clip plays properly. (It also tells me that the clip uses -h264, would that be a problem?

What do I need to get Processing to play the clips?

Thanks

Tagged:

Answers

  • Tagging @gohai.

    Kf

  • @grhabyt You're using the (regular) Video library? If so, give the GL Video library a try...

  • Thanks. I just did. It took me a moment to find a list of the methods to get it to work (eg close() instead of stop(), etc), but the GL library got most of what I need going.

    My only problem now is getting the video to play in fullScreen without the menu bar showing. Any suggestions?

    Thanks

  • Just to be clear,
    fullScreen(P2D);
    doesn't get rid of the Raspberry Pi menu bar, and

    fullScreen();
    makes the Pi lock up

  • Which distribution are you using?

  • My setup is
    Raspbian Jessie (kernel 4.9.28 -v7+)
    Raspberry Pi 3 Model B v 1.2
    Processing 3.3.5 (ARMv6hr)
    GLvideo was downloaded yesterday from github

  • @grhabyt You need the P2D or P3D renderer for the GL Video library to work - so it's not a bug that plain fullScreen() won't work. But I am not seeing the menu bar myself, when I launch a fullScreen P2D sketch...

  • Even when I take the SingleVideo example and replace
    size(560,406, P2D);
    with
    fullScreen(P2D);
    I get the menu bar. Same with fullScreen(P3D);
    I'm using the HDMI-out from the RPi3 to the HDMI-in of a very standard Acer H213H monitor (1920x1080).
    Any suggestions?

  • Just to close this. I replicated the problem with another RPi and a fresh install of Raspbian on June 29. However when I tried again two weeks ago with the new 5 July 2017 image of Jessie, the problem went away.

  • Great it is working. Thanks for following up in your post and sharing your solution.

    Kf

  • Can you tell me how you got this to work? I have imported the GLvideo library into my sketch but still not working

  • edited September 2017

    I got it working with the examples here: https://github.com/gohai/processing-glvideo

    Thanks for going through this!

  • However, Would anyone be able to tell me why this code is now not working? I get 2 errors both on mov.frameRate at the bottom of this code

    /**
     * Frames 
     * by Andres Colubri. 
     * 
     * Moves through the video one frame at the time by using the
     * arrow keys. It estimates the frame counts using the framerate
     * of the movie file, so it might not be exact in some cases.
     */
    
    import gohai.glvideo.*;
    import processing.video.*;
    
    
    GLMovie mov;
    int newFrame = 0;
    
    void setup() {
      size(640, 360, P3D);
      background(0);
      // Load and set the video to play. Setting the video 
      // in play mode is needed so at least one frame is read
      // and we can get duration, size and other information from
      // the video stream. 
      mov = new GLMovie(this, "transit.mov");  
    
      // Pausing the video at the first frame. 
      mov.play();
      mov.jump(0);
      mov.pause();
    }
    
    void movieEvent(GLMovie m) {
      m.read();
    }
    
    void draw() {
      background(0);
       if (mov.available()) {
        mov.read();
      }
    
      image(mov, 0, 0, width, height);
    
      text(getFrame() + " / " + (getLength() - 1), 10, 30);
    }
    
    void keyPressed() {
      if (key == CODED) {
        if (keyCode == LEFT) {
          if (0 < newFrame) newFrame--; 
        } else if (keyCode == RIGHT) {
          if (newFrame < getLength() - 1) newFrame++;
        }
      } 
      setFrame(newFrame);  
    }
    
    int getFrame() {    
      return ceil(mov.time() * 30) - 1;
    }
    
    void setFrame(int n) {
      mov.play();
    
      // The duration of a single frame:
      float frameDuration = 1.0 / mov.frameRate);
    
      // We move to the middle of the frame by adding 0.5:
      float where = (n + 0.5) * frameDuration; 
    
      // Taking into account border effects:
      float diff = mov.duration() - where;
      if (diff < 0) {
        where += diff - 0.25 * frameDuration;
      }
    
      mov.jump(where);
      mov.pause();  
    }  
    
    int getLength() {
      return int(mov.duration() * mov.frameRate);
    }
    
  • Instead of a property mov.frameRate, I think you need a function mov.frameRate()

  • in the end mov.framerate() worked for me

  • Hi @gohai,

    I can't make the SingleVideo example work. I'm on RPI3 model B, Rasbian and Processing 3.3.7 I download GLVideo from Library Manager.

    KMS OpenGL driver is not allowed.

    When I run the example, only black frame appears. Boolean video.available() seems to never be true. When I close the sketch, the console prints :

    EGLDisplayUtil.EGLDisplays: Shutdown (open: 1) EGLDisplayUtil: Open EGL Display Connections: 1 EGLDisplayUtil: Open[0]: 0x1: EGLDisplayRef[0x1: refCnt 2]

    Do you have any advise ?

    Thanks,

    Yves

  • Thanks a lot for your reactivity, i'll try and let you know !

Sign In or Register to comment.