Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th September 2019, 04:41   #21  |  Link
VoodooFX
Registered User
 
Join Date: Sep 2008
Posts: 82
Quote:
Originally Posted by manolito View Post
Especially the "Turbo=1" mode impresses me. In most cases it looks just as good or even better than the slower "Turbo=3" mode. This mode is something I would really be interested in...
I think you are concentrating on some frames too much, in general Turbo=3 is less alive.
Turbo=1 is using bit lower oPP=6 (opaque blur) as it gets more blur than 1/2 by other means, when Turbo=3/Turbo=2 is using oPP=7, you can change options to whatever you want, like to oPP=8 (max amount of unhealthy blur). Turbo are not hard presets.

Avs+ is my recommendation, it is faster maybe ~10%, script works with Avs 2.6 too without any changes.

Quote:
Originally Posted by manolito View Post
The speed comparison with LogoAway is a little unfair. I use an "Active Area" approach where VDub just processes the actual logo.
LogoAway benchmark didn't go through conversion to YV12, so it's unfair for others. I benchmarked that small pre-cut area , it would be close to "Active Area".

Quote:
Originally Posted by manolito View Post
And for treating logos which are partly over letterboxed (or pillarboxed) areas do you have any special treatment for such logos?
Just don't select that border with Loc (I didn't tested such case).

Quote:
Originally Posted by manolito View Post
And then I would like to know how you can preview...
I use Notepad or other txt editor like PSPad, I never had any need for something fancy like AvsMod, I just need preview, and I get it from programs I already have installed.
You can open your avs script with same Vdub, change something in your script>save then in VDub>File>Reopen and it will refresh preview at same frame you are looking at.

VirtualDub2 has its own avs script editor and F5 will do as above.

Then MeGUI has script editor and preview, I like it most as preview window is not bonded to main program.

Last edited by VoodooFX; 7th September 2019 at 04:58.
VoodooFX is offline   Reply With Quote
Old 7th September 2019, 05:53   #22  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,207
That's a great comparison video.

I wonder if s_Exlogo's settings were correct. As I indicated earlier, I've done a lot of logo removal using Delogo, and you can set it so its "inpainting" is done primarily from pixels above and below the logo, which is what I see in the s_Exlogo example.

Your function does a good job, but it does look similar to what I get with Delogo. If you have a version of the original, I'd be happy to create a demo of what can be done with that, and see how it compares to yours.
johnmeyer is offline   Reply With Quote
Old 7th September 2019, 13:29   #23  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,696
Quote:
Originally Posted by johnmeyer View Post
If you have a version of the original, I'd be happy to create a demo of what can be done with that, and see how it compares to yours.
The file "Source.mkv" from this link...
https://www.sendspace.com/file/8nvhi6
manolito is offline   Reply With Quote
Old 7th September 2019, 15:43   #24  |  Link
VoodooFX
Registered User
 
Join Date: Sep 2008
Posts: 82
Quote:
Originally Posted by johnmeyer View Post
That's a great comparison video.

I wonder if s_Exlogo's settings were correct. As I indicated earlier, I've done a lot of logo removal using Delogo, and you can set it so its "inpainting" is done primarily from pixels above and below the logo, which is what I see in the s_Exlogo example.

Your function does a good job, but it does look similar to what I get with Delogo. If you have a version of the original, I'd be happy to create a demo of what can be done with that, and see how it compares to yours.
That is how s_Exlogo looks. Blur looks similar to blur, I know what Delogo does, I can tell you from my memory:

You have to do mask manually.
It is slow.
Bit more solid "smoked glass" look.
Doesn't hide edges.

Advantages over LogoAway:
Interpolates from the edges of the mask, so doesn't damage good parts of the frame.
Probably faster.

Advantages over InpaintDelogo:
None.

