Joe Maller: Joe's Debug and Explore Filters: Joe's Simple Blur

A step by step explanation of how to build a simple FXScript blur filter for Final Cut Pro

This filter is very short and uses only one slider value and one function. It is here mostly as a step-by-step example of how to build a simple filter.

Step by Step Explanation

Final Cut Pro loads everything above the code line at startup, any errors in the beginning section will result in the script not being recognized. Unrecognized filters will not appear in Final Cut Pro's menus. For more information see the FXScript Basics page.

The first line of the filter declares what type of FXScript this is, the choices are Filter, Generator and Transition. This line also defines the name of the filter (in quotes) as it will appear in the menus. Some characters like ampersands (&) are not allowed.

Filter "Joe's Simple Blur"

The next line defines where the filter will go in the menus, each group is a submenu of the three possible script types. If the script specifies a menu name that doesn't exist, the menu will be created.

group "Joe's Debug and Explore Filters";

After those two beginning definitions, the inputs are usually specified. These can be any of the possible inputs (sample) but each must have a unique name. Duplicate names cause errors and prevent the script from loading at startup. The following line declares a slider input whose value will be stored in the variable BlurAmount. The slider will be labeled "Blur", have a starting value of zero and a range of zero - 100. Inputs are discussed in more depth on the FXScript Input Variables page.

input BlurAmount, "Blur", Slider, 0, 0, 100

The code line is an important structural part of every FXScript. This is the breaking point between the definition section and the code section, where all the action will take place. Final Cut Pro preloads everything up to this point at startup, so any errors won't be apparent until the filter is applied to a clip.

code

The Blur() function takes the image from src1 and places a blurred copy into the destination image buffer dest. BlurAmount is the variable from the input slider and is used to determine the blur radius. AspectOf(dest) returns the aspect ratio from the current video display. This can change between the video output and the desktop, using the aspectOf() function makes sure that the blur will be applied with the proper proportion each time the filter is applied. More information about funcitons is on the FXScript Functions page.

Blur(src1, dest, BlurAmount, AspectOf(dest))

And that's it. At some level, every FXScript in Final cut works the same way. Most all scripting is usually just a whole bunch of simple steps lumped together to produce a seemingly complex result.

Source Code

Unlocked versions of this and all of Joe's Debugging and Exploration Filters are included for free with the trial and paid versions of Joe's Filters. Or use the source code below to build your own.


(copy and paste the code into FXBuilder)

 

 

 

 
page last modified: