Can you change the frames before they get displayed?

This forum is about all development around libVLC.
Bernd
New Cone
New Cone
Posts: 3
Joined: 13 Sep 2022 11:46

Can you change the frames before they get displayed?

Postby Bernd » 13 Sep 2022 12:04

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

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 13 Sep 2022 12:30

That's what video filter modules are for.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Bernd
New Cone
New Cone
Posts: 3
Joined: 13 Sep 2022 11:46

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

Postby Bernd » 14 Sep 2022 00:11

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.

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

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

Postby chubinou » 16 Sep 2022 09:40

> 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

Bernd
New Cone
New Cone
Posts: 3
Joined: 13 Sep 2022 11:46

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

Postby Bernd » 19 Sep 2022 15:56

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?

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

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

Postby chubinou » 19 Sep 2022 16:57

if you distribute libvlc, you can distribute additional plugins as well, but you should probably compile it yourself


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 13 guests