Joe Maller: Joe's Debug and Explore Filters: Joe's Text BuggerThis is a description of the shareware reminder message from my FXScript filters for Final Cut Pro.
This text watermarking script snippet will fade up a text message near the end of clips longer than a specified value. I used this on all of my shareware filters as a way of reminding people to buy them in a way that does not completely cripple the filters' effectiveness.
Useful shareware with effective shareware reminders usually gets purchased before passive or crippled applications. This watermark seems like a reasonable solution that doesn't upset the balance of usefulness and annoyance. I know I'm kind of patting myself on the back a bit over this, but I do think it's an elegant hack.
How it works
I needed this solution to be portable, so this script snippet is self-contained and can be tacked onto the end of any FXScript. I start with a comment indicating that the rest of the code following is the reminder. This also helps to modify snippets later on.
Before the script gets started I define a new variable to hold the corrected duration. To help make sure this snippet is completely portable, I added a BUG to the beginning of all my variable names, to be sure they do not collide with any existing variables defined in the rest of the script:
The duration needs to be corrected because the video output and the desktop
will show different values. The video output counts fields instead of
frames so it's twice what the desktop displays (unless the desktop is
displaying at 100%, non-square pixels). To correct for this, I multiply
Next the snippet is contained by a set of if/then statements. These statements are sort of like gates, they prevent the code from executing unless certain criteria are met, if the criteria is true, the gate opens. The first statement checks for either or not the clip being filtered is longer than three seconds:
The second if statement checks to see if the current frame is within one second of the end of the clip:
Next the snippet defines all it's variables, image buffers and text strings:
The two preceding lines are only processed in YUVaware FXScripts and are ignored if the document is not set to work in a specific space. When the color space of an image buffer is not clearly stated, a filter can produce unexpected results. Before adding these lines, the reminder text would appear with greenish edges on YUVaware filters.
It's a good idea to fill the image buffer where the type will go to prevent errors and/or halos around the type's edge.
I wanted the bugger to fade up over the first 10 frames of the last second, the following isolates those frames and creates a ratio to use as the buggers opacity:
What that does is divide the number of frames in the last second by 1/3 of the fps. This creates a fractional amount from 0 to 1 based on the current frame's place in the targeted 10 frames. This value is used later as the opacity. Values greater than one are assumed to be one when assigned to opacity.
Next the text strings are defined and drawn into the BUGxbuffer image buffer, the height of the text lines is based on fractions of the images height:
To make the text look better, I decided to blur it slightly before applying it to the image:
Finally the text is applied to the image. I used screen mode to sort
of simulate the process of burning subtitles onto film. Note that the
opacity is determined by 75% of
Finally, both if statements are closed out and the bugger snippet is finished
One last note, in order for this to be a bug-free standalone filter, I needed to send something to
Defeating the watermark
If you really wanted to you could circumvent the watermark by extending each clip by one second, rendering the clip and then trimming the clip by one second. This works because FCP will trim rendered files instead of re-rendering. Another method would be to divide all clips longer than three seconds into smaller clips with the Razor tool. Still, it's a bit of an annoyance and easier just to buy the filters. They're not that expensive and a lot of time went into their creation and associated explanations. Besides, since I told you how to screw me, that sort of takes the thrill away, doesn't it? Now you can't even say you thought of how to do it.
Dude, ever heard of subroutines?
Uh, yes. At first I did build this as a subroutine and bits of it still exist in Joe's Multi-Value Tester, but I found that subroutines seemed to want to be at the top of a script instead of at the bottom like I was accustomed to. If the Text Bugger was a subroutine, I would have to paste the various parts of it into several locations in each filter. Because of this, I decided that the most portable solution was a block of code at the end of each script.