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

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th July 2012, 16:40   #1  |  Link
steinsgate
Registered User
 
Join Date: Jun 2012
Posts: 2
font color for ffinfo() and info() function

Hi, is there anyway to change the default font color for the ffinfo() function for ffms2? Same questions for info() function. Thanks!
steinsgate is offline   Reply With Quote
Old 19th July 2012, 17:36   #2  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
"ffinfo()" in ffms2.avsi uses "subtitle()" which allows to specify text colour, etc.

"Info()" doesn't allow changing the text colour.
Groucho2004 is offline   Reply With Quote
Old 19th July 2012, 20:41   #3  |  Link
steinsgate
Registered User
 
Join Date: Jun 2012
Posts: 2
Quote:
Originally Posted by Groucho2004 View Post
"ffinfo()" in ffms2.avsi uses "subtitle()" which allows to specify text colour, etc.

"Info()" doesn't allow changing the text colour.
Wow. Thanks a lot!

I modified the ffms2 script a little bit to add support for text_color and halo_color. This is my first AviSynth script attemp. :P

Code:
# FFmpegSource 1.21 syntax compatibility
# Created by TheFluff
# added text_color and halo_color support to FFINFO() by SteinsGate 7/19/2012
#   ex. FFInfo(text_color=$FFFFFF, halo_color=$FFFFFF)

function FFmpegSource2(string source, int "vtrack", int "atrack", bool "cache", \
	string "cachefile", int "fpsnum", int "fpsden", string "pp", int "threads", \
	string "timecodes", int "seekmode", bool "overwrite", int "width", int "height", \
	string "resizer", string "colorspace", int "rffmode", int "adjustdelay", \
	bool "utf8", string "varprefix") {
	
	vtrack 		= default(vtrack,-1)
	atrack		= default(atrack,-2)
	cache		= default(cache,true)
	cachefile	= default(cachefile,source+".ffindex")
	fpsnum		= default(fpsnum,-1)
	fpsden		= default(fpsden,1)
	pp			= default(pp,"")
	threads		= default(threads,-1)
	timecodes	= default(timecodes,"")
	seekmode	= default(seekmode,1)
	overwrite	= default(overwrite,false)
	width		= default(width,-1)
	height		= default(height,-1)
	resizer		= default(resizer,"BICUBIC")
	colorspace	= default(colorspace,"")
	rffmode		= default(rffmode,0)
	adjustdelay	= default(adjustdelay,-1)
	utf8		= default(utf8,false)
	varprefix	= default(varprefix, "")
	
	((cache == true) && (atrack <= -2)) ? ffindex(source=source, cachefile=cachefile, \
		indexmask=0, overwrite=overwrite, utf8=utf8) : (cache == true) ? ffindex(source=source, \
		cachefile=cachefile, indexmask=-1, overwrite=overwrite, utf8=utf8) : nop
	
	v = ffvideosource(source=source, track=vtrack, cache=cache, cachefile=cachefile, \
		fpsnum=fpsnum, fpsden=fpsden, pp=pp, threads=threads, timecodes=timecodes, \
		seekmode=seekmode, rffmode=rffmode, width=width, height=height, resizer=resizer, \
		colorspace=colorspace, utf8=utf8, varprefix=varprefix)
	
	a = (atrack <= -2) ? blankclip(audio_rate=0) : ffaudiosource(source=source, \
		track=atrack, cache=cache, cachefile=cachefile, adjustdelay=adjustdelay, \
		utf8=utf8, varprefix=varprefix)
	
	return audiodubex(v,a)
}

function FFImageSource(string source, int "width", int "height", string "resizer", \
	string "colorspace", bool "utf8", string "varprefix") {

	width		= default(width,-1)
	height		= default(height,-1)
	resizer		= default(resizer,"BICUBIC")
	colorspace	= default(colorspace,"")
	utf8		= default(utf8,false)
	varprefix	= default(varprefix,"")

	return FFVideoSource(source, cache=false, seekmode=-1, width=width, height=height, \
		resizer=resizer, colorspace=colorspace, utf8=utf8, varprefix=varprefix)
}

function FFCopyrightInfringement(string source) {
################################################################
# Violates copyright
# * With audio
# * No annoying lawyers
# * Simple syntax
# * Do not use on Britney Spears' music videos or sex tapes
#
# And whatever you do:
#   DO NOT TELL NEURON2 THAT YOU USED THIS FUNCTION
################################################################
	FFIndex(source=source)
	return audiodubex(FFVideoSource(source=source), FFAudioSource(source=source))
}

function FFFormatTime(int ms) {

	s = ms / 1000
	ms = ms % 1000
	m = s / 60
	s = s % 60
	h = m / 60
	m = m % 60

	return string(h) + ":" + string(m,"%02.0f") + ":" + string(s,"%02.0f") + "." + string(ms,"%03.0f")
}

function FFInfo(clip c, bool "framenum", bool "frametype", bool "cfrtime", bool "vfrtime", string "varprefix", int "text_color", int "halo_color") {

	framenum	= default(framenum,true)
	frametype	= default(frametype,true)
	cfrtime		= default(cfrtime,true)
	vfrtime		= default(vfrtime,true)
	varprefix	= default(varprefix, FFVAR_PREFIX)
	
	c.frameevaluate("""
		fftempstring = "" 
		varprefix = """" + varprefix + """"""")

	framenum ? frameevaluate("""fftempstring = fftempstring + "Frame Number: " + string(current_frame) + " of " + string(framecount()) + "\n" """, after_frame=true) : nop()
	frametype ? frameevaluate("""fftempstring = fftempstring + "Picture Type: " + chr(eval(varprefix + "FFPICT_TYPE")) + "\n" """, after_frame=true) : nop()
	
	cfrtime ? frameevaluate("""fftempstring = fftempstring + "CFR Time: " + FFFormatTime(round((current_frame * 1000) / framerate())) + "\n" """, after_frame=true) : nop()
	vfrtime ? frameevaluate("""fftempstring = fftempstring + "VFR Time: " + FFFormatTime(eval(varprefix + "FFVFR_TIME")) + "\n" """, after_frame=true) : nop()

	#check whether text_color and halo_color are defined in parameter list
    text_color_string= (Defined(text_color)) ? "text_color="+string(text_color)+"," : ""
    halo_color_string= (Defined(halo_color)) ? "halo_color="+string(halo_color)+"," : ""
    
	return scriptclip("subtitle(fftempstring,"+text_color_string+halo_color_string+"lsp = 1)", after_frame=true)
}
http://pastebin.com/6tRfZQ5W
steinsgate is offline   Reply With Quote
Reply

Tags
avsp, ffinfo, ffms2

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 08:06.


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