Hello_Video + overlay

Anything and everything about programming graphics with Ultibo
pjde
Posts: 425
Joined: Tue Feb 09, 2016 6:21 am
Location: Sydney, Australia

Re: Hello_Video + overlay

Postby pjde » Fri Aug 03, 2018 11:50 pm

You can do most of this in pascal.

The header libraries for OMX are available at https://github.com/pjde-ultibo/openmax and OpenGLES ones are built into Lazarus.

There is also a demo that lets you play a sound file via the HDMI audio, and a hello_video that was converted to pascal.

Paul
Gavinmc42
Posts: 1422
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Hello_Video + overlay

Postby Gavinmc42 » Sat Aug 04, 2018 2:16 am

Thanks Paul,
I had only vaguely remembered your OMX stuff.
It is getting hard to keep track now, even google is finding too many Ultibo posts ;)
Lots about me talking about it, none on me doing it before this time, apart from getting pik33's example going.

The C lib example ran for hours, but I have some concerns re mem leaks and garbage.
It will be interesting to compare the Pascal version to it, will add webstatus to check for leaks.

For the current application on an exercise bike that is no problem but future 24/7 displays it may be.
Gavinmc42
Posts: 1422
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Hello_Video + overlay

Postby Gavinmc42 » Tue Aug 07, 2018 2:27 am

Wow, I put a bigger file in and it just worked.
Now I need to learn this OMX stuff too.

Not sure what all your network stuff is for?
Just commenting out the {$define use_tftp} makes for faster boot, still about 5secs.

This means the Hello_Pi C libs are not needed?
Pure Pascal :D

I am trying to play two videos and then loop
At the moment your code is repeating output.h264 only.

Code: Select all

 while true do
   begin
      video_decode_test ('output.h264');
      video_decode_test ('output1.h264');
   end;         


I need to play with your other OMX stuff too.
Never even noticed that it has been sitting there for 6 months :o
So much stuff there it may take a few more years to figure it out ;)

Got enough Zero's now - MP3/4 player?
Gavinmc42
Posts: 1422
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Hello_Video + overlay

Postby Gavinmc42 » Tue Aug 07, 2018 3:14 am

Another one of my senior moments :oops:
It works if I name the second file correctly ;)

Now there are two ways to play videos with Ultibo that boot in 5 seconds.
Gavinmc42
Posts: 1422
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Hello_Video + overlay

Postby Gavinmc42 » Tue Aug 07, 2018 4:21 am

Reading up on OMX leads to the OMXplayer
https://github.com/huceke/omxplayer

There should be clues in there for overlaying :D
Gavinmc42
Posts: 1422
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Hello_Video + overlay

Postby Gavinmc42 » Wed Aug 08, 2018 3:52 am

OK getting confused.
Now have Console, OpenVG and OMX video all going, transparency on OpenVG sorted.

But how do I control which layers each goes on?
How to size/place the OMX video less than full size?
Gavinmc42
Posts: 1422
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Hello_Video + overlay

Postby Gavinmc42 » Wed Aug 08, 2018 12:35 pm

Paul, your OMX video player ran all day in a loop, more than good enough for this current app :D
But boy is Dispmanx/EGL/OMX documentation a mess, how did you ever get the ported code to work?

If I can figure out the layers and overlays a camera version will be interesting.
FPV transmitters with Zero+Camera+5.8GHz TX
OpenVG with windowed area for video or camera or OpenGLES for Raineir's Aviation apps ;)

I have been running across CPI ( Camera Parallel Interface) in various source code as a camera interface option.
Makes me wonder if a CPI on is also buried in the Pi.
Considering how old the design is and it's original purpose, those undocumented Alt GPIO pins?
pjde
Posts: 425
Joined: Tue Feb 09, 2016 6:21 am
Location: Sydney, Australia

Re: Hello_Video + overlay

Postby pjde » Thu Aug 09, 2018 12:01 am

Hi Gavin

There is a broadcom specific OMX parameter record that you can use to set the render window size. When I get a chance I will try an refresh my memory about what it is.

Note that OMX is very fickle. Setting some parameters may cause the program to hang or error out. It is still way better than going down the MMAL approach as there is next to no documentation on that.

Also note that there is a demo on the github to display the camera using OMX. You do need to use the startx firmware and increase your gpu memory size.

Regards

Paul
User avatar
Ultibo
Site Admin
Posts: 2081
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Hello_Video + overlay

Postby Ultibo » Thu Aug 09, 2018 12:13 am

Gavinmc42 wrote:Now have Console, OpenVG and OMX video all going, transparency on OpenVG sorted.

But how do I control which layers each goes on?

The layer for each is determined by the parameters of the call to vc_dispmanx_element_add, you cannot change the framebuffer (which is layer -127) so if you want it to appear in front of anything else then you need to set those things to a layer less the -127. Otherwise just choose the layer numbers of OpenVG and OMX in the order you want them and the framebuffer will always appear at the back.

There is some more info here and here.
Ultibo.org | Make something amazing
https://ultibo.org
Gavinmc42
Posts: 1422
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Hello_Video + overlay

Postby Gavinmc42 » Thu Aug 09, 2018 2:35 am

Thanks guys.

Note that OMX is very fickle. Setting some parameters may cause the program to hang or error out.

Yep found that out ;)
I am pretty sure start_x has the Camera ISP code in it as a hexedit shows lens colour/correction comments.
Normal start.elf is ok for OpenVG, OpenMAX etc
I have yet to test if the start_cd.elf will do OpenVG?

The layer for each is determined by the parameters of the call to vc_dispmanx_element_add

The missing clue?
I was looking in the wrong place and not finding an answer.

Return to “Graphics”

Who is online

Users browsing this forum: No registered users and 0 guests