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 31st May 2012, 15:41   #521  |  Link
-Vit-
Registered User
 
Join Date: Jul 2010
Posts: 448
Quote:
Originally Posted by nhope View Post
I'd be interested in suggestions for dealing with the banding that you see starting at about 03:00 in my test video on YouTube, as the blue opening of the cave fades up from black.
Before you start debanding it you could try to remove the cause of the banding. Maybe x264 or QTGMC. For the occasional manual fade you can use x264 zones: for example add: --zones 100,200,b=1.5 to the command line to give 1.5x bitrate to frames 100 to 200. Add multiple zones so: --zones 100,200,b=1.5/400,500,b=1.5. You can also adjust the quantizer with q=x instead of b=x, but I find that value hard to guess at. (Edit: CRF 18 sounds plenty for 1080, but sometimes x264 seems to underestimate the bitrate needed on fades)

In QTGMC, adding DCT=5 sometimes helps with fades.

Last edited by -Vit-; 31st May 2012 at 16:03.
-Vit- is offline   Reply With Quote
Old 31st May 2012, 16:59   #522  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
Quote:
Originally Posted by Reel.Deel View Post
BTW the link to your video on youtube does not work.
Thanks. Now fixed.

Quote:
I'm assuming your original HDV source is YUV 4:2:0. Correct?
Correct.

Quote:
Why not deinterlace in it's original color space and save to a lossless file and then import to Vegas? It saves you from having extra unnecessary color space conversions.
What source method would you suggest? I wanted to use DGIndex/MPEG2Source directly on the file, having read that it's the preferred option for MPEG source, but it "expanded" my colorspace to PC levels, even if I selected "TV Scale" in the video options. Same with FFVideoSource. If I "squeezed" that back with SmoothLevels(preset="pc2tv"), the result is much further away from the original than if I go via RGB then YV12 as in the script I posted.

Quote:
Originally Posted by -Vit- View Post
Before you start debanding it you could try to remove the cause of the banding...
Thanks. I'll try out your suggestions.

Notwithstanding -Vit-'s suggestions, which of the following scripts makes more sense for avoiding banding in this scenario? Or something else? And should I be looking at using a "coarser" dither?

Code:
...
QTGMC()
Spline36Resize(1920,1080)
dfttest (lsb=true)
DitherPost ()
Code:
...
QTGMC()
Spline36Resize(1920,1080)
GradFun3 ()
nhope is offline   Reply With Quote
Old 1st June 2012, 10:40   #523  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
Well, I'm getting a pretty good result with this...

Code:
QTGMC( Preset="Slower" )
Spline36Resize(1920,1080)
dfttest
GradFun3 (radius=16)
... but the overall luminance of the "bounces" up and down compared to the more noisy original. Adding ampo=2 made that worse (although it seems to give a little less banding when studying an individual frame).

Now I'm wondering if all I should be doing to avoid this banding in the fade on YouTube is just to add noise with AddGrainC? Or if it's simply unavoidable no matter what I do due to YouTube's encoder and the Flash Player?

I'm also interested in what the code might be for implementing a mask that would make the filter only operate on the blue water and not the darker areas of the diver and near-black cave.

Here's a link to a frame grab after QTGMC and resizing, but without any denoising or debanding/dithering. And here's a link direct to the part of the video with the "radiating" banding. Obviously it behaves differently at different resolutions.
nhope is offline   Reply With Quote
Old 1st June 2012, 14:14   #524  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
It will be very difficult to get rid of the band crawling in a Youtube video. Maybe you can try GradFun3 (mode=6, ampn=4, staticnoise=true) on this fade, but I doubt it will be of any use.

You could also give a try to the LumaDB script.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 1st June 2012, 15:42   #525  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,089
Quote:
Originally Posted by nhope View Post
What source method would you suggest?
Hi nhope, for the most part I usually use DGIndexNV and sometimes FFMS2. I use them on my Canon DSLR files with the Cinestyle profile and the colors do not get expanded nor squeezed.

Maybe it would be best if you upload a sample from the original file.
Reel.Deel is offline   Reply With Quote
Old 1st June 2012, 16:08   #526  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,585
Probably not much you can do. Even if you "fix" it on your end before uploading, by the time YT re-encodes it - the "banding" will come back . You need lots of bitrate to retain dither and noise, and 10bit helps but that's not applicable here




Quote:
Originally Posted by nhope View Post


What source method would you suggest? I wanted to use DGIndex/MPEG2Source directly on the file, having read that it's the preferred option for MPEG source, but it "expanded" my colorspace to PC levels, even if I selected "TV Scale" in the video options. Same with FFVideoSource. If I "squeezed" that back with SmoothLevels(preset="pc2tv"), the result is much further away from the original than if I go via RGB then YV12 as in the script I posted.
They don't "expand" anything . Both FFMS2 and MPEG2Source serve the original YV12. It might be vegas and studio RGB workflow , but you have to be more clear on the exact steps you are using
poisondeathray is offline   Reply With Quote
Old 1st June 2012, 20:38   #527  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
Thanks for the replies. LumaDB at default settings is very bandy. GradFun3 (mode=6, ampn=4, staticnoise=true) is looking very promising! It previews more nicely than everything else I've tried. When I went to encode in MeGUI so I could upload some further tests to YouTube I was mysteriously struck by this problem so I'll report back about the colorspace stuff after I've sorted that out.
nhope is offline   Reply With Quote
Old 3rd June 2012, 15:13   #528  |  Link
raido
Registered User
 
raido's Avatar
 
Join Date: May 2012
Posts: 23
I've been using...

Code:
zzz_denoise ()
DitherPost (mode=2)
It's awesome. I workes really well at reducing posterization. Typically my sources have noise that I haven't fully eliminated. Sometimes when this noise is encoded, the posterization "flickers" on the borders between each band. This filter is the closest thing I've found that comes close to completely eliminating them while retaining detail. I also got a 10% reduction in file size (using crf 21). The thing is that it's really slow (getting about 3 fps on a 720x576 source). I tried setmtmode 2,3,4 and they don't seem to work. Can this be multithreaded?
raido is offline   Reply With Quote
Old 3rd June 2012, 19:55   #529  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,545
Quote:
Originally Posted by cretindesalpes View Post
The link isn't working for me. AVSTP link isn't working either.

EDIT

Link works now. Thank You.
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.

Last edited by Revgen; 4th June 2012 at 13:17.
Revgen is offline   Reply With Quote
Old 7th June 2012, 16:01   #530  |  Link
Lenchik
Registered User
 
Join Date: Nov 2005
Location: Russia
Posts: 62
Code:
Dither_convert_yuv_to_rgb (lsb_in=true)
Dither_convert_rgb_to_yuv (SelectEvery (3, 0), SelectEvery (3, 1), SelectEvery (3, 2),
\	lsb=true, output="YV24")
Is this the only way to convert from YV12 to YV24 or YV16? Is there or will be any way to convert it without going to RGB?
Lenchik is offline   Reply With Quote
Old 14th June 2012, 19:25   #531  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
Dither 1.18.0:
  • Added Dither_quantize to dither to bitdepths higher than 8 (almost the same function as previously posted on this thread).
  • Added Dither_srgb_display for Y'CbCr preview and accurate screen captures.
  • More meaningful error messages about wrong clip formats.
  • SmoothGrad and Dither_box_filter16 now work correctly on picture of width > 2048
  • Fixed a bug in multithreaded Dither_resize16.
  • Bug fixed in MVTools (multithreaded MCompensate).

Lenchik:

Here is another solution to go from YV12 to YV24, assuming progressive frames and MPEG-2 chroma placement:
Code:
# Stack16 clip on input

w = Width ()
h = Height () / 2
u = UToY8 ().Dither_resize16 (w, h, kernel="spline36", src_left=0.25, u=1, v=1)
v = VToY8 ().Dither_resize16 (w, h, kernel="spline36", src_left=0.25, u=1, v=1)
YToUV (u, v, last)

# Stack16 clip on output
I hope I got the src_left coefficient right, chroma placement always give me headaches. Use w = Width () / 2 and src_left=0 to obtain 4:2:2 instead of 4:4:4.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding

Last edited by cretindesalpes; 14th June 2012 at 19:51. Reason: what bug in MVTools
cretindesalpes is offline   Reply With Quote
Old 14th June 2012, 19:36   #532  |  Link
wOxxOm
Oz of the zOo
 
Join Date: May 2005
Posts: 205
Quote:
Originally Posted by cretindesalpes View Post
[*]Added Dither_quantize to dither to bitdepths higher than 8 (almost the same function as previously posted on this thread).
That old function with 10bit dithering hack wasn't applying dither to msb and copied it as is, actually dithering only the least significant 2 bits - and what about Dither_quantize?
wOxxOm is offline   Reply With Quote
Old 14th June 2012, 19:48   #533  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
I was referring to this function, which works as expected.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 14th June 2012, 20:01   #534  |  Link
wOxxOm
Oz of the zOo
 
Join Date: May 2005
Posts: 205
Oh, thanks, I overlooked that one. However why isn't there a 'mode' parameter?
wOxxOm is offline   Reply With Quote
Old 14th June 2012, 20:13   #535  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
You're right, I forgot itů

You can redownload the archive, I've just fixed it without changing the version number.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 15th June 2012, 13:15   #536  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,089
Thanks for the update cretindesalpes! I noticed that avstp is still v.1.0.0 instead of v.1.0.1. I don't know if this is by mistake or not.

Last edited by Reel.Deel; 16th June 2012 at 02:46. Reason: spelling
Reel.Deel is offline   Reply With Quote
Old 15th June 2012, 15:31   #537  |  Link
Tempter57
Registered User
 
Join Date: Jan 2011
Location: Ukraine, Donetsk
Posts: 31
cretindesalpes

This is taken from the dither.avsi documentation:
Code:
dfttest (lsb=true)
SmoothGrad ()
Dither_quantize (10, mode=6,reducerange=true)
Dither_convey_yuv4xxp16_on_yvxx ()
Tempter57 is offline   Reply With Quote
Old 15th June 2012, 19:37   #538  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
Reel.Deel:

Yes, a mistake again, shame on me. The package is updated to v1.18.1 with the right dll version. I hope I got everything right this time.

Tempter57:

Use reducerange=true only if you want to encode with --input-depth 10. In this example, the bitdepth was still 16. But it wasn't very clear actually, so I elaborated a bit more.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 17th June 2012, 11:46   #539  |  Link
shark000X
Real Harper's Mockingbird
 
Join Date: Mar 2012
Posts: 14
cretindesalpes, hi!

Thank you very much for the great tools that for last years stay to be revolutionary from a technical point of view.

It seems, if we use
Code:
Dither_convert_8_to_16()
Dither_quantize(8, mode=6, reducerange=false)
no matter which mode, the result is the same as if Dither_quantize is not used at all. Is it a feature, or my mistake?
In the above example the reducerange=true variant just flips the MSB and LSB, no other changes also.
May be the Crop() is enough here to go back to the natural 8 bits?

Thanx

Last edited by shark000X; 17th June 2012 at 12:05.
shark000X is offline   Reply With Quote
Old 17th June 2012, 21:21   #540  |  Link
mandarinka
Registered User
 
mandarinka's Avatar
 
Join Date: Jan 2007
Posts: 685
The first command sets LSB part to zeros. Therefore, the second command dithers those zeros into the unchanged MSB. It's sorta logical for the MSB part (8-bit) to be unchanged after that. And since the LSB was zeros too, nothing changed there too.
mandarinka is offline   Reply With Quote
Reply

Tags
color banding, deblocking, noise reduction

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 16:57.


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