jean343 / Node-OpenMAX

Node wrapper for the OpenMAX library
https://www.npmjs.com/package/openmax
MIT License
16 stars 5 forks source link

This is great #4

Closed skerit closed 7 years ago

skerit commented 7 years ago

I've been meaning to write yet-another-mediaplayer for Raspberry Pi, but I wanted to use node and electron/nw for it. I guess this goes a long way to help that be a feasible idea, since video decoding using the web internal sucks otherwise.

So I'm definitely going to look into this, thanks!

jean343 commented 7 years ago

Thanks for the feedback,

It's pretty good at decoding video, and viewing the camera. Let me know if you need help!

JP

skerit commented 7 years ago

There are a few small issues with the example on the README file:

What's the exact purpose of the VideoRender class right now? I'm just figuring out what needs to happen in order to get some video on the screen :)

Also: do you know what raw format VideoDecode outputs? It seems to be missing frames, too.

skerit commented 7 years ago

Alright, I'm getting somewhere. I'm able to decode video using your openmax module and displaying some raw video output directly on the screen. Here's the test repository:

https://github.com/skerit/omaxtest

jean343 commented 7 years ago

Thanks for your feedback. I checked your repo and it's quite interesting. My function initAll is a very simple wrapper around init(). If you have a single Component, feel free to do: VideoDecode.init().then(function(){ }). Also, you don't need the VideoRender here as you are doing your own render.

Did you check the example https://github.com/jean343/Node-OpenMAX/blob/cd7120a478a941360ea0d305a13d8009c6550310/examples/js/SimpleVideoDecoderRenderBuffer.js ? If not, it might help you.

In the source code, it has performance measurement. The slow down is mostly from the pixel copy as the VideoRender can easily decode and copy 1080p 60fps.

Regards,

skerit commented 7 years ago

Ah, that's good to know.

The slowdown only happens when I create an OpenVG image out of the buffer. Painting the pixels directly to the screen happens instantly, but then you can't do any scaling or such :/

I did see that example, but I was more interested in the VideoRender class, though I didn't see a lot of code in there. I'm guessing most of that happens in the C++ part?

jean343 commented 7 years ago

The VideoRender is in the OpenMAX land, we don't have the source for it, but it's quite performant. See: https://www.youtube.com/watch?v=La0PwXI2cXc

I have an example, still work in progress in the perf folder: https://github.com/jean343/Node-OpenMAX/blob/master/perf/PerfRender.ts

What is the goal of your project?

skerit commented 7 years ago

Oh, so you can set the dimensions of the renderer, that's interesting. Could you also set some kind of zo index, so it doesn't draw over things drawn with OpenVG? Or have it draw to an X11 window?

I'm creating a system that streams video over udp to the pi's. But I also want to add some sort of interface. And, obviously, I want to do it in node :)

jean343 commented 7 years ago

Hey,

Not trying to advertise my own projects, but here is a TCP client in C++: https://github.com/jean343/RPI-GPU-rdpClient

With the render, there is some sort of z-index, but it's definitely not a X11 window. You can do some tricks, but I am afraid it does draw on top of everything else. You could always have your UI as a VideoRenderer as well then you will be the top most.

Another option is to use the EGLRenderer and get an OpenGL texture. There is an example: https://github.com/jean343/Node-OpenMAX/blob/master/perf/PerfGL.ts Also, this is what Kodi does in C++

If there is a bug with those APIs, let me know.

JP

jean343 commented 7 years ago

Closing as there are no questions.