Log in

View Full Version : Looking for BM3D denoise for virtualdub2


vigan1
8th July 2020, 22:19
Hello. I am looking for a BM3D plugin or a way to use it on virtualdub2 at deepcolor (higher than 8-bit).

Can you help me. Is there a way to denoise with BM3D method and preview the results on vdub2 ?

Thank you.

ChaosKing
8th July 2020, 22:28
Vapoursynth has a BM3D (32 bit depth) plugin and you can open vpy (vapoursynth scripts) in vdub2.

vigan1
8th July 2020, 23:39
Thank you so much. Can I preview the result in virtualdub2 with this method ?

If you could also point me toward a tutorial on using vpy scripts on virtualdub it would be helpful. Thank you.

EDIT: I downloaded the FATPACK, I will try to learn it.

Cary Knoop
9th July 2020, 00:42
Thank you so much. Can I preview the result in virtualdub2 with this method ?

If you could also point me toward a tutorial on using vpy scripts on virtualdub it would be helpful. Thank you.

EDIT: I downloaded the FATPACK, I will try to learn it.
You can use the Vapoursynth Editor, which is included in the fatpack, very easy to see the results.

You can also use the interleave and stack vertical/horizontal functionality of Vapoursynth to make real-time comparisons.

ChaosKing
9th July 2020, 08:35
Simple example
import vapoursynth as vs

import mvsfunc as mvf

core = vs.core
#core.max_cache_size = 8000 # uncomment this and give VS as much ram as possible, 8000 = 8gb

clip = core.lsmas.LWLibavSource(source=r"E:\folder\xyz.mp4")

clip = mvf.BM3D(clip, sigma=5.0, profile1="fast", radius1=1) # radius > 1 => temporal denoising (V-BM3D (spatial-temporal denoising)
clip.set_output()




If you want the portable fatpack to work with vdub, run enable_vfw_support.bat
(If you move or rename the folder it won't work anymore, then you you'd need to re-run the bat file)

https://github.com/HomeOfVapourSynthEvolution/mvsfunc/blob/7948c8be129bc9cb282cf24e25b3c4b77328a9e0/mvsfunc.py#L700

vigan1
9th July 2020, 17:55
Ok thanks a lot guys. So it creates a variable, I should not move the folder.
I just ran the "enable_vfw_support.bat" from the "extras" folder.
Now I create a text file copy the code below and call it "BM3D.vpy"

import vapoursynth as vs

import mvsfunc as mvf

core = vs.core
#core.max_cache_size = 8000

clip = core.lsmas.LWLibavSource(source=r"C:\videos\cfhdstock10bit422.avi")

clip = mvf.BM3D(clip, sigma=5.0, profile1="fast", radius1=1) # radius > 1 => temporal denoising (V-BM3D (spatial-temporal denoising)
clip.set_output()

Now I have to run the vpy script in Virtualdub2 from "Open Video file".
It should be 32bit processing ? In the github document it said default is 1 (=32bit).

EDIT : it works perfectly, thank you so much all of you.
The only problem (but it's the normal behaviour) it's that I do have 2 preview in virtualdub2, but both are the Vapoursynth output video.
Is there a way to have a before (left) and after vapoursynth (right) preview in virtualdub2 ?
Thank you guys I am happy with the results of vapoursynth !
What is the best denoiser you recommend ?

ChaosKing
11th July 2020, 11:56
Now I have to run the vpy script in Virtualdub2 from "Open Video file".
It should be 32bit processing ? In the github document it said default is 1 (=32bit).

use
clip = mvf.Depth(clip, depth=32)

Is there a way to have a before (left) and after vapoursynth (right) preview in virtualdub2 ?
Thank you guys I am happy with the results of vapoursynth !
What is the best denoiser you recommend ?

clip = core.lsmas.LWLibavSource(source=r"C:\videos\cfhdstock10bit422.avi")
source = clip
clip = mvf.Depth(clip, depth=32)
clip = mvf.BM3D(clip, sigma=5.0, profile1="fast", radius1=1)

clip= core.std.StackHorizontal([clip.text.Text("Denoised"), mvf.Depth(source, depth=32).text.Text("Source")])

# or use this instead for comparison
# clip=core.std.Interleave([clip.text.Text("Denoised"), mvf.Depth(source, depth=32).text.Text("Source")])

clip.set_output()


There is no best denoiser, however there are some good (and faster) denoisers such as:
- MCTemporalDenoise
- SMDegrain
- knlmeans

import havsfunc as haf #see doc https://github.com/HomeOfVapourSynthEvolution/havsfunc/blob/master/havsfunc.py
clip = haf.MCTemporalDenoise(clip, settings="medium")

vigan1
11th July 2020, 20:36
Hi, when I run your script in virtualdub2, I get an error :
Avisynth open failure:
Python exception: name 'core' is not defined

EDIT : I uderstand my mistake, yet when I use this code:
import vapoursynth as vs

import mvsfunc as mvf

core = vs.core
#core.max_cache_size = 8000

clip = core.lsmas.LWLibavSource(source=r"C:\videos\cfhdstock10bit422.avi")
source = clip
clip = mvf.Depth(clip, depth=32)
clip = mvf.BM3D(clip, sigma=5.0, profile1="fast", radius1=1)

clip= core.std.StackHorizontal([clip.text.Text("Denoised"), mvf.Depth(source, depth=32).text.Text("Source")])

# or use this instead for comparison
# clip=core.std.Interleave([clip.text.Text("Denoised"), mvf.Depth(source, depth=32).text.Text("Source")])

clip.set_output()
I have this error :
"VFW module doesn't support YUV422PS32 output"
Maybe Virtualdub2 is 16bit max ?
Thank you.

EDIT 2: It worked perfectly on Vapoursynth preview, I will use this for the time being. thank you.