Page 1 of 1

How to apply a video filter with a hotkey?

Posted: 15 Nov 2020 22:01
by JorgeR
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

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

Posted: 17 Nov 2020 22:32
by ProtoSahara
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

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

Posted: 19 Nov 2020 13:40
by mederi
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

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

Posted: 19 Nov 2020 14:42
by ProtoSahara
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.

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

Posted: 20 Nov 2020 01:39
by JorgeR
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?