Page 1 of 1

Can you change the frames before they get displayed?

Posted: 13 Sep 2022 12:04
by Bernd
Hello
I got a source code from an industry partner that takes a video stream and displays it via VlcMediaPlayer from the VLC library using QtCreator.
So far everything is fine.

The video stream comes from a camera with a severe fish-eye lense, and I would like to transform the image usiing opencv before displaying it.
I have the function to undo the fisheye effect and it works fast and stable, but only on a single image.

There is not much source code regarding the video stream, but the small parts look like this:
>>>
Init():
instance = new VlcInstance(VlcCommon::args(), this);
player = new VlcMediaPlayer(instance);
player->setVideoWidget(ui->widget_VLC);

onPLayVideo():
player->open(media);

onStopVideo():
player->stop();
<<<


So here my question: Can i somehow get to every frame from the player and adapt it before it gets displayed?

I tried to look at the github sources, but I could not find anything like an event handler where I could inject my transformation code...

Regards
Bernd

Re: Can you change the frames before they get displayed?

Posted: 13 Sep 2022 12:30
by RĂ©mi Denis-Courmont
That's what video filter modules are for.

Re: Can you change the frames before they get displayed?

Posted: 14 Sep 2022 00:11
by Bernd
Ok, that is a good hint.
How can I implement my own filter?
Is there some code example or at least documentation?
If I look at github i only find filter.c for audio... but i need that for the frames...
Any advice is appreciated.

Re: Can you change the frames before they get displayed?

Posted: 16 Sep 2022 09:40
by chubinou
> How can I implement my own filter?

you need to add your filter to VLC itself, you can't do it through libvlc public API

we have a sample filter using OpenCV API if you want to see how this works

https://code.videolan.org/videolan/vlc/ ... xample.cpp

Re: Can you change the frames before they get displayed?

Posted: 19 Sep 2022 15:56
by Bernd
Hello Chubinou
Thank you for this detailed answer.
As far as I understand this, it will not help me in my case.
My industrie partner does not use the full VLC Player, but just the VLC lib inside his source code.
So if I cannot use a video filter via public API, I don't see how I can use it in this scenario.
Did I understand this correct?

Re: Can you change the frames before they get displayed?

Posted: 19 Sep 2022 16:57
by chubinou
if you distribute libvlc, you can distribute additional plugins as well, but you should probably compile it yourself