Last edited by VoodooFX; 7th September 2019 at 15:58.
VoodooFX is offline   Reply With Quote
Old 7th September 2019, 16:40   #25  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,392
By the way, it was mostly the likes of the angled vertical tan/brown edge on left below (top & bottom images) that threw me,
center one s_exlogo is vertical edge, others angled, (did not realize where the angle was coming from [is from 2 pixel resize]).
Quote:
Originally Posted by VoodooFX View Post
EDIT: Dekafka does a 2 pixel resize, but I did not like that and only use single pixel nearest to logo in resize (with opposite pixel from bottom edge),
seems that 2 pixel resize may be not so bad after all [but still seems weird to me, shifting two pixels and resizing].
The dark 'lip' at top of tan/brown edge #1(top) is likely due to the two pixel resize, and seems to have been cropped off for the bottom image #3.
[The lip is original image, the faded pixels below due to two pixel resize make it visually stand out]
EDIT: Also the top image seems to have 'more' angle than bottom image, something else seems to be going on there.
EDIT: And where is that brown line coming from [above to the left of left red arrow].

EDIT: Above requires no comment, just some observations.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 7th September 2019 at 17:12.
StainlessS is offline   Reply With Quote
Old 7th September 2019, 18:10   #26  |  Link
VoodooFX
Registered User
 
Join Date: Sep 2008
Posts: 82
Quote:
Originally Posted by StainlessS View Post
EDIT: Also the top image seems to have 'more' angle than bottom image, something else seems to be going on there.
EDIT: And where is that brown line coming from [above to the left of left red arrow].
a) We don't know history of that clip, delogo could be done on HD (interpolating ~4 top pixels), then clip resized to SD.

b) Do you mean that oblique line? It is above delogoed area, and it hits other vertical line just ~3-4px above delogoed area.

If you interested you can look at xLogo interpolation, it is fast and tries to make choices on vertical lines over horizontal (with multi passes), what ends up with very flickery interpolation.

Last edited by VoodooFX; 7th September 2019 at 23:22.
VoodooFX is offline   Reply With Quote
Old 7th September 2019, 20:35   #27  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,696
I spent the better part of the afternoon testing InpaintDelogo, and in short the result is that I will abandon LogoAway and use InpaintDelogo instead...

As my source I used the same "Source.mkv" clip I uploaded (because it is very typical for my use cases). I used the Inpaint mode (part of the logo is semi-transparent, the other part is opaque), and I tried it without Turbo, Turbo=1 and Turbo=3. I also tested adding the "KillShape=1" parameter.

First of all I must say that the Automask feature works well. Just some small white spots which did not affect the results at all (I compared it to the results after manually cleaning up the mask).

For the different Turbo modes I could not point my fingers on any significant difference in visual quality. Even the result with Turbo OFF did not look noticeably better than Turbo Mode1. Of course this could be because my source was SD (or because my vision is degrading too much - getting old...).

These are the speeds I got:

Quote:
LogoAway: 76.5 fps
Inpaint Turbo Off: 64.5 fps
Turbo=3: 88 fps
Turbo=1: 93 fps
Using "KillShape=1" with the Turbo modes slowed it down just a tiny bit, but the results did not look any better to me.

And all InpaintDelogo methods I tested looked way better than LogoAway, no doubt about it. So a big Thank You for your efforts...

Some questions:
What about interlaced sources? Will they work out of the box? Or should I make the logo coefficients MOD4 instead of MOD2? And if GrainFactory functions are added, the GrainFactory doc says that it only supports progressive input.

I also tested a source where the logo is partly over the top letterbox. You said:
Quote:
Just don't select that border with Loc (I didn't tested such case).
but this does not work. If I omit the top border value then the script will assume 0 as the value. Creating the AutoMask will fail with a "Mask Full" error message. The same thing happens when I set the top border value to the real top position of the logo.

The only way to get it working was to set the top value for the logo to the top of the movie area. This results in a clip where the logo part which lies over the top letterbox area will not be removed, this part needs to be cropped off after the logo removal. Pretty much the same procedure I have to use with LogoAway.


Cheers
manolito

Last edited by manolito; 7th September 2019 at 20:38.
manolito is offline   Reply With Quote
Old 7th September 2019, 22:39   #28  |  Link
VoodooFX
Registered User
 
