User avatar
pescew
Posts: 2
Joined: Wed Sep 11, 2019 11:25 am

Render pi3d over omxplayer on pi4

Tue Dec 10, 2019 10:03 pm

Using pi3d v2.33 and "use_glx=True" I'm able to display pi3d with transparency enabled on the pi4, but omxplayer is always rendered overtop the pi3d display.

If I set "omxplayer --layer -128" it does not display at all. "omxplayer --layer -127" displays, but again overtop the pi3d window.

Results are the same whether X11 desktop is enabled or disabled.

Does anyone have experience with this on the pi4? I am new to pi3d, so I assume I'm just overlooking something simple.

Code: Select all

DISPLAY = pi3d.Display.create(x=100, y=100, w=1280, h=720, layer=2, frames_per_second=60, background=(0.0,0.0,0.25,0.25), use_glx=True, window_title='pi3d test')

omxprocess = subprocess.Popen(['omxplayer',VID_FILE,'--loop','--no-osd','--win','100,100,500,500','--layer','-127'],stdin=subprocess.PIPE,stdout=None,stderr=None,bufsize=0)

User avatar
paddyg
Posts: 2464
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Render pi3d over omxplayer on pi4

Tue Dec 10, 2019 10:45 pm

Ages since I've looked at omxplayer. Does it have an option to make it play in an X11 window? It sounds like it's playing directly to dispmanx and it's no longer possible (well not very easy - aka I don't know how) to run OpenGL to dispanx. I will have a look around and see what I can find - doesn't look hopeful on first skim.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
pescew
Posts: 2
Joined: Wed Sep 11, 2019 11:25 am

Re: Render pi3d over omxplayer on pi4

Wed Dec 11, 2019 12:50 am

Thanks for the fast reply Paddy,

After some searching it looks like it's definitely outputting to dispmanx which is handled differently on the pi4?

Couldn't find anything official, so I compiled this x11 wrapper for omxplayer, but the resulting video was still outputting to dispmanx:

https://github.com/padgettr/xomxplayer

I ended up abandoning omxplayer completely. From what I've read ffmpeg should support hw-decoding on the pi4, so I'm using ffplay instead. Pi3d is able to draw overtop the ffplay window without issue:

Code: Select all

ffprocess = subprocess.Popen(['ffplay',VID_FILE,'-loop','0','-noborder','-an','-left','100','-top','100','-x','400','-y','400','-loglevel','quiet'],stdin=subprocess.PIPE,stdout=None,stderr=None,bufsize=0)

DISPLAY = pi3d.Display.create(x=100, y=100, w=1280, h=720, layer=2, frames_per_second=60, background=(0.0,0.0,0.25,0.25), use_glx=True, window_title='pi3d test')

User avatar
paddyg
Posts: 2464
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Render pi3d over omxplayer on pi4

Wed Dec 11, 2019 8:38 am

@pescew Glad that you seem to be able to find a way round the issue; I was going to suggest VLC or suchlike. I think everything (including omxplayer) uses ffmpeg inside (it's a very comprehensive, handy library) so you probably always get that, but it probably cuts out a bit of processing overhead to output directly without having to go via X so that's what omxplayer now does for efficiency.

However I would like people to be able to use omxplayer: it occurred to me that it might be possible if pi3d is run in an X11 window without all the rest of the desktop. It's the desktop window that stops you being able to see omxplayer when you put it on layer < -127. I think it's possible to start pi3d from the command line (without the desktop running) by using xinit. Something along the lines of

Code: Select all

sudo xinit /usr/bin/python3 /home/pi/pi3d_demos/Earth.py :0 -- -s off -dpms -s noblank
(taken from Wolfgang Maennel's careful instructions) I will have a play with that now and see what happens.

Let me know if you run into further issues.

Paddy

EDIT PS - tried running without desktop but using xinit and omxplayer is still either on top of everything or not visible - presumably the command line terminal is also on a dispmanx layer. Can't see any way to start X11 on a specific dispmanx layer but will continue looking.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

Return to “Python”