The explanation and the directions are in the script. Good luck!
You can test this script simply by making a new document in TextEdit, pasting the HTML code from the clipboard into it and wrapping that code with and tags. Then save the document with a “.html” extension in the same location as the poster frame movie and the original movie file. Then open the html file in Safari.
-- Note: this script uses the application GraphicConverter, so you need this app on your computer to use this script
(* this script will make a "poster frame" movie from the front movie in quicktime player. A poster frame movie is a small movie file that you embed in a web page. When you click on it in the web page it will play the intended movie in the web page in the same location as the poster frame movie. Have you ever seen a "click here to play movie" link in a web page, that's a poster frame movie. The advantage of this is that a web page can fully load and an embedded movie file won't start loading on the web page until the user clicks on the poster frame movie.*)
(* to use this script: first open the movie file you want to embed in a web page in Quicktime Player and then scroll the movie so that the displayed frame is the picture you want used for the poster frame movie... then run this script.*)
(* the result of this script is to 1) create the poster frame movie in the same location as the original movie file with ".poster" appended to the name and 2) give you the html code you need to put in a web page to make this work properly. The html code is placed on the clipboard.*)
-- variables you can change to adjust the text and positioning of it
set the_text to "Click here to play this movie!"
set text_font to "Arial"
set text_size to 16
set text_antialias to true -- antialias text boolean
set text_color to {65535, 65535, 65535} -- this is RGB white text
set text_attributes to 2 --1=bold, 2=italic, 4=underline, 8=outline, 16=shadow, 32=condense, 64=extend, Note: add the numbers for multiple attributes i.e. 3 yields bold and italic
set text_offBottom to 16 -- in pixels, it raises "the_text" off the bottom of the image. Use it to vertically position "the_text".
set blackBox_width to 214 -- in pixels, the width of the black box that surrounds "the_text"
set blackBox_height to 40 -- in pixels, the height of the black box that surrounds "the_text"
set blackBox_offBottom to 5 -- in pixels, it raises the black box off the bottom of the image. Use it to vertically position the black box.
-- get the movie frame and movie information
tell application "QuickTime Player"
if not (exists document 1) then return "no movie open"
stop every document
tell the front document
set movie_file to (get original file)
select none
-- get the name of the movie
set nmExt to my getName_andExtension(movie_file)
set movie_name to item 1 of nmExt
copy -- copy the frame to the clipboard
end tell
end tell
-- set name & location for the poster frame movie file
if length of movie_name is greater than 20 then set movie_name to (characters 1 thru 20 of movie_name) as string
tell application "Finder" to set file_container to container of file movie_file as string
set posterfile_name to movie_name & ".poster.mov"
set poster_file to file_container & posterfile_name
-- open the movie frame and add the text
tell application "GraphicConverter"
new image from clipboard
set qt_controller_height to 16
tell front window
set {the_width, the_height} to image dimension
set center_width to the_width / 2
set the_height to the_height + 16
set image dimension to {the_width, the_height}
set selection to {(center_width - (blackBox_width / 2)) as integer, (the_height - blackBox_height) as integer, (center_width + (blackBox_width / 2)) as integer, (the_height - blackBox_offBottom) as integer}
change brightness to -1000
unselect
end tell
-- sets center point for where the text is drawn
set width_position to the_width / 2 as integer
set height_position to the_height - text_offBottom as integer
set the_point to {width_position, height_position}
set horizontal_justification to 2 -- 0=left, 1=right, 2=center
draw textline into front window text the_text justification horizontal_justification color text_color point the_point font text_font size text_size textface text_attributes antialias text_antialias
save front window in poster_file as JPEG with wwwready
close front window
end tell
-- fix file type and creator type of the poster frame movie
set {ft, ct} to {"MooV", "TVOD"}
tell application "Finder"
set file type of file poster_file to ft
set creator type of file poster_file to ct
end tell
-- write the html embed tag to the clipboard
set embed_tag to "<embed src=\"" & posterfile_name & "\" controller=\"false\" height=\"" & (the_height + 16 as string) & "\" width=\"" & (the_width as string) & "\" href=\"" & (item 1 of nmExt) & (item 2 of nmExt) & "\" target=\"myself\" pluginspage=\"www.apple.com/quicktime/download/\">"
set the clipboard to embed_tag
-- tell you that it's finished
set frontApp to displayed name of (info for (path to frontmost application))
tell application frontApp to display dialog "The Poster Frame Movie has been created in the same location as the movie file, and the HTML code needed to show the poster frame movie was written to the clipboard." & return & return & "Note: the paths to the movies in the HTML code will need to be modified according to where your HTML document is in relation to the movie files." buttons {"OK"} default button 1
(*================= SUBROUTINES ==================*)
on getName_andExtension(F)
set F to F as string
set {name:Nm, name extension:Ex} to info for file F
if Ex is missing value then set Ex to ""
if Ex is not "" then
set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
set Ex to "." & Ex
end if
return {Nm, Ex}
end getName_andExtension