Join Date: Sep 2008
Posts: 82
Those benchmarks doesn't look right as Turbo=1 is ~15x faster than Turbo=0, avs scripts should be benchmarked with AVSMeter. And I do it with uncompressed clip.
Or maybe you override Turbo presets by keeping other InpaintDelogo parameters in your script. Turbo just changes defaults. Like KillShape=1 is already in Turbo>=1 presets.
If you have mask generated then InpaintDelogo(mask="c:\mymask.bmp", Loc="0,0,-0,-0", Turbo=1) is enough for what you do (at least for that source clip you have shared), I use Show=2 to see only Loc area zoomed in.

Delogo needs to be done after deinterlacing, not before.

As with borders, in theory you need Loc at least 8 pixels from logo edges to generate good mask (Automask=1), you can use less but mask will be not that good, but as you just want to blur everything then it doesn't matter I guess.
When you done generating mask, then Loc will have different purpose, then you can set one of its edge to the back border without including it. If you have some problems with it then share that logo so I can look what is really going on.

Quote:
Originally Posted by manolito View Post
First of all I must say that the Automask feature works well. Just some small white spots which did not affect the results at all (I compared it to the results after manually cleaning up the mask).
That bmp mask is just a base mask, inside InpaintDelogo it goes through various transformations, you can see them with Show=1 parameter.

Last edited by VoodooFX; 7th September 2019 at 23:50.
VoodooFX is offline   Reply With Quote
Old 8th September 2019, 01:04   #29  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,392
Quote:
b) Do you mean that oblique line? It is above delogoed area
Oops, yes of course.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 8th September 2019, 21:34   #30  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,696
Quote:
Originally Posted by VoodooFX View Post
Those benchmarks doesn't look right as Turbo=1 is ~15x faster than Turbo=0, avs scripts should be benchmarked with AVSMeter. And I do it with uncompressed clip.
Or maybe you override Turbo presets by keeping other InpaintDelogo parameters in your script. Turbo just changes defaults. Like KillShape=1 is already in Turbo>=1 presets.
Those benchmarks are totally right because they represent the real world conversion speeds. Just benchmarking the AVS script with AVSMeter does not tell you anything about the real world conversion speed where the bottle neck may be somewhere else (X264 in my case). So all my speed benchmarks are done in a "real" conversion scenario, not just using AVSMeter...


Some new findings while trying to establish a stable workflow for my SD conversions using InpaintDelogo:

For sources where the logo is partly in the black borders area your suggestion to just omit this border value after creating the mask does not work. An example for a logo which is partly in the top border area where the top movie border is at 52 pixels down from the top frame border:

For the logo location you need to set the top logo value to 52, then create the logo mask. This will keep the part of the logo which is in the black border area. To get rid of it you need to apply the command "Letterbox(52,0)" in the AVS script after the InpaintDelogo command.

I did some more tests with such a source (downloaded from the ARTE Mediathek, they usually place their logo partly in the black border area). I found the speed benchmarks very interesting:

Turbo=1: 80 fps
Turbo=3: 79 fps
Turbo=0: 71.5 fps

There is almost no difference between Turbo1 and Turbo3 mode, and even not using Turbo mode at all is only slightly slower. My conclusion is that I will probably ditch the Turbo modes completely. Of course this may be different for HD conversions, but I don't do those...
manolito is offline   Reply With Quote
Old 9th September 2019, 16:16   #31  |  Link
VoodooFX
Registered User
 
Join Date: Sep 2008
Posts: 82
Quote:
Originally Posted by manolito View Post
Those benchmarks are totally right because they represent the real world conversion speeds. Just benchmarking the AVS script with AVSMeter does not tell you anything about the real world conversion speed where the bottle neck may be somewhere else (X264 in my case). So all my speed benchmarks are done in a "real" conversion scenario, not just using AVSMeter...
That way you are benchmarking Decoder+delogo+Encoder , that doesn't tell us much about delogo speed.
When we know real delogo speed then we can know how much Encoder's speed will be influenced by it.

Here is real delogo speeds (on i5-2450M 2.5GHz):
Code:
InpaintDelogo, Turbo=0    45 fps 
InpaintDelogo, Turbo=3   304 fps
InpaintDelogo, Turbo=2   497 fps
InpaintDelogo, Turbo=1   736 fps

