View Full Version : New filters... Logo removal and others
MrTibs
28th October 2003, 00:07
I just posted my new LogoTools plugin. It replaces LogoBlend as well as adding a number of other helper filters.
New Filters:
NoLogo - replaces LogoBlend
NoLogoM - like NoLogo but with better control over the removal - great for problem logos.
Add Logo - add a logo
IfLogo - logo detection
IfNoLogo - logo overcorrection detection (what if I removed the logo when it wasn't there?)
LogoMask - mix two frames based using the logo as a mask.
You can get the filter at:
http://www.geocities.com/mrtibsvideo/Logotools.html
killingspree
2nd November 2003, 11:08
hi MrTibs,
perhaps you are aware of the fact that i wrote the 'logoremoval' part of the capture guide on doom9. since we are always happy to add new possibilities to the guide i would also like to include your filter into the page, but of course first have to check it out a bit :)
unfortunately i have a little trouble getting it to run. perhaps you could explain the different options a little better, which would also aid in the long run as we always like to link to a 'how to' page from the guide.
now this might sound stupid (:D), but what do you exactly mean by 'logo frame number'?
now of course i would assume that you would specifiy a specific frame, or maybe a frame ranger as to where the filter should be applied, but the reference simply doesn't say anything about it :/
anyway, i've tried to use NoLogoAuto aswell as NoLogo and NoLogoM and have ended up with several different exceptional errors from Avisynth. Also it seems that LanczosResize is somehow having trouble with your filters as the script errors out on the line with an 'unrecognized exception'.
any hints would be appreciated!
thanks
steVe
PS: here's (http://www.doom9.org/capture/logo.html) the logoremoval page!
MrTibs
3rd November 2003, 06:51
First, I read you guide and I thought it was excelent. I am very happy that you are considering including NoLogo in your tutorial.
Second, NoLogoAuto was doing some error checking that caused it to post an exception when it was used with a Mpeg2 source. You may want to download the latest version from my site again.
Third, my documentation is horrible so you are right to be confused, here's a quick rundown:
NoLogo and NoLogoAuto were designed to use only video clips as their source. (No need to create BMP files.) In order to remove the logo, NoLogo needs a template so you need to find a frame in the source where the logo appears on top of a black area. With NoLogo only the area under the logo needs to be black while with NoLogoAuto, the entire frame needs to be black. So lets say you luck out and in your source frames 10000-10010 the logo appears on an entire black frame. So your scipt may look like this:
clip=Avisource(.....
clip=NoLogoAuto(clip,clip,10000)
Now this will work but I find that it can be very slow as Avisynth goes back and forth between the current frame and frame 10000. This setup, however is good for testing. What I like to do is make a separate video clip and then load it as "logoclip". For example, to make a logo only clip the script would be:
Avisource(...
Trim(10000,10010)
temporalsmoother(3)
I would load that into VDub and save it as say "abc_logo.avi" in Huffy.
Then when I go back to remove the logo from my original source my script would be:
clip=Avisource(...
logoclip=Avisource("c:\avisynth\abc_logo.avi")
# remember the temporalsmoother will look best at 3 frames
# between the ends of the video so I pick frame 5 of logoclip
NoLogoAuto(clip,logoclip,5)
Everything above applies to NoLogo but you need the logo coordinates and width and height but then you don't need a full black frame for a template. I created a script that will "make" a logoclip sequence on an all black frame so that I can use NoLogoAuto all the time.
NoLogoM is used when the logo is removed but leaves a "mark" behind.
As for IfLogo and IfNoLogo, playing is your best bet but I'll be happy to help since I use them daily.
The other tools come in very handy but will take even more explanation.
I will be happy to offer any tutorial help you want. If you email me at MrTibsVideo@yahoo.com, we can talk back and forth until you are completely satisfied you can get the best out of LogoTools. Then, perhaps your tutorial can replace the LogoTools lousy documentation.
killingspree
3rd November 2003, 17:33
Originally posted by MrTibs
Second, NoLogoAuto was doing some error checking that caused it to post an exception when it was used with a Mpeg2 source. You may want to download the latest version from my site again.
first, thanks for your detailed reply
second, i was using it on a Huffyuv capture, so no mpeg2 :9
third, sorry i'm in a hurry right now, i will come back with more questions after some testing in a couple of hours :)
steVe
killingspree
3rd November 2003, 18:16
hi,
back again, :) somehow i can't leave my hands of some new toy i've discovered :D
still i'm still having 'child deseases' with your tools:
the problem is that, although i actually found a completely black frame with only the logo in it, but somehow the filter only managed to remove the logo as long as it is on black background. as soon as it is infront of some brighter content it did actually reverese the effect and made initially white letters black...
i've emailed a sample of the problem to you along with an original frame!
thanks again for your help,
i'm sure we'll be able to incorporate this into the guide in one way or the other (although a full documentary of the tools would be to much for the guide).
steVe
edit: oh btw, if you are frequently updating your tools version numbers would be great to keep track of the version you currently have on your system!
MrTibs
4th November 2003, 15:39
To eveyone: killingspree got the filter to work for him.
In light of his and others troubles, I've started writing detailed tutorials so that people can easily use the filters. I'll post when they are completed.
MrTibs
5th November 2003, 22:40
I wrote a DeKafka script to work with opaque logos. Since it uses LogoTools, it doesn't do an RGB conversion and also works in Avisyth 2.0.
I uploaded the new LogoTools.Zip file because there was an error in the LogoMask filter. (I also added the DeKafka script to the Zip file.)
I'm going to take a crack at a new "NoLogoBlend" filter to blend out opaque logos.
kxproject
21st March 2005, 17:09
I am trying to use your filter but i fail. May be i have made
mistakes in my script (in fact it's your script for opaque logo). I
have opaque logo, i need to remove it but i get an error- Script
error: expected a parameter name (D:\AVIvideo3.avs, line 5, column
39)
loadplugin("C:\Program Files\avisynth 2.5\loadpluginex.dll")
loadplugin("C:\Program Files\avisynth 2.5\plugins\logotools.dll")
clip=avisource("F:\Capture.avi")
logoclip=avisource("F:\rentvlogoclip.AVI")
function NoLogo_dekafka(clip,logoclip,5,5,582,46,91,41)
{
xborder=720-582-91
yborder=576-46-41
topline=clip.crop(582,46,91,1)
bottonline=clip.crop(582,46+41,91,1)
logosrc=StackVertical(topline,bottonline).blur(1.5,0).bilinearResize(91,41)
logosrc=Addborders(logosrc,582,46,xborder,yborder)
#Uncomment following line for debug mode
#logosrc=logosrc.levels(0,1,255,255,0)
clip=LogoMask(clip,logosrc,logoclip,5,5,582,46,91,41)
return clip
}
Could you help me and tell me what i have done wrong?
Wilbert
21st March 2005, 17:30
Try something like
loadplugin("C:\Program Files\avisynth 2.5\loadpluginex.dll")
loadplugin("C:\Program Files\avisynth 2.5\plugins\logotools.dll")
function NoLogo_dekafka(clip clip, clip logoclip, int logoframe, int brightnesschange,
\\ int xpos, int ypos, int logowidth, int logoheight)
{
xborder = Width(clip)-xpos-logowidth
yborder = Height(clip)-ypos-logoheight
topline = clip.crop(xpos,ypos,logowidth,1)
bottonline = clip.crop(xpos,ypos+logoheight,logowidth,1)
logosrc = StackVertical(topline,bottonline).blur(1.5,0).bilinearResize(logowidth,logoheight)
logosrc = Addborders(logosrc,xpos,ypos,xborder,yborder)
#Uncomment following line for debug mode
#logosrc=logosrc.levels(0,1,255,255,0)
LogoMask(clip,logosrc,logoclip,logoframe,brightnesschange,xpos,ypos,logowidth,logoheight)
}
clip = avisource("F:\Capture.avi").ConvertToYUY2
logoclip = avisource("F:\rentvlogoclip.AVI").ConvertToYUY2
NoLogo_dekafka(clip,logoclip,5,5,582,46,91,41)
1) It won't work for YV12 (you have to adjust crop parameters for that).
2) If your avi is interlaced use ConvertToYUY2(interlaced=true) instead.
3) Make sure the width and height of your logo mask is even (crop if necessary).
4) Make sure xpos and ypos are also even.
kxproject
21st March 2005, 22:47
Wilbert,
I tried your script and it worked. I thought i had to subdtitute all the words: xpos, ypos, logowidth, logoheight by the numbers like
to substitute
xborder = Width(clip)-xpos-logowidth
yborder = Height(clip)-ypos-logoheight
by
xborder = Width(clip)-582-66
yborder = Height(clip)-48-42
But now i see that those words were part of the scipt and that they were commands. Am i right?
But i have a dark border on the edge of the logo. How can i remove it? May it's beacause my logoclip is not completely black?
kxproject
30th March 2005, 02:38
This plugin does not seem to work with avisynth 2.56. I tried to use the script for opaque logos. But when i try to watch the result in the player it closes.
kxproject
30th March 2005, 20:18
removed avisynth 2.56 and installed 2.55 again,
but the plugin does not want to work though it worked some weeks ago.
I use the script:
loadplugin("C:\Program Files\avisynth 2.5\loadpluginex.dll")
loadplugin("C:\Program Files\avisynth 2.5\plugins\logotools.dll")
clip = avisource("F:\Capture.avi")
logoclip = avisource("F:\rentvlogoclip.AVI")
NoLogo_dekafka(clip,logoclip,1,5,570,36,114,60)
function NoLogo_dekafka(clip clip, clip logoclip, int logoframe, int brightnesschange,int xpos, int ypos, int logowidth, int logoheight)
{
xborder = Width(clip)-xpos-logowidth
yborder = Height(clip)-ypos-logoheight
topline = clip.crop(xpos,ypos,logowidth,1)
bottonline = clip.crop(xpos,ypos+logoheight,logowidth,1)
logosrc = StackVertical(topline,bottonline).blur(1.5,0).bilinearResize(logowidth,logoheight)
logosrc = Addborders(logosrc,xpos,ypos,xborder,yborder)
#Uncomment following line for debug mode
#logosrc=logosrc.levels(0,1,255,255,0)
LogoMask(clip,logosrc,logoclip,logoframe,brightnesschange,xpos,ypos,logowidth,logoheight)
}
I get an error Resize: Source image too small for this resize method
(F:\Rentvlogottools.avs, line12)
(F:\Rentvlogottools.avs, line5)
Wilbert
30th March 2005, 23:34
Ok. Open the following script in VDub/VDubMod
loadplugin("C:\Program Files\avisynth 2.5\loadpluginex.dll")
loadplugin("C:\Program Files\avisynth 2.5\plugins\logotools.dll")
clip = avisource("F:\Capture.avi")
logoclip = avisource("F:\rentvlogoclip.AVI")
NoLogo_dekafka(clip,logoclip,1,5,570,36,114,60)
function NoLogo_dekafka(clip clip, clip logoclip, int logoframe, int brightnesschange,
\\ int xpos, int ypos, int logowidth, int logoheight)
{
xborder = Width(clip)-xpos-logowidth
yborder = Height(clip)-ypos-logoheight
topline = clip.crop(xpos,ypos,logowidth,1)
bottonline = clip.crop(xpos,ypos+logoheight,logowidth,1)
return StackVertical(topline,bottonline)
}
and tell me the size of the clip. I guess the height (of the YV12 clip) is two pixels and BilinearResize doesn't like that.
kxproject
31st March 2005, 13:59
Wilbert,
first of all i must say that the clip which i use (F:\capture.avi) has yuv2 but not yv12 format. It was already captured in yuv2 and i guess i do not have to use conversion to yuy2.The clip is 720x576. Logoclip is also 720x576.
I opened that scipt that you wrote in VD and got the following error:
Virtual Dub Error: Avisynth open failure: Avisynth error: yuy2 images for output must have a width divisible by 4 (use crop)!
MrTibs
17th April 2005, 06:30
I've been away from my video stuff for a while so I didn't know people were still using the filters. (NoLogo and FixVHS).
Has anyone tried my StaticFreeze?
kxproject
17th April 2005, 10:27
It would be good if you wrote an extended manual how to use the dekafka function of logotools for opaque logos. I still use VD logoaway to remove logos.
Wilbert
17th April 2005, 13:57
@kxproject,
I think i know what the problem is. Apperently the width of topline (and also borderline) isn't divisible by four. You should take a logowidth which is divisible by four (112 in your case).
Of course you can also convert your clip (and logo) to RGB before feeding it to the NoLogo_dekafka script. This will also work, since RGB has no dimension restrictions.
@Ianb,
Why should the width of a yuy2 clip be divisible by four? Is that necessary?
MrTibs
17th April 2005, 18:44
@kxproject
I agree, I need an extended manual. I believe that most people don't know how to use the filters (they can can be complex to set up) and thus are not getting the best results possible. I'll start on it this week.
kxproject
17th April 2005, 20:40
@Mr. Tibs
I will looking forward to your extended manual coz your filter is really very useful. Many people will appreciate that coz it's the only filter working in yuv2 without rgb conversions and that is great!
What i would like also to see in the manual is the settings for dekafka function, and especially for the case where one part of the logo is just near the black border and as it copies the pixels from the space around it copies the blackness onto the logo.
kxproject
18th April 2005, 11:27
@Wilbert
I changed the parameters to (clip,logoclip,5,5,572,36,112,60). All the dimensions are divisable by 4 but i still get the same error:
Source image too small for this resize method
(F:\Rentvlogottools.avs, line12)
(F:\Rentvlogottools.avs, line5)
MrTibs
18th April 2005, 17:16
I'll work on the manual this week but if you could send me a sample clip (say 5-6 mb) then I could work on your actual issue. Send the clip to Mrtibsvideo@yahoo.com.
As for the the issue of opaque logos, I was working on an in-painting filter that would work wonders. I also did some preliminary dekafka-like filling as well for logos that were large but are made up of thin lines. If there is interest, I'll proceed.
kxproject
18th April 2005, 19:09
@MrTibs
What do you mean by sample clip? Is it the logoclip or the clip with the logo to be removed?
As for the opaque logos of course I am deeply interested in your work. I would like to know everything about your in-painting filter and dekafka-filling. Please, proceed on it and post information how to use it.
MrTibs
18th April 2005, 20:17
I ment a clip with the logo you are trying to remove and a example frame with the logo surrounded by black (I can manually create the frame for the template if necessary.)
The key problem with any of the Dekafka scripts is if the logo touches the edge of the frame. Dekafka uses the outer edge of the paramaters to "blend" out the logo. If the logo touches the edge then you have a bit of a problem. (You can still "solve" it but it will take some work.)
kxproject
19th April 2005, 16:07
I have sent a clip and logoclip to your email.
MrTibs
20th April 2005, 18:01
I got you clips and did some work on them last night. The first thing I need to point out was the your logoclip sampe had the logo sightly to the right and slightly smaller than the video sample. This often happens when the source station edits different segments together. To check if the logos are lined up properly, I used the follwing line to overlay the logoclip onto the original "clip" frame:
LogoMask(clip,logoclip,clip,logoframe,brightnesschange,xpos,ypos,logowidth,
logoheight)
If you do this and you don't see a double logo, you are set.
To "solve" the problem, I used the VirtualDub levels filter to re-create a logoclip sample from the original clip.
Now after some playing this was my script:
function NoLogo_dekafka(clip clip, clip logoclip, int logoframe, int brightnesschange, int xpos, int ypos, int logowidth, int logoheight)
{
xborder=Width(clip)-xpos-logowidth
yborder=Height(clip)-ypos-logoheight
topline=clip.crop(xpos,ypos,logowidth,1)
bottonline=clip.crop(xpos,ypos+logoheight,logowidth,1)
logosrc=StackVertical(topline,bottonline).blur(1.5,0).bilinearResize(logowidth,logoheight)
logosrc=Addborders(logosrc,xpos,ypos,xborder,yborder)
#Uncomment following line for debug mode
#logosrc=logosrc.levels(1,1,255,255,0)
clip=LogoMask(clip,logosrc,logoclip,logoframe,brightnesschange,xpos,ypos,logowidth,logoheight)
return clip
}
################################
logoframe=1
brightnesschange=3
xpos=560
ypos=30
logowidth=130
logoheight=90
#####################################
NoLogo_dekafka(clip,logoclip,logoframe,brightnesschange,xpos,ypos,logowidth,logoheight)
#LogoMask(clip,logoclip,clip,logoframe,brightnesschange,xpos,ypos,logowidth,logoheight)
kxproject
21st April 2005, 02:30
First of all thank you for the work done. But i did not uderstand what you mean by source station? Is it a tv channel or to be more correct tv station which transmits the tv channel?
Where did you put this line
LogoMask(clip,logoclip,clip,logoframe,brightnesschange,xpos,ypos,logowidth,
logoheight)
in the scipt?
Why do you write the word "clip" two times here in this line?
I did not understand this. So i looked through your documentation and found the following example for logomask function:
Example: blur the logo area after removal:
clip=NoLogo(clip,logoclip,3,5,100,150,40,40)
LogoMask(clip,clip.blur(0.5),logoclip,3,5,100,150,40,40)
So i wrote the following script with taking into account my dimensions:
loadplugin("C:\Program Files\avisynth 2.5\loadpluginex.dll")
loadplugin("C:\Program Files\avisynth 2.5\plugins\logotools.dll")
clip=avisource("F:\Capture.avi")
logoclip=avisource("D:\videoarchieve\logoclips\rentvlogoclipold.AVI").ConvertToYUY2(interlaced=true)
Nologo(clip,logoclip,5,5,572,36,112,60)
Logomask(clip,clip.blur(1.5),logoclip,5,5,572,36,112,60)
and i saw some faint write blurring that was slightly to the right from the logo area as you said.
Then I tried to play with VD levels filter to get a correct logoclip but no matter how much i moved the sliders i did not manage to get a competely black logoclip with only white logo visible. Anyway i tried to use the new logoclip but got the same erroe as earlier. May be you could make a little more detailed description or place some screenshots?
MrTibs
25th April 2005, 19:17
Sorry about the delay in replying.
The line "LogoMask(clip,logoclip,clip,logoframe,brightnesschange,xpos,ypos,logowidth,logoheight)" has clip twice because I want to overlay the logo onto the original frame. This line is NOT for logo removal but for comparing the position and size for the logo on the logoclip and the video clip you are trying to remove the logo.
By "source" I mean the original TV station. I have found that my local stations will often move the logo around slightly so I have to re-create a logoclip in order to remove it. I used to draw a frame right from the video clip but I found that it slowed down the filter too much so now I break out the logoclip and save it into a seperate short clip.
As for using the VDub levels filter, I simply changed the settings until the had a near black background around the logo. (There were still grey areas in the rest of the frame but it was black around the logo.) Realistically, you only need a 5-10 brightness difference between the left edge and the logo in order to make a good logo template but you want to use the levels filter to "flatten" out the background and you can do that easily with the levels filter. Also be sure that you choose a non-interelaced frame to use as a template.
I'm sorry I can't provide some screen shots but my work and family is taking all of my time. I'll try to do a better job at keeping up this week.
kxproject
26th April 2005, 03:04
I just have no luck again. I think the cause is the wrong logoclip. I can't figure out what i have done wrong. You made an important note that it is necessary to use non-interlaced frame as template. In fact my logoclips were interlaced. So i have done the following: copied a source frame with logo on black background in VD, pasted it in adobe photoshop and saved as bmp. Opened this bmp in Liquid Edition and made its duration equal to 10 frames and saved as uncompressed clip. So it seems that the logoclip that i made is not interlaced but i still got the same error.:(
MrTibs
26th April 2005, 04:18
@kxproject
Sorry about being stupid but what error are you getting?
Below is DeLogoklip.avi where logo was removed with DeLogo filter at VDM, DeLogo filter can be download from neuron2 web site.
ftp://www.eb.enterpol.pl:eb@www.eb.enterpol.pl/DeLogoklip.avi
kxproject
26th April 2005, 12:33
@MrTibs
I get the following error (it's not about resize method this time):
Evaluate: unrecognized exeption!
(D:\videoarchieve\avisynthscripts\ntvlogotools.avs, line 12)
(D:\videoarchieve\avisynthscripts\ntvlogotools.avs, line 5)
My script is this (i just copied it from the script file how i use it):
loadplugin("C:\Program Files\avisynth 2.5\loadpluginex.dll")
loadplugin("C:\Program Files\avisynth 2.5\plugins\logotools.dll")
clip=avisource("F:\cub2.avi")
logoclip=avisource("F:\ntvlogoclip1.avi").ConvertToYUY2()
nologo_dekafka(clip,logoclip,5,5,76,480,52,36)
function NoLogo_dekafka(clip clip, clip logoclip, int logoframe, int brightnesschange,int xpos, int ypos, int logowidth, int logoheight)
{
xborder=Width(clip)-xpos-logowidth
yborder=Height(clip)-ypos-logoheight
topline=clip.crop(xpos,ypos,logowidth,1)
bottonline=clip.crop(xpos,ypos+logoheight,logowidth,1)
logosrc=StackVertical(topline,bottonline).blur(1.5,0).bilinearResize(logowidth,logoheight)
logosrc=Addborders(logosrc,xpos,ypos,xborder,yborder)
#Uncomment following line for debug mode
#logosrc=logosrc.levels(0,1,255,255,0)
clip=LogoMask(clip,logosrc,logoclip,logoframe,brightnesschange,xpos,ypos,logowidth,logoheight)
return clip
}
Wilbert
26th April 2005, 12:45
Could you upload a few frames of both avis?
kxproject
26th April 2005, 12:56
@Wilbert
I have just edited my last posting. There was a logoclip's logoframe # 265. I changed it by #5. I used # 265 when i used clip's frame as logoframe. When i use a separate logoclip (10 frames length) i use frame #5.
But in both cases i get this error that i wrote in my last post.
Where can i upload my clip and logoclip?
kxproject
26th April 2005, 13:03
By the way my clip is interlaced. Can it be the cause of the problem? May be i should use separatefields(),selectodd(),selecteven(),interleave, weave and process fields separately?
Didée
26th April 2005, 13:15
@ eb
I think this thread is about the filters of MrTibs, not about DeLogo ...
But then, your demo is - a) with 40MB way too big, - b) the first 4MB are very dark and therefore don't show much of interest, - c) the result is not impressing at all. It's just blotched away ...
I like to use DeLogo more in this way (http://home.arcor.de/dhanselmann/_samples/Lost__DeLogo.avi) (2.9 MB). ;)
Thank you Didee for reply.
I am sorry for messing here with DeLogo filter problems, my aim was to present weak points in this clip rather.
I have ask to you, is it possible to implement special button in the delogo configure that will append actual settings of the sliders and corections bitmaps to the frame number and this settings should be valid to the next such setting point, then to the next and so on. By this way we will be able to set individual parameters up to every frame.
As example when scene change from light to dark, when moving elements under logo are horizontal or vertical then streching repaired areas horizontaly or verticaly we can improve efficiency of the filter.
@MrTibs, sorry for overriding your place, I am too weak to be helpful in command line programs here.
eb
MrTibs
26th April 2005, 15:25
Since I have your clips, I'll try your script against them. I aggree that the problem is probably due to my filter not resizing. I'll try to get back to you today or tomorrow.
Didée
26th April 2005, 16:00
@ eb
No, that's not possible with Delogo, when using it directly in VirtualDub. However when using DeLogo through AviSynth (as I do exclusively), then you can do that (and much more) indeed, with some manual work.
But that's really OT here. If you're interested in discussing DeLogo, you should open a new thread for that. (Though I've to admit that since this looong thread (http://forum.gleitz.info/showthread.php?t=15004) on the German board, I've gotten really tired of it. In case you can somehow deal with German language, get the guide (http://forum.gleitz.info/attachment.php?attachmentid=70679).)
kxproject
26th April 2005, 21:51
@MrTibs
Have you checked your filter with avisynth 2.56? It crashes when I try to use dekafka function.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.