Trying to make UI for Glitch effect

Hi all,

Trying my hand at creating a UI for a glitch effect using the frei0r.glitch0r filter with no luck.
I have attached the meta.qml and ui.qml in a zipped file.

Have tried putting them under “qml–>filters–>glitch”
but it simply does not work, the sliders don’t even appear.
It must be something in the code that is horribly wrong.

Anyone care to take a look and see if they can pick up what I can’t.

Thanks. (2.6 KB)

1 Like

Found the problem…Can’t use variable names that begin with an uppercase letter for IDs and property names.
A bit dumb but it is what it is.
There were also other errors in the code and seem to be fixed.

Glitch filter seems to be working well, will post it here after more testing.
A short test below:

This is what the filter looks like in the UI

1 Like

Where did you find the code for the filter?

Hi @sauron

I studied the existing code for the blur filter, then modified the code to create the glitch effect.

Once 'Im happy with the glitch, want to create a RGB shift and a couple others.

Worked a bit more on the filter, attached below.
No guarantees there aren’t any bugs with it.

There are 4 parameters available to modify.

  1. Frequency: How frequently the glitch is applied.
  2. Block: Height of the block that will be glitched.
  3. Shift: How much the blocks are moved when glitching.
  4. Color: Distort color as well and how much.

Create a new folder called glitch under shotcut–>qml–>filters
Unzip and place the two files there.
Have fun glitching. (1.9 KB)

1 Like

This looks cool, @Paul2. Thanks for creating it and sharing it. Will play with it later, in the next day or two.

Great work, @Paul2! :grinning:
Did you make the whole filter yourself?

I was testing this and here are some initial thoughts.

  • The default settings for the filter should be something else with Frequency being higher. The default right now doesn’t show any effect happening immediately after choosing the filter.
  • There is an error when the default buttons for Block and Shift are hit. If you change the values and hit default then it both will go to .5000. But if you hit them again then they go to .4991 and .4993 respectively.
  • When you hover the mouse over where the number values are shown and move the center mouse wheel the numbers move in increments of .1000. I think it would be better if they move at increments of .0010 or .0100.
  • Would the parameters be better if they were represented in percentages? So instead of the highest being 1.0000 it would be 100.00%?
  • I’m wondering if there could be either a modification to the Block parameter or an additional control made that would allow to break up the blocks that appear into smaller blocks kinda like this:
  • I wonder if the parameter for Color can be modified. Something like where 100% would be the default colors of the original video and if you go higher than 100% then the effect that is the same as is right now but if you go below 100% then the colors would desaturate. Desaturation could help achieve the classic VHS glitch that is usually seen in effects like this.
  • This filter currently suffers from Bug #10 on my V19.02.28 Bug Report.

Also, can this filter be keyframeable at all?

Thanks for making this and sharing it, @Paul2!

Hey guys, thanks for trying out the filter and reporting back.
It’s very much a work in progress but decided to put it out there so everyone can try it out, comment and work on it too.

Below some answers to the questions posted above, not necessarily in the order they were asked.

Yep, noticed that but not much I can do until the bug is sorted out in the main code.
All the filters work under this.

Not a problem, any suggestions? Perhaps half way?

OK, will look into that.

Sure, the step size is easy to change.

They can be if it’s what the majority want.
This filter works from a min value of 0 to a max value of 1, I used 0.1 step size.
No reason why it can’t be shown and adjusted in % and in the code I translate back to values.

As for the other questions, I think it would be more informative if I rather explain how filters work in Shotcut, well my understanding anyway.
@shotcut and @brian feel free to correct me if I’m wrong.

Shotcut comes with a whole bunch of pre-compiled filters but not all are “exposed” to the user.
There are several ways to either expose them or create from scratch and add.
Filters can be made using LADSPA, webvfx, MLT and frei0r.
With the exception of webvfx that can be coded in html/css/js, the others require C++.

However, as mentioned earlier, Shotcut already comes with loads of precompiled filters essentially libraries, in the form of .so files for Linux, .dll for Windows and .dylib for Mac.
These already contain the functions to act on the video and/or audio and these functions can be interfaced to using qml scripts which also create the UI.

This is the approach I took, studied some qml code for already “exposed” filters then adapted that for other filters that are already included with Shocut but not available to the user yet.

