Log in

View Full Version : ShowSMPTE as a stopwatch


thed33p
12th April 2005, 20:51
Hello all AviSynth gurus

I've been battling with something for a couple of days now (with partial success) and I'm hoping one of you clever people can just tell me what I'm doing wrong. Also, before I even get started, let me say that I'm determined to do this in AviSynth rather than an editing package 'cause I REALLY need to get this powerful tool under my belt.

I have 2 clips that I want to run simultaneously and side by side with a "stopwatch" overlayed onto the both of them (so as to do a speed comparison between them). I know I can use ShowSMPTE to do this but the problem is that the time must only start about 4 seconds into the clip. Furthermore, when the event finishes (about 5 seconds before the end of the clip), the stop-time must be displayed until the clip finishes.

Please excuse any incorrect statements that I'm about to make.

1) Using offset doen't help because it only causes the starting time (at clip-start time) to be something other that 00:00:00:00. I tried to specify a negative offset but that causes an error. (I'm using 2.5.6 because the X and Y parameters don't seem to work in 2.5.5)

2) Adding either first_frame or last_frame crashes AviSynth for me - I presume those parameters are exactly the ones i need?

3) As a workaround, I tried to use applyrange(114,1192,"showSMPTE") but I find that adding any parameters in addition to that just crashes AviSynth. The ApplyRange command above does work, but when the time comes in, it comes in at 00:00:04:14 rather than 00:00:00:00

4) When this didn't work, I though I could create the stopwatch in a separate file and then overlay it. I used

blankclip(length=1000,width=192,height=36,pixel_type="rgb32",fps=25,color=$FFFFFF)
showSMPTE(size=35,font="square 721 bt",text_color=$ffff00,halo_color=$000000)

but this isn't working for me either as I don't know how to specify white as the transparent color when I overlay it. (As far as my limited underanding of colourspaces go, I really should be using YV12 but because it has better Alpha-channel support but that said, I've been unable to figure out how to have yellow text on a see-thru background)

5) I'm currently layering the 2 clips with

layer(clip1,clip2,"fast",x=520,y=10)

this is mostly working but the part where the white is layered on top of the bottom clip just reeks of sloppiness.


I've been trying to do this over the past 3 days and now I have a headache as well as sore eyes from reading the manual & other googled pages about a 1000 times over! :D (Also, as far as the n00b is concerned, the AviSynth manual is written for people that already know how to use it. :D:D)

So thanx for reading my story, please pass on any pearls of wisdom if you wish.

TIA

Wilbert
12th April 2005, 21:38
1) Using offset doen't help because it only causes the starting time (at clip-start time) to be something other that 00:00:00:00. I tried to specify a negative offset but that causes an error. (I'm using 2.5.6 because the X and Y parameters don't seem to work in 2.5.5)

Negative offsets are not allowed yet :)

2) Adding either first_frame or last_frame crashes AviSynth for me - I presume those parameters are exactly the ones i need?
That's an error in the documentation (those options are not available). I will correct it.

3) As a workaround, I tried to use applyrange(114,1192,"showSMPTE") but I find that adding any parameters in addition to that just crashes AviSynth. The ApplyRange command above does work, but when the time comes in, it comes in at 00:00:04:14 rather than 00:00:00:00
Is this also the case for v2.55?

4) When this didn't work, I though I could create the stopwatch in a separate file and then overlay it. I used

blankclip(length=1000,width=192,height=36,pixel_type="rgb32",fps=25,color=$FFFFFF)
showSMPTE(size=35,font="square 721 bt",text_color=$ffff00,halo_color=$000000)

but this isn't working for me either as I don't know how to specify white as the transparent color when I overlay it. (As far as my limited underanding of colourspaces go, I really should be using YV12 but because it has better Alpha-channel support but that said, I've been unable to figure out how to have yellow text on a see-thru background)
YV12 has no alpha support. You should take the showSMPTE clip, make a mask (using Mask) and use that in Overlay (see examples in Overlay). If you make a black clip (using BlankClip) and use white SMPTE text, you can use that as mask.

thed33p
12th April 2005, 21:45
Is this also the case for v2.55?

I'm not sure but the arguments I want to use (X and Y co-ords) don't seem to work in 2.55 anyway.

Wilbert
12th April 2005, 21:59
No, that's right. I added those in v2.56 beta.

thed33p
13th April 2005, 00:33
Halfway there!

Here's what I did:

clip= avisource("video1.avi")
timer= blankclip(length=1000,width=192,height=36,pixel_type="rgb32",fps=25,color=$FFFFFF)
cmask= blankclip(length=1000,width=192,height=36,pixel_type="rgb32",fps=25,color=$000000)

timer=timer.showSMPTE(size=35,font="square 721 bt",text_color=$ffffff,halo_color=$000000)
cmask=cmask.showSMPTE(size=35,font="square 721 bt",text_color=$ffffff,halo_color=$000000)

return overlay(clip, timer, x=520, y=10, mask=cmask, opacity=1, mode="subtract")


Thanx for the tip, Wilbert! Now I'm gonna try the timing thing.....:cool:

thed33p
13th April 2005, 06:03
I've come up with the following script (after much reading and head-scratching) and it all works, other than the bit where the timer is meant to freeze frame round frame 1191.

Could you please have a quick look and let me know what I'm missing?

Thanx


clip= avisource("movie1.avi")
clipspy=EffectLens(clip,80,140,100,2,590,278)

f1=0
f2=114
f3=1191
f4=1311
start=(f2-1)
stop=(f4-f2+1)

timer= blankclip(length=stop,width=192,height=36,pixel_type="rgb32",fps=25,color=$FFFFFF)
cmask= blankclip(length=stop,width=192,height=36,pixel_type="rgb32",fps=25,color=$000000)

timerj=timer.showSMPTE(size=35,font="square 721 bt",text_color=$ffffff,halo_color=$000000)
cmaskj=cmask.showSMPTE(size=35,font="square 721 bt",text_color=$ffffff,halo_color=$000000)

clip1=trim(clipspy,f1,start)
clip2=trim(clipspy,f2,f4)

time1=freezeframe(timerj,stop,f4,f3)
clock=overlay(clip2, time1, x=520, y=10, mask=cmaskj, opacity=1, mode="subtract")

final=unalignedsplice(clip1,clock)

return final

PS I'm quite proud of this - it's my 1st decent script ever :D