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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th June 2016, 03:36   #1  |  Link
radigast
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)
to have text_color=color_input. As it stands, I currently receive an error that says
Quote:
Script error: the named argument "text_color" to subtitle had the wrong type ([ScriptClip], line1)
Does anybody have any suggestions how to achieve this?

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)

}
radigast is offline   Reply With Quote
Old 20th June 2016, 04:29   #2  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Code:
text_color=Eval(colorinput)
raffriff42 is offline   Reply With Quote
Old 20th June 2016, 04:43   #3  |  Link
radigast
Registered User
 
Join Date: Dec 2009
Posts: 18
Well, there it is. Thank you very much, raffriff42!
radigast is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:15.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.