New Logo Removal filter
I just posted my LogoTools plugin. It replaces LogoBlend as well as adds 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. AddLogo - 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 |
AddLogo ! Great ! A lot of people claimed for taht also.
Congratulation. |
I admit that it seems stupid but perhaps someone may need it. I included it because the code was already there and one way to remove a logo is to cover it up with another logo.
Uses for AddLogo include: 1. Add the logo where it is missing to make removal easier. 2. Add a second logo and remove both for situations where multiple logos appear at different times. 3. Create a "inverted" logo and add it to the frame to help with removal. 4. Cover up a Kafka removal with a logo to hide the errors. |
Thanks for these logo removal tools Mr Tibs im off to download them now. :)
|
One more filter added to the DLL:
NoLogoAuto - same as NoLogo with no fiddling - requires the logo to be on a completely black frame. Example: NoLogoAuto(clip,logoclip,framenumber) |
Quote:
:?: What specifically replaces "logoclip"? :roll: I know these must seem like dumb questions. I have a sample of 10 frames. The name of the sample film is "tenframes.avi". The 5th frame is white logo on black. LoadPlugin("C:\aa\MPEG2Dec3.dll") LoadPlugin("C:\aa\old\loadpluginex2.dll") LoadPlugin("C:\aa\old\LogoTools.dll") avisource("c:\aa\tenframes.avi") #NoLogoAuto(clip,logoclip, logo frame number) NoLogoAuto(clip,"C:\aa\tenframes.avi", 5) I get TMPGEnc error: 'I don't know what "clip" means' |
Clip is the default video clip.
I.E. Quote:
Personally, I usually trim my original video capture and make short video sample with the logo on a black frame then save it as a huffy clip like "abc_logo.avi". My logo script would look something like this: Quote:
Then to filter out the logo: Quote:
|
Quote:
MPEG2Source("C:\My Documents\noisy.d2v") Trim(33333,44444) Undot() Limiter() converttoYUY2(interlaced=true) video = SeparateFields().BicubicResize(480, 240) evenfield = SelectEven(video).TemporalSoften(1,5,8,5,2).peachs moother().Unfilter(60,0) oddfield = SelectOdd(video).TemporalSoften(1,5,8,5,2).peachsm oother().Unfilter(60,0) Interleave(evenfield,oddfield) Weave() Letterbox(16,16,16,16) Limiter() |
Here is the modifed script:
Quote:
You could try this, but I don't know if it will work: Quote:
|
MrTibbs, I'm trying...................
My actual script is below. It does run, but does not remove logo. The logo is on a black frame #20070. I had to put "clip" in several statements [undot(clip), etc] to get it to run. I tried both NoLogoAuto statements and even included frame 20070 within clip itself.
LoadPlugin("c:\video\dlls\MPEG2DEC3.dll") LoadPlugin("C:\video\dlls\old\loadpluginex2.dll") LoadPlugin("C:\video\dlls\old\LogoTools.dll") LoadPlugin("c:\video\dlls\undot.dll") LoadPlugin("c:\video\dlls\unfilter_2.5\unfilter.dl l") LoadPlugin("c:\video\dlls\peachsmoother.dll") clip=Mpeg2source("H:\fut16\fut16.d2v").converttoYU Y2(interlaced=true) logoclip=Trim(clip,20070,20071) clip=trim(clip,3067,20056)+Trim(clip,25940,49383)+ Trim(clip,20070,20071) Undot(clip) Limiter(clip) #NoLogoAuto(clip,clip,20070) NoLogoAuto(clip,logoclip,1) video = SeparateFields(clip).BicubicResize(352, 239) evenfield = SelectEven(video).TemporalSoften(1,5,8,5,2).peachs moother().Unfilter(60,0) oddfield = SelectOdd(video).TemporalSoften(1,5,8,5,2).peachsm oother().Unfilter(60,0) Interleave(evenfield,oddfield) Weave(clip) Letterbox(16,16,16,16) Limiter(clip) |
Your script will not only not remove the logo but would also not apply most of your filters. Here is what you script should look like:
Quote:
|
Sorry, I go to link but dont see how to get Avisynth 2.5 version. I see it says to use LoadPluginEx.dll, but where is that.
I click on how to and it takes me to a page which says see zip file. Does that mean the zip file for avisynth 2.0 file? |
that means that there is no Avisynth 2.5 version. you have to use the 2.0 version for 2.5 through the plugin "LoadPluginEx.dll", which can be downloaded somewhere else.
|
Quote:
Getting TMPGEnc error: Evaluate: Unrecognized exception! (H:\testtibb\testtibb16.AVS, line 17) And a couple questions (please stay patient, I am learning and do appreciate your aid): :?: Is it possible to process in two steps? In other words, to produce a filtered mpg or m2v as I have been doing, then run again, without affecting compression, etc, and removing the logo in a second process. I guess what I'm asking is whether you can process a previously encoded mpg and remove the logo without affecting anything else. :?: Or can you delogo process a capture without affecting the existing encoding, then encode with filters to produce the final mpg? |
Well until now I didn't try my filtering routine in combination with MrTips Delogo routine ... so I can't give you a solution immideately.
But ... Quote:
I had these Problems too when Avisynth got "too hot" (sound stupid but I don't know how to explain using other words *g*) during much tryings and changings. What happens when you load this last script in Vdub??? Also same Error? MOMENT!! STOP now I see! Code:
LoadPlugin("c:\video\dlls\MPEG2DEC3.dll") So .... after this threre doesn't exist anymore a self based mpeg2source-line which provide the frames to the following filter routines! Im thinking right !??? :? Maybe Im confused but this sounds logical ... I would like to attend, but at work (where I'm now) I'm working on a MAC :wink: |
Hm...
Once NoLogo is called, it returns the filtered clip back to the default clip. Clearly, Undot and Limiter don't have trouble so I'm not sure why the problem. Perhaps NoLogo isn't returning the clip properly. You could try this: Quote:
|
Quote:
Also, I have been testing requant with a mpg from this script and same source. Requant is fine up to 82.5% compression, so you might want to experiment with it some. It's fast and simple to use. :?: Is there any way to delogo an encoded mpg without affecting the size, bitrates, etc? Like things I've encoded in the past and didn't keep the large capture files? Really appreciate everything - NickSteel |
[quote="MrTibs"]Hm...
Perhaps NoLogo isn't returning the clip properly. You could try this: Quote:
|
OK, now we are getting somewhere.
Change the frame number in NoLogoAuto to a negative. This will put NoLogoAuto into debug mode and show you where it thinks the logo is. Quote:
|
Sorry, MrTibbs
Quote:
TMPGEnc gives "Evaluate: Unrecognized exception! (H:\testtibb\testtibb16.AVS, line 17" LoadPlugin("c:\video\dlls\MPEG2DEC3.dll") LoadPlugin("C:\video\dlls\old\loadpluginex2.dll") LoadPlugin("C:\video\dlls\old\LogoTools.dll") LoadPlugin("c:\video\dlls\undot.dll") LoadPlugin("c:\video\dlls\unfilter_2.5\unfilter.dl l") LoadPlugin("c:\video\dlls\peachsmoother.dll") clip=Mpeg2source("H:\fut16\fut16.d2v").converttoYU Y2(interlaced=true) logoclip=Trim(clip,20070,20071) clip=trim(clip,3067,20056)+Trim(clip,25940,49383)+ Trim(clip,20070,20071) #NoLogoAuto(clip,logoclip,-1) #we no longer need to specify our default clip. clip=NoLogoAuto(clip,logoclip,-1) Undot(clip) Limiter() video = SeparateFields().BicubicResize(352, 239) evenfield = SelectEven(video).TemporalSoften(1,5,8,5,2).peachs moother().Unfilter(60,0) oddfield = SelectOdd(video).TemporalSoften(1,5,8,5,2).peachsm oother().Unfilter(60,0) Interleave(evenfield,oddfield) Weave() Letterbox(16,16,16,16) Limiter() |
I re-created you script using a Mpeg2 source and confirmed the issue. (funny that it didn't come up with an Mjpeg source?) It was a problem with a error message that wan't comming up.
I have "fixed" the dll and re-posted it on to my site. Please download the new version and try again. Sorry about that. |
Quote:
Thats why we are here, ... to figure out and optimize. Anyhow GREAT work MrTips! |
Hi Mr Tibs, hi Nicksteel, hi incredible:
I'm jumping here from VideoCapture forum. As I explained there I've been making use of Xlogo. But I'm now giving a try NoLogo filter. I work also with mpeg2 captures, so my case is similar to Nicksteel'. I managed to make the filter work. NoLogoAuto detected the logo, but it just "painted" it in black, and now I've got the same logo but in black 8) (I really don't know if this is the way the filter is supposed to work. Please Mr Tibs, make me know). So I tried NoLogoM,... but I just donīt know what the parameters are supposed to do, and how to adjust them. These are my last adjustments: Quote:
Can you help me with these parameters?. Because I still haven't compared it with Xlogo, but I believe it works faster, and maybe as the conversion is to YUY2 and back to YV12, we wonīt lose much quality. Thanx for your filter, and for your help. As you see, several of us are interested in your work, Mr Tibs. :D |
I'm getting same results.
|
@digitall.doc
To answer your question, no NoLogo is not supposed to turn the logo black. Infact, you should get very simular results from NoLogo and Xlogo even though they are not based on the same source code. I suspect that when you get a black logo result, you are applying the filter to a frame where the logo wasn't present. This is what I created the IfLogo and IfNoLogo filters for. The first thing I would try is put NoLogoAuto into debug mode (see higher in this thread). Next I would make a note of the frame number with a black logo and then comment out NoLogo and re-check the source frame to see if it is there. Finally, I would double check the frame I was using as my logo source frame to be sure the logo is there also. Judging from your NoLogoM settings, the logo you are trying to remove is in the top right of the frame. The settings you choose are: 1=Use the full opacity of the logo. (If you find the logo is removed well in darker areas but too much in lighter areas, reduce this number to fractions of one.) 255=Change the scale for the removal from 222 to 255. You modify this if you find the the logo is under or over corrected in the darker or lighter ares but pretty good in the centre. 30=lighten the area under the logo by 30. If the logo is removed correctly but is leaving a dark "shadow" behind. (Use negative numbers to darken the area under the logo.) If all that fails, send me a couple of screen shots of the problem frame before removal (and the logo on a black background). (mrtibsvideo@yahoo.com) |
Hi MrTibs:
sorry I didn't answer earlier: job. I tried putting NoLogoAuto in debug mode... what's supposed to have happend?. All I can see is the image with irregular white lines across the image, and the logo surrounded in white, and the logo white parts in black. When comment out NoLogoAuto, the logo is there, as you said. And my logoclip has the logo indeed. :roll: So, I guess I'll try to make a couple of screenshots, and send then to you, to see what I'm doing wrong. :? |
I suspect that the logo you are trying to remove is not transparent but opaque. Does the logo seem transparent when it is over lighter (not white) areas?
It is pretty easy to test this using LumaGraph. Download lumagraph from my site and set it so the the revesed line goes through the middle of the logo. Load the script into Vdub and watch the graph where the logo is. If the values of the logo area don't fluctuate, then you have a opaque logo. If they move up and down with the area around them, the his is probably a semi-transparent logo. To explain what "may" be happening... If the brightness of the logo is always 238 or higher, then NoLogo is always going to remove at least 238 from the frame thus producing a black logo. With transparent logos, the difference between the area behind the logo and the logo is proportional to the value above the logo in LumaGraph. I know that sounds confusing but if you watch the video with LumaGraph running, you'll see what I mean. Edit: is the logo you are trying to remove the space channel logo? Perhaps I can try capturing from a friend's house so that I can work on an actual sample. |
Mr Tibs:
Oh, you're right, my friend. I'm afraid it's an opaque one (you can see it in the screenshots I sent you). And now I can remember than your previous filter LogoBlend was intended to remove transparent logos, and I guess that is the same for NoLogo. :oops: I'm sorry if this is the case, I made you lose your time. If not, and I can still remove my logo with your filter, make me know. I'll wait for your news 8O 8O 8O |
Your best bet is XLogo or DeKafka. Here is my version of DeKafka
Quote:
|
Hi Mr Tibs:
Hmmm... sorry... thank you... errr :cry: Well, I will try Dekafka. But as I'm so lazy after so much testing :oops: , can you help me with a couple of things... else: - In what colorspace does Dekafka work (I work in YV12)? - Does it work with Avisynth 2.5.2? - Do you know if it converts internally to another colorspace (slower,...)? - And... where can I download it from? Buf, thank you friend. |
Ok, Ok, I guess you think I shouldn't be so lazy :lol: so I looked for some information on Dekafka (Doom9 forum, avisynth,..) but not much.
In avisynth page I found a function, similar to your Dekafka version, but not the same. So, is your Dekafka version to be included directly in the script, or to be saved as a function (*.avsi)?. Is it supposed to substitute the Dekafka function?. And, last (by now), what function is LogoMask, do I have to load a .dll, or is included in avisynth?. Sorry me for making so many questions, but you're very helpful and I'm learning a lot :wink: . |
DeKafka is not realy a filter but rather a script function. It uses standard filters to do the job. The Dekafka script function and be downloaded from the avisynth site. It is designed for 2.5 and YV12. It doesn't do internal colour conversion.
My Dekafka will work for either 2.x or 2.5 and is designed for YUY2. You can use my DeKafka simply by pasting it into you script after de-interlacing. Then adjust the variables until it does the job. |
MrTibbs, DeKafka
Can you change setting in your "DeKafka" that will highlight logo area, like 0 in NoLogo?
|
Yes, set brigthness change to 0 and it will show you the logo area:
Quote:
|
Quote:
LoadPlugin("C:\aa\MPEG2Dec3.dll") LoadPlugin("C:\aa\old\loadpluginex2.dll") LoadPlugin("C:\aa\old\LogoTools.dll") LoadPlugin("C:\aa\undot.dll") logoclip=avisource("c:\aa\testsource.avi").convert toYUY2(interlaced=true) clip0=avisource("c:\aa\testsource.avi").converttoY UY2(interlaced=true) clip1=avisource("c:\aa\testsource.avi").converttoy uy2() clip2=avisource("c:\aa\testsource.avi").converttoy uy2() clip3=avisource("c:\aa\testsource.avi").converttoy uy2() clip4=avisource("c:\aa\testsource.avi").converttoy uy2() clip5=avisource("c:\aa\testsource.avi").converttoy uy2() clip6=avisource("c:\aa\testsource.avi").converttoy uy2() clip7=avisource("c:\aa\testsource.avi").converttoy uy2() clip8=avisource("c:\aa\testsource.avi").converttoy uy2() clip9=avisource("c:\aa\testsource.avi").converttoy uy2() clip=clip0+clip1+clip2+clip3+clip4+clip5+clip6+cli p7+clip8+clip9 undot(clip) ################################ logoframe=4 brightnesschange=0 xpos=540 ypos=410 width=110 height=28 xborder=352-xpos-width yborder=480-ypos-height ##################################### topline=clip.crop(xpos,ypos,width,1) bottonline=clip.crop(xpos,ypos+height,width,1) logosrc=StackVertical(topline,bottonline).blur(1.5 ,0).bilinearResize(34,height) logosrc=Addborders(logosrc,xpos,ypos,xborder,ybord er) LogoMask(clip,logosrc,logoclip,logoframe,brightnes schange,xpos,ypos,width,height) |
First, you are right, I had removed the debug mode from LogoMask and hadn't changed the documenatation. :oops:
Second, I went back to check DeKafka and it does convert to RGB so it may not work some some others. :oops: :oops: Third, presently LogoMask only operates on the Luma so you may not get the results you desire. I did a quick hack to make it work in colour as well, but I can't post it until later today. For now, here are the changes that should work for you. I tested it on my sample video so it should work for you. Quote:
|
I'll wait, as your functions are much easier to use. I tried xlogo until I gave up in frustration.
|
My captures are YV12, so I only do conversion if filters require it. How should I use "brightnesschange"? For instance, should I start at some value and increase/decrease until the logo disappears?
I like this version of DeKafka. |
@nicksteel
I would start out at say 20 and increase as us suggest. The debug line I added in the last post should show you the logo area. I would uncomment the debug line and play with the brightness change until the logo is clearly outlined. I don't know how much noise there is in your source but I don't realy undersand why it wouldn't work with a brightnesschange of 5. (Perhaps I am still missing something.) |
Quote:
|
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.