As with everything, there are pros and conns.
The pros are easy/easier development but one conn is that we are limited by what can be done and number of parameters.
If a filter only does certain things with a certain amount of parameters, there is no way to change or add unless going back to the beginning, re-writing the whole thing from scratch, compiling it and then re-writing the qml to interface to it.
So this also answers the question by @DRM about changing the block size or adding more parameters, no, not easily.
Although you could try the “Mosiac” filter then the “Glitch” filter.
Could be interesting to see the result of using Mosaic–>Glitch–>Dance filters.

As for keyframes, yes do-able but will take a bit longer.

Will be working on the Glitch filter further and also want to create a RGB shift filter and also have ideas for some more handy audio filters.
But as they say, Rome wasn’t built in a day…:grinning:

@Paul2 it’s great that you got the filter to work. It’s a very cool filter.

Hope you don’t mind. I made a few modifications per @DRMs suggestions.
Set the max frequency to 10 with a default of 5.
Block, shift, and color set to max 5
Set all the step sizes to 0.01, color set to 0.001.

Modified filter. (1.9 KB)

1 Like

Hi @sauron of course I don’t mind.
The more that contribute to Shotcut, the more we all benefit.
Will try your modified filter shortly.

There are some errors. The way to control the intensity of all 4 parameters is twisted. In the old version when they are cranked up all the way to the max that’s when the degrees become the most active. In this one, you have to keep it low at around .20-.50 to get a similar intense effect like before because if you go to the max on the parameters then it is a medium effect. There may be other errors.

On another note, your reset of the step sizes on both the bar itself as well as the number values is just right. :+1: I agree with the defaults you set and you seem to have fixed the bug I mentioned about the default buttons for Block and Shift. :slight_smile:


I haven’t looked at the modified code yet, but the effect that you are describing could be that the way @sauron is sending the new values are causing a wrap-around effect.
The filter expects a min value of 0 and a max of 1, the step size is dependent on how much fine control we want.
These values are of type “double”, i.e. double precision number that can have up to 15 digits including after the decimal point.
So for say Frequency, we can have 0.936474… but not higher than 1
@sauron mentioned that he is using values of 5 and 10
Are you scaling them before sending them to the filter and back again when they are displayed on the UI?

Sometimes it doesn’t work to tweak the max values.

Set them back to 1. Kept the step values. (1.9 KB)

1 Like

They way you set them now is probably best.

Must say, I’m really enjoying this thread.
This is what open source is all about, new ideas, tweaking, experimenting, sharing code and in the end we all benefit.

It seems to be working better now with the max values set to the original specs.
Now we need key frames.

This is pretty cool thread.:slight_smile:

Nice job, @sauron.

@Paul2 , when you get a chance can you see if the behavior of the Block parameter is how it’s supposed to be? I checked with your original version and even in that one when the value was set higher it gets less intense. I’m guessing that it’s supposed to be the higher the Block parameter goes the more intense with the block shaped distortions but it’s the opposite.

Also, I think the order of Block and Shift should be switched so that Switch follows Frequency instead. If you turn down Shift all the way then nothing happens so that makes it more important than Block.

And there is a scroll bar that appears when the filter is chosen. With only 4 parameters for this filter there’s no need for a scroll bar.

Indeed. Thank you for starting the thread and creating a new filter for us.

@DRM, I think I found a reasonable setting for the step values and the decimal places.
Set the step to 0.001 and the decimal places to 3.
I think 4 decimals is too high. Don’t think the human eye can see to the ten thousandth.

Try this one. (1.9 KB)

Nice filter @Paul2.:+1:

Ghost in the machine

1 Like

I would encourage this. 0-1 is arbitrary to users. But they can easily understand that 0% means “not applied” and 100% means “as much as possible”.

I also recommend making the labels clearer. Users might not understand “blockH”. Maybe “Block Height”. For extra credit, make the filter parameter description a tooltip for the control.

Great work on adding this filter. When you are happy with it, submit a pull request on GitHub if you have experience with that. Or I can submit it for you.

Thanks @brian

I have made the changes and new version attached below.
Have no idea on how to do pull requests on GitHub, perhaps we wait for several days for users feedback and if after that all is good, if you wouldn’t mind doing it.
Much appreciated. (2.0 KB)