User-created front ends for Shotcut filters that have not been added to Shotcut

Users have created front ends for some filters. These filters are not in the official Shotcut install package.

All the filters have been key framed except the filters that have no key frameable parameters and the cartoon and binarize filters. I have put these filters on google drive.

Filter front ends.

Users can download and install these filters. They will be available as long as they are not added to the Shotcut install package. If any filter(s) are added to Shotcut they will be removed from google drive.

Installation is simple. Copy the folder to X:\Shotcut\share\shotcut\qml\filters. Where X is the drive where Shotcut is installed. The folders do not need to be renamed. Itā€™s easier to keep track of the added filters that way. Restart Shotcut and the filters will be available for use.

When a new version of Shotcut is installed, if the remove old version option is checked, the filters will be deleted and you will need to add them back if you wish to continue using them.

14 Likes

Thanks for this.

Iā€™ve almost completed a brand new filter called ā€œSniper Scopeā€ (see the snapshots below), which I am in the process of producing the QML front-end for. It has lens properties built in and can be turned into a type of ā€œnight-scopeā€ by combining it with the ā€œcolor gradingā€ filter. Iā€™ll publish it on the forum and would appreciate it if you would then add it to the collection.

3 Likes

This is fantastic. How are you going about creating these filters? Are you only adding QML front ends to filters that are already compiled into Shotcut? Or are you also writing C++ code thatā€™s dynamically loaded by Shotcut and then front-ended by QML? Is there a published guide for doing what youā€™re doing?

Yes that is what we have been doing. @Paul2 started this.

I havenā€™t found one. So far Iā€™ve been doing it by with trial and error. Think I sort of have the hang of it.

Made a UI for a very specialized filter. Itā€™s not complete yet but if some users would like to test it they are welcome to do it.

Light Graffiti.zip (4.1 KB)

A demo can be found here.
https://userbase.kde.org/Kdenlive/Manual/Effects/Misc/Light_Graffiti

2 Likes

The Sniper Scope filter Iā€™ve produced I developed from scratch by writing a fragment shader using OpenGL Shader Language (GLSL) and Javascript using a ā€œlens formulaā€ algorithm.

It is quite fiddly doing this as debugging a shader program is like pulling hensā€™ teeth and optimising the code to make it run faster is quite tortuous e.g to optmise the following code to run twice as fast on the parallel processing GPU:

vec2 new_xy  = rr < SD ? xy * (R - hr) / sqrt(R * R - rr * rr) : xy;
return getFromColor(SC.xy + new_xy);

I had to come up with:

float rr_lt_SD = when_lt(rr, SD);
float RR_gt_rr = when_gt(R , rr);
float sqrt_arg = not(RR_gt_rr) * 1.0 + RR_gt_rr * (R * R - rr * rr);	// prevent sqrt of -ve number error
vec4  colr     = getFromColor(SC.xy + not(rr_lt_SD) * xy + rr_lt_SD * xy * (R - hr) * inversesqrt(sqrt_arg));

