Hello everyone! Below is a brief tutorial explaining how to get a basic FxGenerator plug-in working with Final Cut Pro 7. There will be no code writing or reading in this tutorial, and I do not go into detail explaining the reasoning behind all of the steps. This short tutorial is just meant to get a FxGenerator plug-in working very quickly using a template provided by Apple.
There are a few things to note when working with FxPlug. Each plug-in must be either a video filter, video generator, or video transition. A brief description of each, taken from the FxPlug SDK Overview follows:
You can write three types of plug-ins with the FxPlug SDK: video filters, video generators, and video transitions. A filter operates on an input video image to produce an output video image. A generator does not require an input image. A transition combines two input video images to yield an output video image. In each case, the video images may be traditional RAM-based bitmaps or hardware-accelerated OpenGL buffers. A single plug-in can support either software rendering or hardware rendering, or both. Implementing a software path is always recommended to provide compatibility with older machines that may not have Quartz-Extreme-compatible video hardware.
The project we are working on is an authoring tool for Popcorn, similar to Butter. What we’re interested in for this plug-in is adding annotations to a video by adding our own custom metadata. That means we do not need an input image, meaning our plug-in will be a video generator.
Creating a Simple FxGenerator Plug-In for Final Cut Pro
First, you need to download the FxPlug SDK–you will need to be registered with Apple as a developer to access the download link. At the time of this writing, I am working with version 1.2.5.
Now that you have that installed, you can create a new project in Xcode and use one of the templates in the “Standard Apple Plugin-ins” category.
As illustrated in the picture, there are three to choose from: FxPlug Filter, FxPlug Generator, and FxPlug transition. Since we are making a video generator, go ahead and choose the FxPlug Generator. I named my project FirstFxGeneratorPlugin.
Now that you have the basic plug-in, you need to change the group uuid as well as the plug-in’s uuid in the Info.plist file in order to avoid conflicts. To do this, open up the terminal, and use the uuidgen command.This will give you a unique uuid. You will need to do this twice: once for group uuid, and once for the plug-in uuid. (Note that you can reuse the group uuid if you have different plug-ins that belong to the same group. However, each plug-in will need a unique uuid.)
Below is a screen shot of my Info.plist file. Notice that the “uuid” field under ProPlugPluginGroupList is the same as the “group” field under ProPlugPlugInList. The “uuid” field under ProPlugPlugInList should always be unique; this is the uuid of the plug-in.
There are two more steps.
The first is to add Final Cut Pro as a new executable, so you can run and/or debug your plug-in. To do this, click on “New Custom Executable …” under the “Project” menu. Give the executable a name, I named mine “FCP”. Then click the “Choose…” button, and locate and select Final Cut Pro. Below is a screen shot.
Click “Finish” to add this as an executable.
There is one more thing that needs to be done before this will work. Final Cut Pro will scan the following two folders when searching for plug-ins:
This means that whatever we make here needs to end up in one of those folders. I put mine in ~/Library/Plug-Ins,FxPlug/ (if ~/Library/Plug-Ins/FxPlug/ does not exist, you can create the folders yourself). There are two ways to do this: using a Copy Files build phase, or creating a symbolic link. I created a symbolic link. As described in the FxPlug SDK Overview, it says that creating the symbolic link, depending on your settings, may look like:
ln -s /MyProjects/MyPlug/build/MyPlug.fxplug /Library/Plug-Ins/FxPlug/MyPlug.fxplug
Once this is complete, you are ready to go. Build and Run, and Final Cut Pro will launch. Click on the “Effects” tab in the “Browser” window, and expand the “Video Generators” folder. Expand the “FirstFxGeneratorPlugin” folder, and double-click “FirstFxGeneratorPlugin”. There is your basic FxGenerator plug-in! If you click on the “Controls” tab in the Viewer window, you can see the controls created by this plug-in (which, for now, is just one control, created by the template). Below is a screen shot of the end result.
The next steps are:
- add our own custom controls
- create JSON data from the extracted values of the controls
- pass that data to Popcorn
- display the results in a web view
I will continue to write about the exciting new plug-in that we are creating, so be on the look out for further posts!