How to apply a video filter with a hotkey?

Discuss your Lua playlist, album art and interface scripts.
JorgeR
New Cone
New Cone
Posts: 2
Joined: 15 Nov 2020 21:13

How to apply a video filter with a hotkey?

Postby JorgeR » 15 Nov 2020 22:01

Hi,

I'm new to VLC.

I see that it's possible to apply a Gaussian blur filter, with a specific value, in the CLI, eg: --gaussianblur-sigma=0.5  ( https://wiki.videolan.org/VLC_command-line_help/ )

But, it is possible to bind this command to a hotkey?

I know I can set a specific, numeric value in the advanced preferences menu, and enable/disable the filter in the adjustment and effects panel.
But it needs too many clicks ... Just to enable the filter it needs 4 clicks (open the Adjustment and Effects panel; Video Effects tab; Advanced tab; check box to enable filter).

I use this feature a lot. I have many old SD quality video files, from DVD and VHS. They still look pretty good on my 27 inch CRT TV, but on a modern display, you can see all the encoding “imperfections”.
I’ve found that, if I apply a small amount of Gaussian blur, I get a very decent image quality, even in a modern display. The encoding artifacts are gone, and I don’t really lose a lot of detail. If you apply the right amount of blur, the "detail" you lost is mostly encoding artifacts.      

I was able to do this in MPV with a lua script.

Can I do something similar in VLC?  I'm on windows 10.

Thanks

ProtoSahara
New Cone
New Cone
Posts: 7
Joined: 17 Oct 2020 17:05

Re: How to apply a video filter with a hotkey?

Postby ProtoSahara » 17 Nov 2020 22:32

I don't know of any way to create custom hotkeys or if hotkeys are available through Lua alone, but a script could turn on the Gaussian blur filter with some code like

Code: Select all

local o = vlc.object.vout() vlc.var.create(o, "gaussianblur-sigma", 0.5) vlc.var.set(o, "video-filter", "gaussianblur")
using the variables Lua module (https://verghost.com/vlc-lua-docs/m/var/)

Running this code from an interface script might be good, since it can start automatically and wait for certain files to play before turning on the filter.
You could also use an extension script, which would require 2 clicks (View->YourExtensionName).

You could also look into AutoHotkey (https://www.autohotkey.com/), which might have what you need.

Hope this helps

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: How to apply a video filter with a hotkey?

Postby mederi » 19 Nov 2020 13:40

Thank you for revealing the secret. I wouldn't have figured it out myself. And then how would you disable it? I am looking for some on/off solution for this extension https://forum.videolan.org/viewtopic.php?f=29&t=133525
Custom hotkeys are not available anymore in Lua scripting in current VLC. The variables callback API has been removed since VLC 2.1 https://trac.videolan.org/vlc/ticket/8097

ProtoSahara
New Cone
New Cone
Posts: 7
Joined: 17 Oct 2020 17:05

Re: How to apply a video filter with a hotkey?

Postby ProtoSahara » 19 Nov 2020 14:42

When I make a vlc variable change I want to reverse, I usually store the value of the variable before modification, then set it back afterwards. But you could also just set the default (no filter) value, which is the empty string "".

Code: Select all

local o = vlc.object.vout() vlc.var.set(o, "video-filter", "")
Pretty sure "gaussianblur-sigma" can be left alone.
Also, I assume that if you were going to turn the filter back on again, you might not have to call vlc.var.create() again.

JorgeR
New Cone
New Cone
Posts: 2
Joined: 15 Nov 2020 21:13

Re: How to apply a video filter with a hotkey?

Postby JorgeR » 20 Nov 2020 01:39

OK. Thanks for the suggestions!

I'm coming from Potplayer, which has a lot of customization options out of the box.
But I'm looking at other players that could offer even more customization through scripting.

VLC appears to be somewhat limited in this regard. Custom lua hotkeys are so helpful! ...
I also don't know much about MPV yet, but it seems possible to do so much more. 
What are your use cases, to use VLC, instead of MPV or other player with user script support?


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 3 guests