Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
20th June 2016, 03:36 | #1 | Link | |
Registered User
Join Date: Dec 2009
Posts: 18
|
Change color of subtitle() function with user input?
I have a script I am working on that overlays video information onto screenshots. The function basically allows the user to input 2 unique lines of text and also asks for a color input for the text overlay. myFFInfo2("Text1","Text2","Color") I am running AviSynth 2.6.0.6.
The issue I am having is that I'm not sure how to change the text_color to the user input value (textcolor). Basically, I want the line Code:
return scriptclip("subtitle(fftempstring, lsp = 1, text_color=colorinput)", after_frame=true) Quote:
The entire code is as follows. I have verified that a user input of yellow for "colorinput" indeed gives color_yellow as the value in the script (which fits the proper formatting http://avisynth.nl/index.php/Color_presets), but the script errors when text_color=colorinput. Manually changing colorinput to color_yellow makes the text overlay yellow. Code:
function myFFInfo2(clip c, string "bonusText", string "altText", string "colorinput") { varprefix = FFVAR_PREFIX bonusText = default(bonusText, "") altText = default(altText, "") colorinput = default(colorinput, "") c.frameevaluate(""" fftempstring = "" varprefix = """" + varprefix + """" bonusText = """" + bonusText + """" altText = """" + altText + """" colorinput = """" + """color_""" + colorinput + """"""") frameevaluate("""fftempstring = fftempstring + "Frame Number: " + string(current_frame) + " of " + string(framecount()) + "\n" """, after_frame=true) frameevaluate("""fftempstring = fftempstring + "Type: " + chr(eval(varprefix + "FFPICT_TYPE")) + "\n" """, after_frame=true) frameevaluate("""fftempstring = fftempstring + bonusText + "\n" """, after_frame=true) frameevaluate("""fftempstring = fftempstring + altText """, after_frame=true) return scriptclip("subtitle(fftempstring, lsp = 1, text_color=colorinput)", after_frame=true) } |
|
|
|