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 25th December 2018, 19:01   #1  |  Link
Dreamject
Registered User
 
Join Date: Dec 2018
Posts: 140
How launch avs debanding on PotPlayer?

Hey, I tried to launch avs dither tools for debanding as alternative to madvr, but nothing works.
I've tried 'new' fixed version from this post https://forum.doom9.org/showthread.p...29#post1839229
And original version from wiki from this post - https://forum.doom9.org/showthread.p...59#post1386559

Anyway nothing works.

What I did: put dlls in PP folder, put avsi in PP folder too, then create avs script that call avsi (import *avsi, as I remember), also call dlls with as i remember loadplugin. And of course I used dither3() (as I remember)

Pp does not give any changes in video, it not writes that anythyng wrong...
Wiki says that requments are:
Masktools 2 alpha 48 or later (tp7 version strongly recommended),
RemoveGrain 1.0b “beta” or later (same here, use the RgTools version),
AddGrainC 1.5.1 or later

Anyway, I can not launch this. May be somebody know how make this, please write an instruction

Last edited by Dreamject; 29th December 2018 at 21:18. Reason: I mean debanding
Dreamject is offline   Reply With Quote
Old 26th December 2018, 07:39   #2  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Dither Tools actually uses 16bit stacked and it dithers it down to 8bit regular using the dithering method you choose (rounding, 8-bit ordered dither, 1-bit dither, 2-bit dither, Floyd-Steinberg error diffusion, Stucki error diffusion, Atkinson error diffusion).
Since the old Avisynth didn't support normal 16bit and was working in 8bit only, 16bit stacked and 16bit interleaved were invented.
In order to achieve 16bit in a native 8bit environment, MSB (most significant bit) and LSB (less significant bit) were divided and either stacked one on top of the other (16bit stacked) or interleaved one with the other (16bit interleaved).
As result, 16bit stacked has double height and 16bit interleaved has double width.
Going form 16bit stacked (Dither Tool) or 16bit interleaved (HDR Tools) to regular 8bit is considered as "resizing" by PotPlayer and since resizing is not allowed, it doesn't work.
That's the reason why the developers didn't integrate VideoTek() as videoscope when I suggested them.
What you can try, however, is to use Avisynth+ with its ConvertBits().
Avisynth+ is way more updated than the old Avisynth 2.6.1 and it supports normal high bit depth.
In other words, if your video is 10bit an you wanna dither it down to 8bit in PotPlayer, you can use:

Code:
Setmemorymax(512)
LoadPlugin("C:\Encoding\plugins+\ConvertStacked.dll")
potplayer_source()
ConvertBits(bits=8, dither=1)
This should output an 8bit dithered down video using the Floyd-Steinberg error diffusion, which is a well balanced algorithm. Unfortunately ConvertBits supports only ordered dithering or the Floyd-Steinberg error diffusion and doesn't support neither the Stucki error diffusion (which is very sharp and it's better for the edges), nor the Atkinson error diffusion (which is better for the flat areas).
Anyway, my favorite dithering method is the Floyd-Steinberg error diffusion, so I would tell you to go for it.
If it doesn't work, then I think you should report it to the PotPlayer forum and the developers.

Happy boxing day,
Frank.

Last edited by FranceBB; 28th December 2018 at 04:14.
FranceBB is offline   Reply With Quote
Old 27th December 2018, 17:00   #3  |  Link
Dreamject
Registered User
 
Join Date: Dec 2018
Posts: 140
I used this
Setmemorymax(512)
LoadPlugin("C:\Encoding\plugins+\ConvertStacked.dll")
potplayer_source()
ConvertBits(bits=8, mode=1)

PP says "Convertbits does not have a named argument 'mode'"
Dreamject is offline   Reply With Quote
Old 28th December 2018, 04:13   #4  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
My bad,
ConvertBits(bits=8, dither=1).
That's why I shouldn't reply in the morning without coffee xD

http://avisynth.nl/index.php/ConvertBits
FranceBB is offline   Reply With Quote
Old 28th December 2018, 09:25   #5  |  Link
Dreamject
Registered User
 
Join Date: Dec 2018
Posts: 140
Quote:
Originally Posted by FranceBB View Post
My bad,
ConvertBits(bits=8, dither=1).
That's why I shouldn't reply in the morning without coffee xD

http://avisynth.nl/index.php/ConvertBits
Hmm, but what about usual 8 bit video?
PP error:
ConvertBits: Floys-Sdithering only for 10-16 bit source
Dreamject is offline   Reply With Quote
Old 28th December 2018, 09:58   #6  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Uhm... Are you sure your source is high bit depth and it's not 8bit?
'cause if it is and ConvertBits still report that it isn't, it means that potplayer_source() as "indexer" for Avisynth already serves Avisynth an 8bit video, which has been (probably) truncated.
FranceBB is offline   Reply With Quote
Old 28th December 2018, 15:40   #7  |  Link
Dreamject
Registered User
 
Join Date: Dec 2018
Posts: 140
Quote:
Originally Posted by FranceBB View Post
Uhm... Are you sure your source is high bit depth and it's not 8bit?
'cause if it is and ConvertBits still report that it isn't, it means that potplayer_source() as "indexer" for Avisynth already serves Avisynth an 8bit video, which has been (probably) truncated.
Sorry my English, but I mean i already have 8-bit video (usually), not 10+bit
Dreamject is offline   Reply With Quote
Old 28th December 2018, 16:56   #8  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Uh... I don't get it.
Your source is 8bit, your target is 8bit.
You originally said

Quote:
I tried to launch avs dither tools for debanding
Perhaps you mean that your 8bit sources have banding problems and you wanna apply debanding?

I mean, dithering is used whenever you have to go from a bit depth to another: truncation creates banding and, in order to avoid that, dithering is applied. For instance, 10bit sources that have to be brought to 8bit can be dithered down to avoid banding: instead of seeing "bands" of colours, you see many little "points" of different colours on the edges to make the transition from one color to the other smoother.

https://upload.wikimedia.org/wikiped..._example01.png

As you can see in the example, this is done in a meaningful way.
If your source is not high bit depth and you wanna get rid of banding, just use a debanding filter like f3kdb:

Code:
f3kdb(range=15, Y=45, Cb=30, Cr=30, grainY=64, grainC=64, sample_mode=2, blur_first=true, dynamic_grain=true,  opt=3, mt=true, keep_tv_range=true, input_depth=8, output_depth=8)
With these settings, it will apply debanding and then insert grain in both Luma and Chroma with a different patter at each frame. If you want the pattern to be consistent, just change dynamic grain to "dynamic_grain=false"; you can also adjust how much grain you want by lowering or raising "grainY" and "grainC" (you can even set them to 0 to avoid to add grain).

If you don't wanna apply debanding and you just wanna get grain, just use AddGrainC:

Code:
AddGrainC(var=5.0, uvar=0.0, constant=true)
You can set "constant=false" to add dynamic grain.

Anyway, I'm not sure you'll be able to get results in real time, especially with debanding.
FranceBB is offline   Reply With Quote
Old 29th December 2018, 06:05   #9  |  Link
Dreamject
Registered User
 
Join Date: Dec 2018
Posts: 140
>Anyway, I'm not sure you'll be able to get results in real time, especially with debanding.
So, madVR is best choice for deband video in real time? With high settings of artifact removal it works pretty well.
Dreamject is offline   Reply With Quote
Old 29th December 2018, 06:25   #10  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
So, madVR is best choice for deband video in real time?
Yep, I would stick with madVR rather than frameserving with Avisynth, also because madVR it's GPU-assisted while Avisynth still heavily relies on the CPU for pretty much everything (just a few filters can use the GPU).
FranceBB is offline   Reply With Quote
Old 29th December 2018, 21:30   #11  |  Link
Dreamject
Registered User
 
Join Date: Dec 2018
Posts: 140
Quote:
Originally Posted by FranceBB View Post
Yep, I would stick with madVR rather than frameserving with Avisynth, also because madVR it's GPU-assisted while Avisynth still heavily relies on the CPU for pretty much everything (just a few filters can use the GPU).
Using GPU is good side and bad side too. For example, SVP-like projects can use GPU or CPU. In my family aunt has low-end Intel CPU. Sometime I use hew laptop. If I chose gpu-based avs it just stopped and became unwatchable. CPU-doubling frame works well.

In my case I have laptop with i7 2.5GHz with intel hd4000 and burned turned of nvidia. So, If I use gpu-based mad-vr, I have to disable gpu acceleration especially I use SVP.

So I want more universal tools for debanding which do not turn picture to trash. I tried integrated PotPlayer's (ffdshow based) debanding settings, result is zero or joke.
Dreamject is offline   Reply With Quote
Old 30th December 2018, 06:10   #12  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Well, it actually really depends on the type of calculations that a certain filter is going to do; after all, GPU are good for certain types of calculations and "bad" for some others. For instance, consumer grade GPUs have 16bit and 32bit capable units for Half precision and Single Precision Floating Point arithmetic, but they don't have many 64bit capable units. Besides, depending on which GPU you are using, it may not achieve fast enough results for certain types of calculations, no matter what. I do agree that having both the option (CPU or GPU) to use a filter should be the way, though.
As to f3kdb, give it a shot.
The two most famous debanding filters are in fact f3kdb and gradfun. They are not terribly slow at 8bit YV12 planar, so you might be lucky and get something nice and smooth as real time output for low resolution sources and maybe even HD. (Not sure about FULL HD sources and definitely not 4K).

Last but not least: using filters to adjust things on playback can be fine, but I do think that an encoding is supposed to be done in a good way in the first place and as long as you are gonna watch official sources like Blu-ray, it's actually unlikely to suffer so terribly from banding that it's unwatchable (as it's still H.264 yv12 8bit, but with about 40 Mbit/s there's plenty of bitrate to avoid terribly wrong looking artifacts). I can't say the same thing for DVDs (in which the MPEG-2 sometimes caused some pretty bad results) and TV channels where MPEG-2 and the very low bitrate available (compared to Blu-rays etc) actually creates some unpleasant artifacts. Anyway, nowadays we are heading towards H.264 for HD and FULL HD 8bit contents and H.265 10bit for UHD contents in TV channels as well and although the bitrate they use it's not so high, newer codecs are still gonna act as damage limitation and the user experience shouldn't be bad.

In a nutshell: try f3kdb and gradfun yourself, play with the settings, cross your fingers and maybe, just maybe you'll find the sweet spot you are looking for. If not, just stick with madvr.
FranceBB is offline   Reply With Quote
Old 30th December 2018, 14:46   #13  |  Link
mp3dom
Registered User
 
Join Date: Jul 2003
Location: Italy
Posts: 1,135
If I remember correctly, MadVR uses a modified version of f3kdb for debanding that should preserve the details better (but I don't know if the latest f3kdb integrates these modifications as well).
The drawback of the debanding is that it may wipe small details, especially the ones visible in dark scenes so it's good to deband during playback (the source is left untouched) but if you apply deband to the source (and create an encode) you need to take special care using masks to preserve the details that the deband will wipe away.
Banding can be very visible on bluray too, because most of the times it's not due to bitrate limitations, but it's a problem borked into the master, for the way the masters are created. This is especially true for japanese animation, where they work at high bit depth for vfx (16 or even more bpc), but they then conform to 10bit (or even worse, 8 bit) master truncating the data.

Last edited by mp3dom; 30th December 2018 at 15:27.
mp3dom is offline   Reply With Quote
Reply

Tags
avs script, potplayer

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 17:11.


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