LogoAway, UGLARM, max Exponent, 61 fps 
s_Ex_Logo 5288 fps
Quote:
Originally Posted by manolito View Post
For sources where the logo is partly in the black borders area your suggestion to just omit this border value after creating the mask does not work.
I meant don't include black border in selection, not to omit setting the parameter.
I found such logo to test, it works as expected, like I wrote in a post above.
VoodooFX is offline   Reply With Quote
Old 9th September 2019, 21:53   #32  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,696
Alright, getting familiar with the InpaintDelogo method and really liking the results...

A feature request:
Is there a way to speed up the AutoMask creation?
I only use SD (704x396) clips as the input, but even then it takes almost 20 minutes to create the mask for a 2 and a half hour source clip. (Core i5 3rd generation CPU with 8GB of RAM, AVS+ with MT enabled using 4 threads.) The created mask is usually excellent, but there should be a way to make it faster, maybe by using only a percentage of the source. For a HD source clip of such a duration the AutoMask creation is useless for me, it takes more than an hour on my computer.
manolito is offline   Reply With Quote
Old 9th September 2019, 23:22   #33  |  Link
VoodooFX
Registered User
 
Join Date: Sep 2008
Posts: 82
I looked around how to remove moving logo, only solution I see is using Avisynthtrackin, to automate everything would involve Python, I'm too lazy for that.

Quote:
Originally Posted by manolito View Post
Is there a way to speed up the AutoMask creation?
I only use SD (704x396) clips as the input, but even then it takes almost 20 minutes to create the mask for a 2 and a half hour source clip. (Core i5 3rd generation CPU with 8GB of RAM, AVS+ with MT enabled using 4 threads.).
There is, instant analysis can be done with Analyze=4 or Analyze=3.
For "4" you need to enter frame number (for example Fr1=123) where logo is in a black/dark background. Frame numbers you can see in MeGUI or VirtualDub.
For "3" you need to enter black/dark and white/bright frames (Fr1 and Fr2).
If logo stays in that background longer than a second then you can add another parameter "FrS=3".

Default is Analyze=1 - ~3% of the clip, you can use Trim to limit it more.

Using MT will slow down encoding with InpaintDelogo, and will definitely slowdown Analyze part, if you are getting 20 mins with Prefetch(4) then removing it would speed Analyze up to 4 mins.
Try to measure encoding fps without MT. You are not using VirtualDub for that?

Last edited by VoodooFX; 9th September 2019 at 23:27.
VoodooFX is offline   Reply With Quote
Old 10th September 2019, 00:53   #34  |  Link
VoodooFX
Registered User
 
Join Date: Sep 2008
Posts: 82
Here is benchmarks AVS+ vs Classic AVS:

Code:
                        AVS+ 2915    AVS ST 2.6.0.6
                                                   
InpaintDelogo, Turbo=0    45 fps       44 fps      
InpaintDelogo, Turbo=3   304 fps      194 fps      
InpaintDelogo, Turbo=2   497 fps      250 fps      
InpaintDelogo, Turbo=1   736 fps      298 fps      
s_Ex_Logo               5288 fps     3940 fps
VoodooFX is offline   Reply With Quote
Old 10th September 2019, 02:29   #35  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,696
Thanks for these benchmarks, but as I said before, they do not mean a thing to me. If the overall speed including decoding, AVS script plus encoding gives me an identical speed for Turbo=1 and Turbo=3, why in the world would I try to use the method which supposedly results in a lower quality? Makes no sense to me...

For the AutoMask feature when I want to get a better speed I was under the impression (from reading the doc) that I cannot use the "Analyze" parameter when I use the "Mode=Inpaint" parameter. And this is the only mode I ever use.

I tested it using "AutoMask=1" and "Analyze=1" and "Mode=Inpaint" in the command for creating the mask, and indeed the "Analyze=1" parameter was ignored. Creating the mask took just as long as without the "Analyze=1" parameter, and the resulting mask looked the same.
manolito is offline   Reply With Quote
Old 10th September 2019, 03:06   #36  |  Link
VoodooFX
Registered User
 
