display video as background

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
django013
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat May 27, 2017 6:15 am

display video as background

Post by django013 » Sun May 28, 2017 5:15 am

Hello,

I searched for mediactrl as well as for overlaying panels, but did not find the right starting point yet.

My environment is a closed source (windows-)app, that allows customization by lua scripting. wx is accessible through wxlua and the toplevel screen element, I can use is a panel. That panel has no size on creation, so I have to use resize handlers.
I was successful implementing some trivial samples ...
That app is planned to be ported to linux too. Linux is my development environment.
So I'd like to be as portable as possible.

Next challenge is displaying a video(-stream?) from a webcam as panel background. But I don't want to scale the video to my controls size. Instead I'd like to use my control as a viewport to the unscaled video.
Additionally I'd like to use the "videopane" as ordinary panel, where I can place UI-Controls.
Is that possible with all that clipping and the like?
I'd like to add a control to move the viewport in the video-image-area.
And if possible, I'd like to do custom painting in the panels area.

What's the best way to go for this challenge?
Can I use mediactrl or do I have to create a custom widget?
I didn't have any contact to wxwidgets or lua before, so please forgive me, if I missed some readings ...

User avatar
doublemax
Moderator
Moderator
Posts: 14895
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: display video as background

Post by doublemax » Sun May 28, 2017 8:34 am

Is there any other application that does what you're describing? I'm having difficulties to imagine what you're trying to do ;)

But i think the "custom painting" on the video is the deal-breaker here. I'm almost certain this won't work with wxMediaCtrl or a VLC based solution. You might need a library like ffmpeg, retrieve every single frame as a bitmap yourself and draw the content yourself.
Use the source, Luke!

django013
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat May 27, 2017 6:15 am

Re: display video as background

Post by django013 » Sun May 28, 2017 9:37 am

Hm, I don't want to paint over every frame. My "drawings" don't change that often.
What I'd like to paint is a cross with circles like is done on shooters :)

User avatar
doublemax
Moderator
Moderator
Posts: 14895
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: display video as background

Post by doublemax » Sun May 28, 2017 1:02 pm

I don't want to paint over every frame. My "drawings" don't change that often.
It doesn't really matter how often the content changes. You'd need to draw "something" on top whenever the content of the video changes, which is usually pretty often ;)
Use the source, Luke!

django013
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat May 27, 2017 6:15 am

Re: display video as background

Post by django013 » Sun May 28, 2017 2:12 pm

You're right. On java systems I'd try to paint the video as background images and use the foreground with transparency ...
But with wxwidgets I have no idea, what would be possible.
I read, that at least wxlua does not support overlaying widgets at the same location.

Don't know - is it possible to bring a user control into play without recompiling wxwidgets?

Could you please tell me, what is possible with the app-environment, I'm bound to?
What about the viewport aspect? Would that be possible to achieve?

User avatar
doublemax
Moderator
Moderator
Posts: 14895
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: display video as background

Post by doublemax » Sun May 28, 2017 3:46 pm

I guess you'll have to build some small experimental samples in C++ to check what's possible and what not. Especially if it's possible to draw on top of a video overlay. My guess would be no, but i've never tried it.

However, i think using ffmpeg to decode the video is a realistic option, of course you'll lose performance, displaying full hd video may become a problem (but once again, I've never tried this, this is something you have to find out yourself).

The Lua component is another challenge on top of that. Will the whole application be based on wxLua or will it be a C++ application that just uses Lua for additional scripting support? (I would highly recommend the latter)
Use the source, Luke!

django013
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat May 27, 2017 6:15 am

Re: display video as background

Post by django013 » Mon May 29, 2017 3:24 am

Will the whole application be based on wxLua or will it be a C++ application that just uses Lua for additional scripting support? (I would highly recommend the latter)
Oh - the application is not mine! I don't have access to the sources.
The application creators build several interfaces for lua-scripting and inside lua wxwidgets is accessible.
Each interface is like a sandbox - no common global namespace.

But hey - you're right! I have to try, whether I could access ffmpeg ...

Post Reply