View Full Version : Overlay a black bar over some burned-in timecode
dwilbank
28th November 2012, 02:41
Good sirs.
Any examples of how to layer a black rectangle over a certain section of the video source (to cover up some burned-in timecode)
I've already got the script to lay down some new SMPTE - I just need it to completely cover the old SMPTE already present.
Would this be "Mask"?
Asmodian
28th November 2012, 03:36
I think Overlay (http://avisynth.org/mediawiki/Overlay) is what you are looking for.
Also check this post (http://forum.doom9.org/showthread.php?t=166469) for some good info on the subject.
Mug Funky
28th November 2012, 04:46
i tend to do that kind of thing with crop and stackvertical+stackhorizontal.
not as tedious as you'd think :)
lisztfr9
28th November 2012, 11:17
@dwilbank
Virtual Dub has fantastic plugins for removing logo, delogo and logoaway or something, which will rebuild or resynthesize the part they remove, can also be used in blend mode.
dwilbank
28th November 2012, 18:19
Thanks sirs.
I found an example of how to use Overlay, but what about the crop/stack suggestion? No idea where to begin there.
And logo removal is indeed what I would need, but not sure how to script VirtualDub to do what I want.
I'm scripting AVS creation and ffmpeg execution right now (with autohotkey). Unless the logo removal commands could be stuck inside the avs file, I'm not seeing how to use them.
StainlessS
28th November 2012, 18:38
This might be of interest:
http://forum.doom9.org/showthread.php?p=1574364#post1574364
EDIT: Or This:
http://forum.doom9.org/showthread.php?t=154559&highlight=s_exlogo
EDIT: Ignore the 2nd link, forgot the SMPTE bit, 2nd link for de-logo only.
dwilbank
1st December 2012, 01:39
Thanks.
Will try this and see what happens
StainlessS
1st December 2012, 12:31
This should do it (the 2nd link was a bum steer).
ColorBars()
X1=100
X2=400
Y1=100
Y2=200
X1 = X1 - (X1 % 4)
Y1 = Y1 - (y1 % 4)
X2 = (X2 + 3) / 4 * 4
Y2 = (Y2 + 3) / 4 * 4
TimeCode = crop(X1,Y1,X2-X1,Y2-Y1)
Above = Y1 > 0 ? crop(0,0,width(),Y1) : NOP
Below = Y2 < height() ? crop(0,Y2,width(),height()-Y2) : NOP
Left = X1 > 0 ? crop(0,Y1,X1,Y2-Y1) : NOP
Right = X2 < width() ? crop(X2,Y1,width()-X2,Y2-Y1) : NOP
Timecode.Blackness()
IsClip(Left) ? StackHorizontal(Left, last) : NOP
IsClip(Right) ? StackHorizontal(last, Right) : NOP
IsClip(Above) ? StackVertical(Above, last) : NOP
IsClip(Below) ? StackVertical(last, Below) : NOP
return last
A slight mod from Gavino's script.
StainlessS
1st December 2012, 13:10
Perhaps a little more flexible
ColorBars()
X1=100
X2=400
Y1=100
Y2=200
AreaOp(x1,y1,x2,y2,"Blackness()")
#ConvertToYV12().AreaOp(x1,y1,x2,y2,"Descratch()")
Function AreaOp(clip c,int x1,int y1,int x2, int y2, String Op) { # https://forum.doom9.org/showthread.php?p=1603343#post1603343
/*
x1 is left coord.
x2 is leftmost pixel of unprocessed Right border (or x2=Width if no Right border)
y1=top coord.
y2 is topmost pixel of unprocessed Bottom border (or y2=Height if no Bottom border)
op is Operation eg "BlackNess()" OR "Levels(16,1.0,235,235,16,coring=False)"
*/
x1 = x1 - (x1 % 4)
y1 = y1 - (y1 % 4)
x2 = (x2 + 3) / 4 * 4
y2 = (y2 + 3) / 4 * 4
Area=c.crop(X1,Y1,X2-X1,Y2-Y1)
Above = Y1 > 0 ? c.crop(0,0,c.width(),Y1) : NOP
Below = Y2 < c.height() ? c.crop(0,Y2,c.width(),c.height()-Y2) : NOP
Left = X1 > 0 ? c.crop(0,Y1,X1,Y2-Y1) : NOP
Right = X2 < c.width() ? c.crop(X2,Y1,c.width()-X2,Y2-Y1) : NOP
Eval("Area." + OP)
IsClip(Left) ? StackHorizontal(Left, Last) : NOP
IsClip(Right) ? StackHorizontal(Last, Right) : NOP
IsClip(Above) ? StackVertical(Above, Last) : NOP
IsClip(Below) ? StackVertical(Last, Below) : NOP
Return Last
}
Gavino
1st December 2012, 14:32
Function AreaOp(clip c,int x1,int y1,int x2, int y2, String Op) {
...
IsClip(Below) ? StackVertical(Last, Below) : NOP
}
You need to add a final line 'return last' to the function, in case the NOP branch is taken.
('last' is not returned by default, and NOP would be returned instead otherwise.)
StainlessS
1st December 2012, 18:38
OK Big G, will correct.
Off topic, If you did the general recursive routines in advanced scripting on Wiki for SumOfN():- From Knuth (vol1 I think)
function named Terminal(), (n * (n+1)) / 2 which is a bit nippier. Also to avoid partial result overflows either n or n+1 is even
and so can divide that by two instead.
Gavino
1st December 2012, 19:13
Off topic, If you did the general recursive routines in advanced scripting on Wiki for SumOfN() ...
If you are referring to http://avisynth.org/mediawiki/Advanced_Scripting_Tips, I think that was jmac698's work (the page history just shows an IP address for the author).
StainlessS
1st December 2012, 19:59
Yes that was the page (saw it within last few days and thought I must say something before I forgot, Wish I still had my
Knuth Vol 1, and Vol 2, they went to the big library in the sky to join all the other books I've left on trains).
Hope Jmac hears that he has been Mentioned In Dispatches.
Gavino
1st December 2012, 20:27
If you are referring to http://avisynth.org/mediawiki/Advanced_Scripting_Tips, I think that was jmac698's work
See this thread (http://forum.doom9.org/showthread.php?t=159033).
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.