Join Date: Sep 2008
Posts: 82
Automask=1 is like separate function it only generates a base mask.

Only these parameters are used for Automask=1:
Quote:
"Analyze" (and its sub-parameters, except "ReAnalyze"), "aMix", "mask" and "Loc" parameters will be used.
Mode is delogo parameter, it is silently ignored when Automask=1.
VoodooFX is offline   Reply With Quote
Old 10th September 2019, 21:37   #37  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,696
Still streamlining my workflow for InpaintDelogo, this time I used a typical real-world captured movie from German DVB-T2 (1080p @50fps, HEVC), duration was 100 minutes. I always convert these captures to 702x396 @25fps AVC. For InpaintDelogo I only use the Inpaint mode, I have no use for the Deblend or Both modes.

This is what I found so far:

Trying to use AutoMask to create the base mask was frustrating. It uses "Analyze=1" by default which means that it uses 3% of the source to create the mask. For my source file this is unusable, I canceled the process after 40 minutes. I got it working by increasing the "every" parameter in "SelectRangeEvery" from 33 to 400. Values above 400 caused the mask to deteriorate, but for this source 400 was perfect. It took 3 minutes to create a perfect mask. But of course this may be different for other source files.

The other and faster way is to use "Analyze=4" and specify a frame where the logo is above a perfect black background. I believe that for only using Inpaint it does not make sense to use "Analyze=3" because I will not do any color deblends.

Next problem was that my conversion crashed when I had activated MT mode. So far I have solved it by forcing InpaintLogo to MT_SERIALIZED, let's see if this helps permanently. Turning off MT mode is an option, but this drops my speed from 29fps to 25fps.

Still very happy with the resulting quality, even with Turbo=1 it is way way better than for LogoAway, and it is also faster.


Cheers
manolito
manolito is offline   Reply With Quote
Old 10th September 2019, 21:44   #38  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,207
I haven't yet tried InpaintDelogo, but for opaque masks is there any benefit to having it auto-create the mask? Or, is it able to track bugs which move? If so, that would be very useful. But, for static bugs, it only takes a few seconds to paint a mask, so there's no benefit in waiting minutes (or more) for the auto-creation.s

For semi-transparent bugs, auto-creation is mandatory, of course.
johnmeyer is offline   Reply With Quote
Old 10th September 2019, 21:59   #39  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,696
Just curious, but how do you make a BMP B/W mask at the required size and resolution in just a few seconds? I sure cannot do this, so using an AutoMask feature which only takes a few minutes doesn't sound too bad to me. And the other option when you can find a frame with the logo above a black background is lightning fast.

I always treat semi-transparent logos as if they were opaque, I'm too impatient I guess...

Last edited by manolito; 10th September 2019 at 23:20.
manolito is offline   Reply With Quote
Old 10th September 2019, 23:29   #40  |  Link
VoodooFX
Registered User
 
Join Date: Sep 2008
Posts: 82
If you know how to use PhotoShop then it is fast doing same thing as Automask=1: save dark frame, load it into PS then with Levels get mask, but if you already have black frame then there is no point wasting seconds/minutes with external programs when you will have same in milliseconds with Automask=1.

If it is only InpaintDelogo in a script then MT slows down encode. Very quick test, very slow x264 settings (1000 frames):

Code:
Only InpaintDelogo / Prefetch(4) - 12fps
Only InpaintDelogo / No MT       - 16fps

InpaintDelogo + other 3 heavy filters / Prefetch(4) - 10fps
InpaintDelogo + other 3 heavy filters / No MT        - 5fps
We can see that MT fps increase on other filters outweighs fps loss on InpaintDelogo here, or whatever MT does, I'm not an expert on that...
If it crash with Prefetch(4) then use 64bit. Or you can try Prefetch(3).

Last edited by VoodooFX; 10th September 2019 at 23:39.
VoodooFX is offline   Reply With Quote
Reply

Tags
avsinpaint, delogo, inpaint, remove, watermark

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:09.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.