Playing Video on RPi4

Hi!

I tried upgrading a presentation program based on OpenFrameworks. It was running on a RPi2 projecting images and video with some text on a 1024x768 screen. The idea was to move from this to a RPi4 on a HD television (1920x1080). Unfortunately I can’t get video to work.

The original version used ofxOMXPlayer to display the video which worked well. I changed it to the build in ofVideoPlayer but nothing is shown.

The videos play fine using omxplayer, gstreamer and vlc. But not at all in OpenFrameworks. Is there anything that can be done to play a video and draw some text in front of it on a RPi4 using the latest OpenFrameworks?

Thanks!

Kees-Jan

I made a very simple app that should just play a video, after changing the log level it show the following warning:

[warning] ofGstVideoUtils: update(): ofGstVideoUtils not loaded

Currently there’s no way to get accelerated video playback using OF on the RPI4. While you should be able to get ofVideoPlayer working, it will run slowly. Have you got all the GStreamer dependencies installed (the install_dependencies.sh script should do that for you)? I haven’t tested this on RPI4 lately.

Thanks for confirming this.

I did use the install_dependencies.sh script and I can manually play a video through gst-launch-1.0. But somehow it doesn’t play in OF. However, without gpu acceleration it will not be adequate. I’ll have to find another way.

Would it be possible to start to play a video using for example omxplayer from OF and overlay that with a OF ‘window’ with text? I’d appreciate any pointers to get something working. I don’t need any access to pixels, the video is just a backdrop, but it has to play smoothly.

AFAIK on RPI4 the default Windows is using GLFW.
So you could try this:

Open ofAppGLFWWindow.cpp, and add the following line where the other glfwWindowHints are set:

glfwWindowHint(GLFW_DECORATED, false);

Then you could run a fullscreen video behind this app, so that the OF app works like an overlay

Thanks! I’m going to try this later today.

I’ve tried using omxplayer using

system(“omxplayer video.mp4”);

from OF, but it is always showing in front of the OF window.
Tried different glfwWindowHints to get a top-most window, but I wasn’t able to get it working.

Will have to try something else to run my presentations.
Whish I had checked OF and video would still work on RPi4.

You can use xdotool to raise and lower windows. I think it’s either ‘windowactivate’ or ‘windowraise’, and you call that using ofSystem and you need to get the window ID of your OF app, which shouldn’t be too hard.
https://manpages.ubuntu.com/manpages/trusty/man1/xdotool.1.html

Or could you write a shell script to run the video first and then the OF app second?

maybe im wrong but omxplayer will allways draw on top as use their own framebuffer (mmal), in fact you dont even need x11 so dont think is possible to do what you want.

imo your best option is to use a pi3

Thanks for all this!

Unfortunately it doesn’t look like it is going to work on the RPi4 :slightly_frowning_face: