ScottZ
10th July 2005, 13:19
I haven't been able to find a timecode burn-in filter with src.
Is there src for something like this?
Thanks!
Wilbert
10th July 2005, 13:27
ShowSMPTE: http://www.avisynth.org/Showframes
IanB
10th July 2005, 13:56
text-overlay.cpp Download (http://cvs.sourceforge.net/viewcvs.py/*checkout*/avisynth2/avisynth/src/filters/text-overlay.cpp) or View (http://cvs.sourceforge.net/viewcvs.py/avisynth2/avisynth/src/filters/text-overlay.cpp?view=markup)
IanB
Mug Funky
10th July 2005, 16:39
i wrote something, but it's broken for anything but PAL TC and milliseconds. good for subtitling though.
it's made to emulate the superimposed timecodes on VTRs. i'll post it if you want. not too useful except for me...
communist
10th July 2005, 17:03
I'd be interested in it Mug - since I mostly play around with PAL (DV) stuff :)
Even if mostly because of visual difference to ShowSMPTE ;)
Mug Funky
12th July 2005, 10:49
here you go:
#
# Mug's Timecode stuff.
#
# tc:
# enter a timecode string in quotes, and out comes an integer frame number.
#
# itc:
# reverse of tc - enter a frame number, and out comes a SMPTE timecode.
#
# - for both of these, you can enter a framerate as well (last.framerate is useful)
#
#
# super:
# outputs a SMPTE timecode in a shaded box. useful for subtitling.
#
# - you can also enter a "start timecode" in quotes (like "10:00:00:00")
# which helps if you're syncing with a tape's timecode.
#
function tc (string "timecode", float "rate")
{
rate=default(rate,25)
frames=value(rightstr(timecode,2))
secs=value(rightstr(timecode,5).leftstr(2))*rate
mins=value(rightstr(timecode,8).leftstr(5))*60*rate
hours=value(rightstr(timecode,11).leftstr(8))*60*60*rate
int(hours+mins+secs+frames)
}
function itc (int "framecount", float "rate", bool "ms")
{
rate=default(rate,25)
ms = default(ms, false)
drop = (rate==29.97)? true : false
rate2 = (drop==true)? 30 : rate
hours=floor((framecount/rate)/3600)%60
mins=floor((framecount/rate)/60.0)%60
secs=floor(framecount/rate)%60
milli=floor(1000*framecount/rate)%6000%1000
fmilli=framecount/rate - floor(framecount/rate)
#frames=floor(fmilli*rate2)
frames=framecount%int(rate)
dframes = (drop==false)? frames : (secs==0)&&(mins%10!=0)? floor(fmilli*rate2) + 2 : frames
return (ms==false)? (string(hours,"%02.0f")+":"+string(mins,"%02.0f")+":"+string(secs,"%02.0f")+":"+string(frames,"%02.0f")) :
\ (string(hours,"%02.0f")+":"+string(mins,"%02.0f")+":"+string(secs,"%02.0f")+":"+string(milli,"%03.0f"))
}
function super (clip c, string "offset", bool "ms")
{
global rate = c.framerate
global bheight=int(c.height*0.15/4)*4
bwidth=int(c.width*0.4/4)*4
off=int(c.height*0.15/4)*4
ms = default(ms, false)
offset = default(offset,"00:00:00:00")
global offset = tc(offset)
global ms = ms
box=c.crop((c.width-bwidth)/2, c.height-(bheight+off), bwidth, bheight).levels(0,1,255,0,160)
left=c.crop(0, 0, (c.width-bwidth)/2, 0)
right=c.crop((c.width-bwidth)/2 + bwidth, 0, (c.width-bwidth)/2, 0)
top=c.crop((c.width-bwidth)/2, 0, bwidth, c.height-(bheight+off))
bottom=c.crop((c.width-bwidth)/2, c.height-off, bwidth, off)
box = ScriptClip(box, "Subtitle(String(itc(current_frame+offset, rate, ms=ms)),align=2,y=int(.225*bheight) + bheight/2, size=round(.45*bheight), spc=int(.3*bheight), text_color=$ffffff)")
middle=stackvertical(top,box,bottom)
stackhorizontal(left,middle,right)
}
i wouldn't call it shakespeare-in-script or anything, but the output looks pretty cool.
matrix
16th July 2005, 02:26
function counter(clip clip, int n)
{
n = n / clip.framerate()
min = int(n / 60)
mins = string(min)
mins = min < 10 ? "0" + mins : mins
n = n - min * 60
sec = int(n)
secs = string(sec)
secs = sec < 10 ? "0" + secs : secs
ms = string(int(1000 * (n - sec)))
ms = strlen(ms) < 2 ? "0" + ms : ms
ms = strlen(ms) < 3 ? "0" + ms : ms
time = mins + ":" + secs+ ":" + ms
clip.subtitle(time, x=540, y=450, font="times new roman", size=28)
}
avisource("d:\clip.avi")
scriptclip("counter(current_frame)") # For upcounting time
#scriptclip("counter(framecount-current_frame)") # For countdown
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.