View Full Version : Help with Crop, StackVertical, Dissolve....
hartford
29th February 2004, 06:00
I'm trying to eliminate a logo that lasts for 15 seconds on a capture.
I've tried all the logo-removers and don't like them. So, I figured
that I'd try to clip and dissolve:
AVISource("e:\wing-a.avi")
clip1=crop(0,0,0,-92)
Clip2=crop(0,388,0,0).Dissolve(blackness(last, 0), last, 46).Dissolve(last, blackness(last, 0), 46)
StackVertical(Clip1, Clip2)
With above I get an error reguarding clip sizes.
This gives no error:
AVISource("e:\wing-a.avi")
clip1=crop(0,0,0,-92)
Clip2=crop(0,388,0,0)
StackVertical(Clip1, Clip2)
but, of course, doesn't do what I want.
What am I doing wrong?
I'm guessing that this should be rolled into a function, but I'm at
a loss as to how to do it.
What I want to do:
On a certain cable station, a transparent logo appears for 15
seconds. The logo is 92 lines tall from the bottom of my 640x480
capture. I want to fade to black before and after the logo.
I need to do this 5 times for the capture.
I've "trimmed" these parts in order to perform the "masking" and will reassemble using AviSynth for the encode.
Any help appreciated.
Thanks.
gircobain
29th February 2004, 08:21
Maybe it is something like this you need?
AVISource("e:\wing-a.avi")
clip = Crop(last, 0, last.Height-92, -0, -0)
clip1 = clip.Trim(0, -46)
clip2 = Blackness(clip, clip.Framecount)
clip3 = clip.Trim(clip.Framecount-46, 0)
clip = Dissolve(clip1, clip2, 46)
clip = Dissolve(clip, clip3, 46)
Overlay(last, clip, 0, last.Height-92)
Didée
29th February 2004, 08:38
No need to be ashamed. Within reasonable time, I also didn't manage to script what I thought that should be scripted.
However, you can use the following, although it's not so perfectly smart:
function FadeBottomLogo (clip clp, int BottomLogoHeight, int FramesToFade) {
top=clp.crop(0,0,-0,-BottomLogoHeight)
logo=clp.crop(0,clp.height-BottomLogoHeight,-0,-0)
totallength=logo.framecount
fadeblack=Blankclip(logo).trim(0,FramesToFade-1)
middblack=Blankclip(logo).trim(FramesToFade,totallength-framestofade-2)
logo1=logo.trim(0,FramesToFade).dissolve(fadeblack,FramesToFade)
logo2=middblack
logo3=fadeblack.dissolve(logo.trim(totallength-FramesToFade,0),FramesToFade)
return( stackvertical( top, logo1+logo2+logo3) )
}
AnySource(YourSource)
FadeLength=50
LogoHeight=96
l1s=100 # start 1st logo
l1e=200 # end 1st logo
l2s=500 # start 2nd logo
l2e=600 # end 2nd logo
trim( 0 , l1s-FadeLength-1) + trim(l1s-FadeLength, l1e+FadeLength-1).FadeBottomLogo(LogoHeight,FadeLength) + \
trim( l1e+FadeLength, l2s-FadeLength-1) + trim(l2s-FadeLength, l2e+FadeLength-1).FadeBottomLogo(LogoHeight,FadeLength) + \
trim( l2e+FadeLength, 0)
# ...
# other filters
# ...
return last
"FadeLength" and "LogoHeight" are obvious, I think. Set them manually according to your needs and taste.
This example covers two ranges where the logo shall be removed, the ranges l1s--l1e (for "Logo1start", "Logo1end") and l2s--l2e.
The lXs/lXe variables specify the first/last frame where the logo is visible, the fading will be done FadeLength before and after that.
For more ranges (you said 5), you have to extend the list of lXs/lXe, as well as the "trim + trim ..." block: for each range with the logo visible, you need one additional line of those. Be careful to change the lXs/lXe variables correctly after adding more lines ;)
I think the whole thingie *should* be possible much easier. However, sometimes I am not completely sure: "Is it me who is that dumb, or is it, erh, ... not me?", mostly when I try to script something obvious and straight-forward, but AviSynth seems to give me bananas and apples only.
(Especially extensive working with Animate/ApplyRange often endangers the need for a new keyboard ... :devil: )
Hope you get it to work
- Didée
stickboy
29th February 2004, 09:15
Originally posted by hartford
I've tried all the logo-removers and don't like them. So, I figured
that I'd try to clip and dissolve:
AVISource("e:\wing-a.avi")
clip1=crop(0,0,0,-92)
Clip2=crop(0,388,0,0).Dissolve(blackness(last, 0), last, 46).Dissolve(last, blackness(last, 0), 46)
StackVertical(Clip1, Clip2)
With above I get an error reguarding clip sizes.The reason you get the error is because in the line:Clip2=crop(0,388,0,0).Dissolve(blackness(last, 0), last, 46).Dissolve(last, blackness(last, 0), 46)last refers to the clip generated by
AVISource("e:\wing-a.avi")not the clip from:
crop(0,388,0,0)As a consequence, you're calling Dissolve on clips with different frame sizes, and it's rightly complaining.
Also, do you intend to call Dissolve on three clips?
a.Dissolve(b, c)is the same as
Dissolve(a, b, c)which combines three clips together.
I assume you mean:
AVISource("e:\wing-a.avi")
clip1 = Crop(0, 0, 0, -92)
clip2 = Crop(0, 388, 0, 0)
clip2 = Dissolve(Blackness(clip2, 0), clip2, 46)
clip2 = Dissolve(clip2, Blackness(clip2, 0), 46)
StackVertical(clip1, clip2)or alternativelyAVISource("e:\wing-a.avi")
clip1 = Crop(0, 0, 0, -92)
clip2 = Crop(0, 388, 0, 0)
clip2 = Dissolve(Blackness(clip2, 0), clip2, Blackness(clip2, 0), 46)
StackVertical(clip1, clip2)
Also, if you're using a combination of Dissolve and Blackness, you probably should look into FadeIn/FadeOut/FadeIO.
Didée
29th February 2004, 09:26
Originally posted by stickboy
...FadeIn/FadeOut/FadeIO.
Lord in Heaven! If my head wasn't planted so tightly, I'd forget it somewhere all time long. :o
:stupid:
Didée
hartford
2nd March 2004, 04:36
Thanks peeps.
I finally, through trial and error, did
AVISource("g:\wing.avi")
v1 = AVISource("g:\wing.avi")
#
clip0 = v1.CropBottom(96)
clip1 = v1.Trim(0,46).Crop(0,384,0,0)
clip2 = v1.Trim(166,213).Crop(0,384,0,0)
clip3 = Dissolve(clip1,blackness(clip1,46),44)+BlankClip(115).Crop(0,384,0,0)+Dissolve(blackness(clip2,46),clip2,44)
#
StackVertical(clip0,clip3)
Haven't figured it as a function, but as long as I watch the number
of frames, it works.
Thanks to all.
hartford
2nd March 2004, 04:50
@stickboy
I wanted to remove a rather large "transparent" logo.
The available logo removers didn't look good when applied.
I decided that it would be best to "fade to black," do black for
x frames, then "unfade." Make sense?
Problem was the "fade-out" and "fade-in," with black in the middle.
With the help here, I finally got what I needed.
Would be nice if AviSynth did a bit of math (if it does, I'm not
aware of it). If so, I could possibly write a function for any
length of "blocking-out."
Again, I thank you for your input.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.