Skip to content

Instantly share code, notes, and snippets.

Created March 28, 2011 09:28
Show Gist options
  • Save atomicules/890192 to your computer and use it in GitHub Desktop.
Save atomicules/890192 to your computer and use it in GitHub Desktop.
FXScript Counter plugin for Apple's Final Cut Express. Note that this information is probably out of date. It is being added here for reference/archival purposes and relates to a blog post from 2005
// To install this plugin simply place in your FCE plugins directory in your home folder
// In FCE 3 this is:
// ~/Library/Preferences/Final Cut Express User Data/Plugins
// All my notes and comments are included
// With inspiration from and thanks to:
// 0.9.1 - Added in offset
// scriptid "FCE Counter -i5m - v0.9.1 21-Nov-2005" //DO NOT LOCALIZE
filter "FCE Counter", 120;
group "i5m";
input tm_offset, "Hundredths of seconds", slider, 0, 0, 360000;
input fontname, "Font", FontList, "", "str";
input fontsize, "Size", slider, 22, 8, 100 detent 22;
input center, "Center", point, 0, 0;
input fontcolor, "Font Color", color, 255, 255, 255, 255;
Invalentireitem //Used to reset each frame
RenderEachFrameWhenStill //Will make plugin work on stills
code // any variable defined in the code section should resest each frame
float a, d, w, h;
point centeroftm, framesize, tmbox[4]; //[4] makes an array
string text_tim, text_fs, text_secs, text_mins;
float fracsecscounter, fs, secs, mins;
fontcolor.a = 255;
dimensionsof(dest, framesize.x, framesize.y);
centeroftm = framesize;
centeroftm *= center;
fontsize /= 320/framesize.x;
dest = src1; //set to stop fce being stupid
if fps == 25;
fracsecscounter = tm_offset+(100/25)*frame;
end if
if fps == 30;
fracsecscounter = tm_offset+(100/29.97)*frame;
end if
//NTSC counter is slightly out from PAL one? Not sure why
// Following section inspired by 'Clock' generator from TMTS (Too Much Too Soon)
// from Matt Sandstršm
mins = (fracsecscounter/6000);
secs = (mins-integer(mins))*60;
fs = (secs-integer(secs))*100;
numtostring(Integer(mins), text_mins, 0);
if length(text_mins) == 1;
text_mins = "0"+text_mins;
end if;
numtostring(Integer(secs), text_secs, 0);
if length(text_secs) == 1;
text_secs = "0"+text_secs;
end if;
numtostring(Integer(fs), text_fs, 0);
if length(text_fs) == 1;
text_fs = "0"+text_fs;
end if;
text_tim = text_mins + " : " + text_secs + " : " + text_fs;
// End of inspired section
measurestringplain(text_tim, w, h, a, d, aspectof(dest));
makerect(tmbox, centeroftm.x-w/2, centeroftm.y-a/2, w, a);
drawstringplain(text_tim, tmbox, dest, fontcolor, aspectof(dest));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment