View Full Version : DelogoHD
MeteorRain
12th July 2019, 19:52
DelogoHD is an overhaul of the original delogo (https://github.com/makiuchi-d/delogo-avisynth) filter, which was originally written by MakKi many years ago. It also deprecates my previous porting project VapourSynth-DeLogo (https://github.com/HomeOfVapourSynthEvolution/VapourSynth-DeLogo).
Legacy parameters are removed due to analog TV signal being deprecated years ago.
This filter provides both AviSynth+ and VapourSynth interfaces. It compiles under both MSVC and GCC.
It requires at least a SSE4.1 compatible CPU to run.
https://i.imgur.com/0CCD7t0.jpg
Usage
# AviSynth+
DelogoHD(clip, "CCAV 3840x2160.lgd", start = 5, end = 95, fadein = 2, mono = true, cutoff = 5)
AddlogoHD(clip, "CCAV 3840x2160.lgd", start = 5, end = 95, fadein = 2, mono = true, cutoff = 5)
# VapourSynth
delogohd.DelogoHD(clip, "CCAV 3840x2160.lgd", start = 5, end = 95, fadein = 2, mono = True, cutoff = 5)
delogohd.AddlogoHD(clip, "CCAV 3840x2160.lgd", start = 5, end = 95, fadein = 2, mono = True, cutoff = 5)
Parameters
- clip
A clip to process. It must have constant format and it must be YUV 8..16 bit with integer samples.
YUV420P8/10/12/14/16, YUV422P8/10/12/14/16, YUV444P8/10/12/14/16.
- logofile
Logo file in lgd format.
- logoname
Logo name to be selected from logo file.
Default: `NULL`, selecting the first one.
- start, end
First and last frame that has the logo.
Default: From 0 to Max
- fadein, fadeout
Number of fading frames.
Default: 0
- left, top
Number of pixels in adjusting logo position.
For example, `left = -5` results logo being 5 pixels left to its original position.
Default: 0
- mono
Force mono logo, wiping chroma part of the logo.
Default: false
- cutoff
Wiping near-transparent part of the logo, if its depth is lower than cutoff. Should be less than 1000 (Max logo depth).
Default: 0
Natty
12th July 2019, 22:39
:thanks::cool:
tebasuna51
13th July 2019, 10:28
...
- logofile
Logo file in lgd format.
Please, some info about lgd format and how create it.
MeteorRain
14th July 2019, 04:01
Please, some info about lgd format and how create it.
The original tool was built by MakKi back in 2003.
The tool was originally made for AviUtl, being only used within Japan, and is all in Japanese language. It was used to remove the half-transparent TV station logo from captured analog or digital TV programs. But it should also work with other logos as long as they are static and half-transparent. I've tested against Pilot's Eye Bluray Disc and it worked very well. Some porn video that comes with half-transparent logos from their publisher can also benefit, but I never tried.
I have translated the logo header file so you may check that for detailed structure.
Basically a LGD consists of a magic, a name, meta like w h posx posy etc, and the body which is array of actual logo image.
The image was in 12bit Y/Cb/Cr format, which is sometimes called as AviUtl YC colorspace. Alpha channel is recorded for each channel, so it's actually Y/A/Cb/A/Cr/A format. The YCbCr color space is different than what we use as YUV, and during computing, the original Delogo AVS plugin has to convert pixels to AU-YC, remove the logo, then convert them back to YV12. I have re-written the algorithm and it no longer converts data back and forth.
To create a LGD file, the only possible way is to use AviUtl (in Japanese). A Chinese tutorial about how to use the Japanese plugin is available here. (https://www.nmm-hd.org/newbbs/viewtopic.php?f=7&t=42) Knowing both Chinese and Japanese is recommended to read the tutorial. I've also built a website for my collections of LGD logos (https://down.7086.in/lgd/) these years so far.
tebasuna51
14th July 2019, 10:03
Then to create a .lgd of the logo we need install AviUtl, maybe from https://www.videohelp.com/software/AviUtl
Add the logoscan plugin, maybe from http://blog.livedoor.jp/swing26/logoscan_007.zip.zip
And learn chinese and japanese to know how to do.
Too complicated for me, sorry.
wonkey_monkey
14th July 2019, 11:46
Too complicated for me, sorry.
Yes, the ability to accept the logo from another video clip would make a lot more sense, especially as clean logos can often be found in black sections of video. To speed up processing it could be cropped, and an offset passed as parameters to the filter.
lansing
14th July 2019, 19:59
Then to create a .lgd of the logo we need install AviUtl, maybe from https://www.videohelp.com/software/AviUtl
Add the logoscan plugin, maybe from http://blog.livedoor.jp/swing26/logoscan_007.zip.zip
And learn chinese and japanese to know how to do.
Too complicated for me, sorry.
Well the logo database is getting really huge now, to a point that we don't need to make on our own. Just grab the one you need and use it. And in case you have a newer one, just post a request and I'm sure others can help make it for you.
MeteorRain
15th July 2019, 20:22
Yes, the ability to accept the logo from another video clip would make a lot more sense, especially as clean logos can often be found in black sections of video. To speed up processing it could be cropped, and an offset passed as parameters to the filter.
It would be impossible. A half-transparent logo has alpha channel information, and must be computed from multiple solid color samples.
The logoscan tool filters logo images by checking the color on the edge. If all pixels on the edge are colors within threshold, it's considered as a solid color. Blue sky and solid color wall are good background for making those samples.
Now suppose you have logos on solid purple / red / black / white / blue, etc, next step is linear regression. It figures out the parameters of the linear function, Y' = Y * (d / MAX_DP) + c, where d and c are parameters to be computed. Once you get d and c for all 3 channels of all pixels, you can add or remove the logo from the image.
Transplanting a logo from a pure black image won't give you the linear function parameters and thus is not possible to remove logos in this way.
wonkey_monkey
15th July 2019, 22:27
It can be done if the logo can be considered to be white (or, slightly more complex, any solid colour if you can determine what it is), as the three examples posted all seem to be, and as many logos are:
https://i.imgur.com/8LnLMQ8.png
It's not perfect, but it was a rush job and it's a more solid logo than the three examples.
2ndR
6th November 2019, 13:45
Sorry for posting in machine translation
Is there no interlace option but is DelogoHD only for progressive?
Or do you read and process the field order?
mastrboy
7th August 2020, 22:32
I've also built a website for my collections of LGD logos (https://down.7086.in/lgd/) these years so far.
Thanks for providing those lgd files, you actually had a file for the one I was looking for.
loonvf
9th July 2021, 16:56
Hi All,
Anyone has some good experience with DelogoHD?
Very little info on the forum here and I plan to use it to remove some fixed camera / film gate artifacts on my frames.
Any experience / examples would be much appreciated (or alternative suggestions).
Thanks,
Loonvf
VoodooFX
11th July 2021, 10:07
Any experience / examples would be much appreciated (or alternative suggestions).
I never tried DelogoHD, only that old plugin it's based on, it was hard to figure it out how to make it work on new logo and then the results were not satisfactory in comparison to Vdub's Delogo results.
As alternative you can try InpaintDelogo (https://forum.doom9.org/showthread.php?t=176860).
Satoshi18
11th August 2021, 09:13
Where do I download the plugin from?
Reel.Deel
11th August 2021, 09:48
Where do I download the plugin from?
https://github.com/HomeOfAviSynthPlusEvolution/DelogoHD/releases/
Flash_Bang
15th September 2021, 05:11
How to use 1440x1080 logo file with 1280x720 video
kedautinh12
15th September 2021, 05:32
How to use 1440x1080 logo file with 1280x720 video
Upscale to 1440x1080
Reel.Deel
15th September 2021, 06:05
How to use 1440x1080 logo file with 1280x720 video
Can you upload a small sample of the video? From my understanding DelogoHD is supposed to be a more precise way to remove logos as long as the is identical to the one in the video. Hence why there is a library of logos that were created from over the air broadcast (mainly Japan). But here the source of the logo is 4x3 and your video is 16x9, I suspect that if the logos are not perfectly aligned it may not work correctly.
Flash_Bang
15th September 2021, 06:11
Upscale to 1440x1080
i tried but it did not work
Flash_Bang
15th September 2021, 06:12
Can you upload a small sample of the video? From my understanding DelogoHD is supposed to be a more precise way to remove logos as long as the is identical to the one in the video. Hence why there is a library of logos that were created from over the air broadcast (mainly Japan). But here the source of the logo is 4x3 and your video is 16x9, I suspect that if the logos are not perfectly aligned it may not work correctly.
ok here is the video : https://drive.google.com/file/d/1PdtRWcTztQgxPQalk_FgOJYSCiQKPuRW/view?usp=sharing
Reel.Deel
15th September 2021, 08:35
ok here is the video : https://drive.google.com/file/d/1PdtRWcTztQgxPQalk_FgOJYSCiQKPuRW/view?usp=sharing
I looked at the lgd and it does not look exactly the same as in your video. The video logo looks like it's a bit stretched. Aside from learning how to making a lgd file or trying to resize the video and adjusting the placement of the logo so that the two logos are more or less identical, I suggest just finding a frame were the logo is over something dark and then using InpaintDelogo (https://forum.doom9.org/showthread.php?t=176860).
Edit:
So, I got curious and learned how to make an ldg file. Downloaded the English version of aviutl (v1.14) (https://www.videohelp.com/software/AviUtl), loaded the avs script into it, selected the "logo analysis" tool, set start/end markers for a set of frames that I thought would be good to analyze (~1500 frames). Then drew a rectangle around the logo with a few extra pixels for padding, set the threshold to 128 and started to analyze the logo. Saved the ldg file and loaded it into AviSynth+.
https://i.ibb.co/myQWpqt/delogohd-result.png (https://imgbb.com/)
Not bad :) .... Here's the ldg file: test 1280x720-128.lgd (https://files.videohelp.com/u/223002/test%201280x720-128.lgd)
And script used was:
LSMASHVideoSource("899.mp4")
DelogoHD(logofile="test 1280x720-128.lgd")
Flash_Bang
15th September 2021, 08:55
thank you but when I run THE SCRIPT I get this error : System exception - Illegal Instruction
Reel.Deel
15th September 2021, 09:15
thank you but when I run THE SCRIPT I get this error : System exception - Illegal Instruction
Didn't you already try using DelogoHD when you tried upscaling to 1440x1080?
Flash_Bang
15th September 2021, 13:32
When I tried it just played video with logo
Flash_Bang
16th September 2021, 05:35
My cpu does not support sse4.1 so, I used delogo instead of delogo hd and i got same results
Reel.Deel
16th September 2021, 05:45
My cpu does not support sse4.1 so, I used delogo instead of delogo hd and i got same results
I was wondering why it didn't work since you said you had tried it. Did you get the same results as the picture I posted?
Edit:
yes I got same results and how do i export the video
You may want to look at different threads here on how to that. There are various options, for example you can use ffmpeg/x264 directly as they accept an avs script. Or you can use VirtualDub2 to export your video. But that is outside of the scope of this thread, if you wish you can open a thread in the newbies section or the AviSynth usage section and we'll help you out :)
Flash_Bang
16th September 2021, 06:13
yes I got same results and how do i export the video
VoodooFX
17th September 2021, 00:34
So, I got curious and learned how to make an ldg file. Downloaded the English version of aviutl (v1.14) (https://www.videohelp.com/software/AviUtl), loaded the avs script into it, selected the "logo analysis" tool, set start/end markers for a set of frames that I thought would be good to analyze (~1500 frames). Then drew a rectangle around the logo with a few extra pixels for padding, set the threshold to 128 and started to analyze the logo.
That's nice lgd, bit better than what AvsInpaint produced with 2 frames (dark and white). Do you remember what range you set, because I can't produce an useful lgd? I don't see a way to set multiple ranges there too. It wasn't loading avs file (just hanged taking cpu).
Reel.Deel
17th September 2021, 03:23
That's nice lgd, bit better than what AvsInpaint produced with 2 frames (dark and white). Do you remember what range you set, because I can't produce an useful lgd? I don't see a way to set multiple ranges there too. It wasn't loading avs file (just hanged taking cpu).
I don't remember the exact range I used but I went by MeteorRain's suggestion: Blue sky and solid color wall are good background for making those samples.
I made another lgd using the range 985-12872 (which I believe was the range on the original ldg but not as long) and got the same results as first lgd. You mentioned that you used aviutl directly, when I tried that I also got bad results. Not sure If I did something wrong or what but when I loaded the avs script onto aviult I got the good results from the lgd.
Second lgd: test2 1280x720-30.lgd (https://files.videohelp.com/u/223002/test2%201280x720-30.lgd)
Settings:
https://i.ibb.co/ZHfb8gJ/delogohd-settings.png (https://imgbb.com/)
I read on a few sites that the threshold at default value (30) is a good value so I left it alone, on the first lgd I set it to 128.
VoodooFX
17th September 2021, 09:06
I made another lgd using the range 985-12872 (which I believe was the range on the original ldg but not as long) and got the same results as first lgd. You mentioned that you used aviutl directly, when I tried that I also got bad results. Not sure If I did something wrong or what but when I loaded the avs script onto aviult I got the good results from the lgd.
It looks like those bad lgds are not because of loading mp4 directly nor range selection, there is some kind of bug in AviUtl/Logo analysis. It's unclear why it happens, but when it does then you can select different ranges, settings, area - resulting lgds always are not good. After AviUtl restart it usually starts producing good lgds.
Did you installed some filter for avs loading, I don't see anything for avs in the pack?
That threshold I imagine is max value between min-max luminance, or something similar, so you don't need to select the frame ranges manually. I think similar feature could be added to InpaintDelogo.
EDIT:
Found how to produce it: "Y" must be odd, if you set it to even then all good again.
Here how the bug looks (top right corner):
https://i.imgur.com/KVZwUTY.png
Reel.Deel
17th September 2021, 09:58
Did you installed some filter for avs loading, I don't see anything for avs in the pack?
No, everything came in the pack that I linked to in post #21. I believe it uses L-SMASH Works File Reader to open an AviSynth script.
I did install an updated version of LogoScan but that was after I made the first successful lgd.
https://github.com/emako/Delogo-Aviutl
-----
One thing I wish DelogoHD had would be the ability to output just a black and white mask padded to the width and height of the input clip. DelogoHD seems to affect some areas just below below the logo. With a mask that can be easily fixed and even do some additional denoising just on the logo area. Although, there's already a script (LogoNR (https://www.nmm-hd.org/newbbs/viewtopic.php?t=649)) that does denoising on the logo area by cropping, filtering and then overlaying the result onto the clip. Edit: Well scratch that idea, AddlogoHD can be used with the same lgd to add the logo onto a blankclip to create a logo mask. Cool stuff :)
Edit:
EDIT:
Found how to produce it: "Y" must be odd, if you set it to even then all good again.
Here how the bug looks (top right corner):
https://i.imgur.com/KVZwUTY.png
You know I was actually thinking the same. With the bad lgd I tried moving the mask in DelogoHD +/- 1 pixel and it would always off. I just did not try to find out what caused it. Nice find VoodooFX. Maybe I will write a small tutorial on how to create an lgd file since it's very simple to do and produces very nice results.
VoodooFX
17th September 2021, 11:01
No, everything came in the pack that I linked to in post #21. I believe it uses L-SMASH Works File Reader to open an AviSynth script.
What is content of your avs script?
One thing I wish DelogoHD had would be the ability to output just a black and white mask padded to the width and height of the input clip. DelogoHD seems to affect some areas just below below the logo.
It deblends that whole square area, not only logo.
Here InpaintDelogo for comparison:
InpaintDelogo( mask="d:\mask.bmp",
\ Automask=0, aMix=2, Loc="1124,24,-52,-636",
\ Mode="Deblend", Analyze=3, FrB=12369, FrW=8993, FrS=3,
\ Inflate=2, Deep=0, IntSpd=2, Interp=1, dPP=2)
Just the first frames I found, these are too bright and too dark frames I think, should be better with less bright/dark ones (mind FrS if you'll try other frames).
First run with Automask=1 to generate b/w mask, then set back to 0.
Set Interp and dPP to 0 to see pure deblending.
Reel.Deel
17th September 2021, 11:15
What is content of your avs script?
Just a source filter for FlashBang's video in post #20.
LSMASHVideoSource("899.mp4")
And it worked in aviutl. I did have to comment out the LoadPlugin call in the first line though because the video would not load in aviutl.
It deblends that whole square area, not only logo.
I might of been mistaken, with my original lgd I saw that it affected slightly other areas below the logo. But looking at it again with the updated lgd I can't really spot it anymore. I compared against:
src = LSMASHVideoSource("899.mp4")
delogo = DelogoHD(src, logofile="test2 1280x720-30.lgd")
mask = Blankclip(src, color_yuv=$000000).AddlogoHD(logofile="test2 1280x720-30.lgd").mt_binarize(1)
mt_merge(src, delogo, mask, u=3, v=3, luma=true)
But the masked delogo video and the plain delogo video look identical around the logo area.
Here InpaintDelogo for comparison:
Will try it out tonight. It's 5am here and time to get some sleep :)
VoodooFX
17th September 2021, 20:47
I did have to comment out the LoadPlugin call in the first line though because the video would not load in aviutl.
Oh, that's why.
I might of been mistaken, with my original lgd I saw that it affected slightly other areas below the logo. But looking at it again with the updated lgd I can't really spot it anymore.
For your test you've used your second lgd, the first lgd was done with bad threshold, maybe you've seen that effect on the first one.
Btw, those "bad" lgds are actually good in AviUtl, but gets borked in DelogoHD.
Flash_Bang
18th September 2021, 15:47
I found delogo filter for aviutl : https://github.com/emako/Delogo-Aviutl/releases/tag/r1
Reel.Deel
18th September 2021, 22:30
For your test you've used your second lgd, the first lgd was done with bad threshold, maybe you've seen that effect on the first one.
Yes the threshold being set to 128 on the first lgd is what caused it.
https://i.ibb.co/MPTm4dn/delogohd-threshold.png (https://imgbb.com/)
Threshold parameter in LogoScan: Threshold value to determine if the background is a single color. The higher the value, the more lenient the judgment.
Btw, those "bad" lgds are actually good in AviUtl, but gets borked in DelogoHD.
The "bad" lgds are also good in MakKi's original Delogo plugin (https://github.com/makiuchi-d/delogo-avisynth) for AviSynth. I also checked putin's Delogo/Delogomod from 2014 and they're are also good. So DelogoHD is the culprit.
I found delogo filter for aviutl : https://github.com/emako/Delogo-Aviutl/releases/tag/r1
Yes, I linked to it in post #31 :) ... it includes both ScanLogo and Delogo for aviutl but in English. An older version is already included in the aviutl English package.
Reel.Deel
19th September 2021, 22:43
Bugfix for lgds with odd "pos Y" values: https://github.com/HomeOfAviSynthPlusEvolution/DelogoHD/releases
MeteorRain
19th September 2021, 22:53
A few tips.
1. Pick videos that have clean flat areas around logo positions.
2. Make sure you only include frames that have the logo. Don't include CMs that don't have logo on it.
3. Better use mod4 or at least mod2 (even numbers) for positions and sizes, for better compatibility.
4. Leave about 3 pixels around logo when choosing the boxed area.
5. Threshold, the lower the cleaner but you get fewer samples, the higher the worse but you get more samples. Pick wisely. For animes or clean source, 20 should be a good balanced number. For real life content, 30 is good. If the source has too few samples, increase to 40 or 50.
6. If you scanned a logo and would like to exhibit it on my website you can email to i(at)i.wtf and attach your lgd files.
kedautinh12
20th September 2021, 10:58
New ver r12:
https://github.com/HomeOfAviSynthPlusEvolution/DelogoHD/releases
spiovente_iv
29th January 2022, 04:58
This might be a long shot, but does anyone have a working .lgd for MeTV sources? I found an .svg (below), but haven't quite figured out how to transform one format to the other. Thank you!
https://static.wikia.nocookie.net/logopedia/images/b/b9/MeTV_logo_2014.svg
MeteorRain
30th January 2022, 17:56
The real logo (on the video) must be semi transparent and you should scan it from the video directly. It's impossible to convert an image to a lgd file.
MeteorRain
11th June 2026, 01:59
With the help of AI vibe coding, I was able to refactor the DualSynth wrapper layer and the filter itself. Highly experimental.
If you are interested you can test out v13.0.0 (moving to semver from r12) but be careful using it in production.
Everything is modernized, filter now uses C++23 mdspan/span instead of raw pointers.
Code is now tested against golden file to ensure bit identical across releases.
If this works well I might start migrating other filters.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.