Now that the code is complete I have very easily incorporated it the ā€œtransitions frameworkā€ I put together (see: GL Transitions made using Elusien's GL transitions overlay generator). I am now creating the QML front-end to enable it to be used as a strightforward Shotcut filter with all the keyframe bells and whistles, but this is not so simple.

@Elusien

That is looking really good.
Two questions:

  1. Will it have the ability to adjust the scale, magnification and the position of the sights or can one just apply the S&R filter after?

  2. What would be involved to change the shape to say binocular view?
    Was thinking that a gun sight, binoculars and a magnifying glass would all be great additions.

If you go on my ā€œtransition webpageā€ and click on the ā€œSniper_Scopeā€ button and then on the ā€œCreate Filterā€ button you will see the HTML code generated for the Overlay HTML filter. The defaults are:

"Mag_Index":1.0,
"Scope_Diameter":0.333,
"Scope_Coords":[0.5,0.8],
"Scope_Color":[0.1,0.1,0.2,1],
"Scope_Thickness":0.04,
"Scope_Only":false,
"Cross_Hairs":true

You can play around with the parameters:

ā€œMag_Indexā€ is an indication of the magnification (0.0 means no magnification, 1.0 means maximum).

ā€œScope_Diameterā€ is the diameter as a fraction of the frame height.

ā€œScope_Coordsā€ is the point on the frame where the scope is centred.

ā€œScope_Colorā€ is the normalised [0 to 1] RGBA color of the scope (ā€˜blackā€™ is [0.0, 0.0, 0.0, 1], ā€˜whiteā€™ is [1.0, 1.0, 1.0, 1].

ā€œScope_Thicknessā€ is the scopeā€™s thickness as a fraction of its diameter.

ā€œScope_Onlyā€ = true if you want to see only the scene inside the scope - the scene outside is blacked out.

ā€œCross_Hairsā€ = false, means that you do not want the cross-hairs drawn.

All of these parameters will be available in the QML filter version, plus, appropriate ones will have the ability to be ā€œkeyframedā€.

Donā€™t forget, when you look though binoculars properly you see a circular view. If you want to simulate binoculars you could apply the filter twice with different X-values for the coords. For a magnifying lens, just omit the cross-hairs and set the scope thickness very thin (say 0.001) just to give a faint outline of the lens.

What happens if GPU acceleration is disabled in Shotcut (as it is by default now)? Does your shader get run by an OpenGL software renderer on the CPU? Is that any faster than a pure CPU algorithm? Or is the GLSL route mostly about being easier to integrate into Shotcut so an additional library doesnā€™t have to be compiled in?

Iā€™m very interested in filter internals, and I have a couple I would like to modify as well. Sorry for my ignorance as Iā€™ve only begun to research it.

Thank you @Elusien
My questions have been answered and thanks again for a great filter, I shall be tinkering.:grinning:

Thatā€™s really cool. :slight_smile:
How about an option that would allow the user to use different crosshairs of their choice from like a png file?

Canā€™ find it.:disappointed::confused:

The ā€œSniper_Scopeā€ filter is written in GSLS and as such can only be run on the GPU, not on the CPU.

My understanding is that GPU acceleration via OpenGL was added to MLT (and hence Shotcut) in 2013 mainly to implement the ā€œmovitā€ video filter library for high-quality, high-performance video filters based on GLSL shaders (see: MLT - Documentation).

Unfortunately these seem to have introduced some instabilities and a lot of problems have been caused by users switching on ā€œGPU processingā€, i.e. using these filters, and not understanding the issues. Hence Dan has disabled them and you have to configure their use manually.

It is unfortunate that people believe that GPU processing is by default disabled in Shotcut. It isnā€™t. It is the use of these GPU shader programs (movit filters) that have been disabled.

Hence GPU shader programs (like the Sniper_Scope filter or the ā€œtransitionā€ filters on my website) can still be used, just not the ā€œmovitā€ ones.

2 Likes

http://www.elusien.co.uk/shotcut/gl-transitions/index.html

1 Like

Everything you said was new information to me. Thanks for the clear explanation.

Trying to tie-in a PNG with the sniper-scope filter is probably not possible. Though I have thought about having a reticule on the cross-hairs like so:

Reticule

My bad. Had to clear the cache for the page to refresh properly.

Would you know of any way of how to go about fixing the GPU issues to help get GPU acceleration complete and up and running?

Itā€™d be nice to have at least difference kinds of images of crosshairs to choose from. I donā€™t know if perhaps there can be an option to just have a circle with no image of a crosshair to allow the user to fill it in with a png image and keyframe it to match?

It wasnā€™t really a case of the filters having errors, a lot of the problems were not reproducible. Some problems could have been due t. the order in which filters were applied, or mixing filters on a track. Dan is way more experienced than I at solving problems and he couldnā€™t do it, mainly because of the unreproducibility issues, Which is why he made the option to switch the filters back on so tortuous. In the past it was too easy to do (just an option in preferences) and the number of error reports this caused was out of proportion to the advantages. Which is why switching it on comes with a health warning.

Type ā€œGPU disabledā€ into the search box obove and youā€™ll see what I mean.

There is such an option: Cross_Hairs: false".

If you are using the KeyframableFilter your QML, then it requires v19.04 of Shotcut (currently only beta) as that is new for this version.

This option does not affect WebGL, which is used by the HTML filters.