View Full Version : New Filter: GrainOptimizer (2.02 -- Bug fixed with certain temporal denoisers)
Boulder
15th October 2007, 17:43
v2.0 crashes VDubMod almost immediately.
My script:
mpeg2source("test.d2v",cpu=4)
denoised=temporalsoften(2,5,5,8,2)
grainoptimizer(denoised)
Dark Shikari
15th October 2007, 18:48
v2.0 crashes VDubMod almost immediately.
My script:
mpeg2source("test.d2v",cpu=4)
denoised=temporalsoften(2,5,5,8,2)
grainoptimizer(denoised)Let me guess, denoised isn't YV12?
Also, how do I check the colorspace of the second clip given to me? Such checking doesn't seem to be in the SimpleSample code.
Didée
15th October 2007, 18:56
Boulder found something. Seems like it crashes if TemporalSoften is the last filter that processed the 'denoised' clip.
Crashes Always:
a = last
b = AnyOrNoFilter().Temporalsoften(..)
GrainOptimizer(a,b)
Always works:
a = last
b = Temporalsoften(..).AndAnotherFilter()
GrainOptimizer(a,b)
Until the cause is found, TemporalSoften(..).RemoveGrain(0) is a very fast workaround.
Razorholt
15th October 2007, 19:06
I have no problem with the following code:
clip1=DGDecode_mpeg2source("C:\Videos.d2v",info=3)
clip1 = clip1.colormatrix(interlaced=true)
clip1 = clip1.yadif()
clip1 = clip1.ConvertToYV12()
denoised = clip1.temporalsoften(2,5,5,8,2)
grainoptimizer(denoised)
Boulder
15th October 2007, 19:14
The colorspace is YV12, a regular DVD source. In fact, using MVDegrain2 or RemoveGrain(mode=0) alone for "denoised" also crash.
I'm using the latest Avisynth 2.5.8 alpha, all the other filters are working fine. My CPU is a Northwood P4 (MMX/SSE/SSE2 support), could this be another issue with CPU-specific code?
Didée
15th October 2007, 20:01
Razorholt: Exactly like you posted it, your script cannot work at all. You missed to deliver 'clip1' as input clip to GrainOptimizer, hence 'denoised' is interpreted as input clip, hence the 'denoised' clip is missing and an error (should) be thrown.
Boulder: Can't confirm. While I don't trust my crappy Celeron 100% on some things, RemoveGrain(x) does work, including x=0. MVDegrain2 works also, as does FluxSmooth, as does FFT3DFilter, as does DegrainMedian. That's the ones I tested. TemporalSoften for me is the only one that forces the crash:
src = mpeg2source("test.d2v")
vbw2 = src.MVAnalyse(isb=true, delta=2,idx=1)
vbw1 = src.MVAnalyse(isb=true, delta=1,idx=1)
vfw1 = src.MVAnalyse(isb=false,delta=1,idx=1)
vfw2 = src.MVAnalyse(isb=false,delta=2,idx=1)
nr = src
#nr = nr.MVDegrain2(vbw1,vfw1,vbw2,vfw2,idx=1) # works
#nr = nr.FFT3DFilter(sigma=4,bt=3) # works
#nr = nr.removegrain(0) # works
#nr = nr.DegrainMedian(mode=2) # works
#nr = nr.fluxsmoothst(20,2) # works
#nr = nr.temporalsoften(2,5,5,8,2) # -fails-
src.grainoptimizer(nr)
Boulder
15th October 2007, 20:38
I'll try downgrading Avisynth when my latest project finishes some time tomorrow. Opening a script with "last" fed in Grainoptimizer as the denoised clip crashes too. MPC shows a system exception - access violation error, address 0x0 reading from 0x0. Not much help there I think.
Dark Shikari
15th October 2007, 20:51
Question: for two YV12 clips with the same width and height, are there any values (pitch, etc) that can possibly differ between them?
Manao
15th October 2007, 20:52
Everything except width, height and colorspace can differ. Moreover, pitch can change from frame to frame.
Razorholt
16th October 2007, 02:32
Razorholt: Exactly like you posted it, your script cannot work at all. You missed to deliver 'clip1' as input clip to GrainOptimizer, hence 'denoised' is interpreted as input clip, hence the 'denoised' clip is missing and an error (should) be thrown.
Yes, I forgot clip1 in the last line. Now I get the error that you're talking about ... :(
Dark Shikari
16th October 2007, 02:47
Try this version (http://www.mediafire.com/?dotjnxysp3x) and see if it fixes the crashing.
Razorholt
16th October 2007, 04:13
Nope. Still crashing.
Boulder
16th October 2007, 18:34
Doesn't work here either :(
burfadel
17th October 2007, 04:46
Doesn't work here either, only for mpeg2source when there's editing involved (so virtualdubmod is used). Thought I had it working on a test clip, but can't get it to work again. I had used:
clip1=MPEG2Source("%source_file%").converttoyv12()
Razorholt
17th October 2007, 05:11
Have you managed to encode anything with your setting? I can load fine but the error occurs a few seconds after I launch the encoding. Do you mind posting your entire script?
Cheers.
burfadel
17th October 2007, 07:41
I don't know why it worked just that once, it didn't work the second time I tried, everything was exactly the same.
The grainoptimizer filter works with everything, its only when virtualdubmod loads to cut the wav file. I hope its a bug in the filter (sorry Dark Shikari) and not virtualdubmod, as virtualdubmod isn't updated/maintained any more and hasn't for 2 years.
There is a virtualdubmod mod :) by audx based on 1.6.0.0, still a very old version, that works as a replacement for virtualdubmod but still has the same problem in regards to the wav files.
I loaded the script in virtualdub-mpeg2 (which doesn't have all the required features of virtualdubmod to work in its place), and the video loaded fine with the filter! (with the picture in the panes etc etc) I assume when loading the script with the filter set up in it that virtualdub loads the filter too, which is why its causing the crash even though its only dealing with the audio. If loaded in virtualdubmod there is no picture! So is the crash caused by a bug in the filter that disagrees with virtualdubmod, or a bug in virtualdubmod/virtualdub (that has since been fixed) but is of no benefit unless an updated virtualdubmod and patches is released?
The same problem occurs with the main 2.0 release and the release 2.01 as referenced earlier.
burfadel
17th October 2007, 10:57
I found Temporalremovegrainhd is a good filter that apparently also temporally (temporal wise lol) removes noise, part of the removegrainhd filter. Even at default values. That filter has to be put in the right spot otherwise it crashes though (well the x264 outputs an almost empty file).
For Mpeg2 with a resizer I have to put it after crop but before resizer, and for avi where no resizer after crop. Weird I know but its a good filter to use until grainoptimiser is fixed. Mind you, it removes grain and not optimises it, so it does have a slightly different purpose. Quality is good though, as is the file reduction size. Haven't tried it with heavy noise.
Razorholt
17th October 2007, 18:09
Trying Temporalremovegrainhd (http://home.pages.at/kassandro/RemoveGrainHD/RemoveGrainHD.htm) right now. Thanks for the tip, burfadel.
burfadel
17th October 2007, 22:43
Trying Temporalremovegrainhd (http://home.pages.at/kassandro/RemoveGrainHD/RemoveGrainHD.htm) right now. Thanks for the tip, burfadel.
How did it work for you?
Dark Shikari
17th October 2007, 22:53
Yeah, I've been somewhat busy the past day or two; I'll see if I can fix it this weekend.
hristoff2
17th October 2007, 23:15
"There is no such function.." (avisynth 'plugins' dir)
LoadCPlugin / LoadPlugin = Don't work (can't open)
v2.0
Unfortunately this doesn't make any sense, can't use the filter on my 2nd pc which is almost identical to the computer where I'm writing this.
I'm posting this just in case someone had this weird error and found a weird solution..
salehin
18th October 2007, 00:35
"There is no such function.." (avisynth 'plugins' dir)
LoadCPlugin / LoadPlugin = Don't work (can't open)
v2.0
Same here... it was working with the previous edition of version 2:)
Leak
18th October 2007, 09:39
I'd hazard a guess you're missing this (http://www.microsoft.com/downloads/details.aspx?FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647&DisplayLang=en)...
Razorholt
18th October 2007, 16:08
@burfadel : It's a pretty clever filter. It reduces the file size without degrading the picture too much, like other denoisers.
@leak: what's your success rate with GrainOptimizer? Are you having the same issue that most of us have?
Thanks,
- Dan
Terranigma
18th October 2007, 16:46
@burfadel : It's a pretty clever filter. It reduces the file size without degrading the picture too much
There's denoisers out there that can greatly reduce the file size as well without degrading the picture quality at all (if you know how to use them properly, and know which ones can do this). ;)
CruNcher
19th October 2007, 00:48
hmmm any idea what is wrong here ?
grain=ffmpegsource("grain.m2v")
watter=ffmpegsource("G:\watter.m2v")
black2=ffmpegsource("G:\black2.m2v")
action=ffmpegsource("G:\action.m2v")
black1=ffmpegsource("G:\black1.m2v")
black3=ffmpegsource("G:\black3.m2v")
final=grain+watter+black2+action+black1+black3
source=final.autocrop(wMultOf=16,hMultOf=8,0).trim(500,550)
#### (1)
#clip2=source.RemoveGrain(mode=0, modeU=0, modeV=0).FFT3DGPU(sigma=5,plane=3,precision=0)
#source.GrainOptimizer(clip2)
#### (2)
#clip2=source.RemoveDirt(false).FFT3DGPU(sigma=5,plane=3,precision=0)
#source.GrainOptimizer(clip2)
both sections endup in the same result (not expected) ???
removing the clip2= and source.GrainOptimizer(clip2) gives different files (expected)
it almost looks like it would ignore all the things after the clip2=source. (and jump to the source=final) hmmm should it do that ?
PS: Im sure im doing something wrong here :P
Dark Shikari
19th October 2007, 02:45
There's denoisers out there that can greatly reduce the file size as well without degrading the picture quality at all (if you know how to use them properly, and know which ones can do this). ;)They can, but they remove the grain--the point of this filter is to reduce file size without getting rid of film grain (and it works even after a normal denoiser, though its less effective).
As I said, I'll try to find the problem this weekend.
Raere
19th October 2007, 04:00
I'm a little confused here, and haven't really tried it yet. It reduces filesize, meaning that you can increase the bitrate and still hit the same filesize? So, basically free bitrate increasing?
Boulder
19th October 2007, 04:12
The bitrate will remain the same because (bits per second) * (length of the source in seconds) will determine the filesize you want to hit. Using a grain remover/optimizer, the encoder just doesn't need to use as high quantization levels to achieve that filesize. One could consider it "less aggressive compression".
Shinigami-Sama
19th October 2007, 04:15
I'm a little confused here, and haven't really tried it yet. It reduces filesize, meaning that you can increase the bitrate and still hit the same filesize? So, basically free bitrate increasing?
say you've got a bunch of towels
you can just try and jam into the closet(bitrate) and you have to squish them hard to get them to fit, this might mess up their shape a little(lower quality)
now if you take those same towels and fold them, they fit, and with a little room left over(less bitrate needed for the same quality)
thats what this filter does the grain, shuffles it into better spots
dark can correct me if I'm wrong
burfadel
19th October 2007, 04:20
Depends on the mode used :) thats true for CBR & ABR modes only. To over simply it, the encoder can concentratrate more bitrate on picture detail and not grain detail, so for these two modes the result should be a higher quality image when typical bitrates are used.
For a constant quality/quantiser mode, the bitrate will drop, possibly significantly, as less information is needed to be encoded to achieve the same perceptual quality.
woah!
19th October 2007, 04:23
well i have tried this on alot of different clips and havent seen any drop of bitrate or anything to be honest. i "think" i am doing the correct process.
i used Dark Shikari avs scripting above in my own to get it running ... i think..
src = DirectShowSource("L:\FEATURE1.EVO.grf",fps=23.976,framecount=80016,audio=false)+DirectShowSource("L:\FEATURE2.EVO.grf",fps=23.976,framecount=87638,audio=false)
nr = src.DegrainMedian(mode=3)
src.grainoptimizer(nr)
trim(73600,74400)
ConvertToYV12()
burfadel
19th October 2007, 04:53
You will only see a drop in bitrate if CRF or quantiser mode is used, what settings are you using for the encoder?
woah!
19th October 2007, 04:55
--crf 18 --me-prepass --threads auto --thread-input --qpmin 1 --mvrange 511 -b 2 --bime --weightb -r 3 --mixed-refs --direct auto -f -1:-1 -A "All" -8 --me esa -m 5 --fpel-cmp sad --no-fast-pskip --progress -o
Leak
19th October 2007, 08:45
@leak: what's your success rate with GrainOptimizer? Are you having the same issue that most of us have?
Success rate: NaN (division by zero, actually...)
I just took a look at the file to see which version of the VC runtime it needs, I didn't try it. :D
CruNcher
19th October 2007, 18:40
Ok found the problem the v 2.1 seems to be buggy v 2.0 (official) works at least gives a different final result for both sections
burfadel
20th October 2007, 20:58
Ok found the problem the v 2.1 seems to be buggy v 2.0 (official) works at least gives a different final result for both sections
2.1? I take it you mean 2.01?
Dark Shikari
21st October 2007, 05:08
Oh god, this is embarrassing. I found the main bug; it was fetching a write pointer instead of a read pointer :scared:
Try a new fixed version here (http://www.mediafire.com/?5zgnzmp49gl).
burfadel
21st October 2007, 07:16
Well, um, at least you found a bug!
The problem is still occurring with Virtualdub audio (wave file) cutting as before, which is found in edited tv programmes. I did a quick try with a dvd vob cutting (which is AC3 cutting) and it seems to work fine.
Dark Shikari
21st October 2007, 07:30
Well, um, at least you found a bug!
The problem is still occurring with Virtualdub audio (wave file) cutting as before. I did a quick try with a dvd vob cutting and it seems exempt, it seems only to occur in my case, with TV recordings.What problem are you referring to? I'm referring to the crashing with TemporalSoften :)
burfadel
21st October 2007, 09:27
I'm talking about the Virtualdub crash upon audio editing :) It just doesn't like the grainoptimizer filter! With every other filter etc there aren't any problems. Other people have had the same problem too, on page 6 :). I think its a separate issue?
Boulder
21st October 2007, 09:36
v2.01 works now on my system, no VDub crashes anymore.
burfadel
21st October 2007, 09:57
v2.01 works now on my system, no VDub crashes anymore.
What type of file were you encoding? was it dvd or tv?
It works fine with me with DVD, its only TV source where its using mp2 (so cuts a wave file) that is the problem that I'm having :)
burfadel
22nd October 2007, 01:17
Here's a very simple script:
SetMemoryMax(128)
clip1=DirectShowSource("300.divx").ConvertToYV12()
LoadPlugin("GrainOpt.dll")
clip2=clip1.fft3dgpu(sigma=3,bt=3).TTempSmooth(maxr=3,strength=4)
clip1.GrainOptimizer(clip2)
I should add an error catching feature to return an error if a second clip isn't given in the argument (i.e. using GrainOptimizer() instead of GrainOptimizer(clip2) ).
I found the source of the problem I was talking about! The above example you had earlier was the cause. For AC3 audio etc it worked fine, but when editing a TV record that used mp2 sound, the mp2 audio is converted to a wav file, then cut by virtualdubmod. Virtualdubmod does not like the code syntax:
clip1=(source type, for example Mpeg2source)
clip2=clip1.(denoiser)
clip1.grainoptimizer(clip2)
I confirmed this as no matter what filter you put in place of grainoptimizer, it did not work, but ONLY in the situation of wav file cutting!
Instead, I changed the above syntax to:
(source type)
(other filters here, such as deinterlacer, resizer etc)
clip1=(denoiser)
grainoptimiser(clip1)
That works flawlessly, and is, in affect, exactly the same as the other code but more simplified... and the main point of working with virtualdubmod.
Sorry Dark_shikari if you were searching for the problem! I did use your example :) lol, it wasn't expected so its ok! Thanks for a great filter!
Dark Shikari
19th November 2007, 16:48
New version up; fixes blocking issues after scene changes caused by overzealous temporal denoisers. Thanks to Infernix for catching this bug!
Razorholt
19th November 2007, 17:31
Thanks Darky! However the link is not working... it says "File doesn't exist."
Dark Shikari
19th November 2007, 18:03
Thanks Darky! However the link is not working... it says "File doesn't exist."Damnit... blame jarod... I uploaded it earlier and it simply disappeared :scared:. I've put up a backup mirror.
buzzqw
19th November 2007, 19:02
would be ever possibile to make a version (2.xx) that works without a previus "cleaned" picture ? just for making it faster..
thanks!
BHH
desta
19th November 2007, 21:02
Can't load 2.02 in vdub, and can't download 2.01 - link doesn't exist. :(
edit: working fine now... human error. My human error! :sly:
salehin
8th January 2008, 21:08
I was wondering if there is any way I can optimise this encode further. Optmise in the sense that removing the grains and then reintroducing it later via grainoptmizer. Here, I'm assuming that grainOpt can retain grains at a relatively lower bitrate without costing too much on average qp or crf
MeGUI cmd line at crf 18.5:
--crf 18.5 --ref 5 --mixed-refs --no-fast-pskip --bframes 3 --b-pyramid --b-rdo --bime --weightb --direct auto --filter -3,-3 --subme 7 --trellis 1 --analyse all --8x8dct --me umh --threads auto --thread-input --cqmfile "C:\Program Files\megui\Custom Matrices\Prestige.cfg" --progress --no-dct-decimate --no-psnr --no-ssim --output "output" "input" --aq-strength 0.3
avs script:
SetMemoryMax(128)
clip1=dgdecode_mpeg2source("J:\temp\crf test.d2v",info=3).ColorMatrix(hints=true,interlaced=true).tfm(order=0).tdecimate(hybrid=1)
a=clip1.crop(2, 8, -2, -2)
clip2=a.DeGrainMedian(limitY=2,limitUV=3,mode=1) #DeGrainMedian(limitY=2,limitUV=3,mode=1)
#clip2.LimitedSharpenFaster(Strength=50).Spline36Resize(1280, 720)
GrainOptimizer(clip2).LimitedSharpenFaster(Strength=50).Spline36Resize(1280, 720)
I get the following quants
avis [info]: 1280x720 @ 23.98 fps (1472 frames)
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX MMXEXT SSE SSE2 Cache64
x264 [info]: slice I:13 Avg QP:17.54 size:121194
x264 [info]: slice P:608 Avg QP:19.55 size: 40153
x264 [info]: slice B:851 Avg QP:21.54 size: 11909
x264 [info]: mb I I16..4: 0.9% 95.9% 3.2%
x264 [info]: mb P I16..4: 0.1% 7.1% 0.3% P16..4: 56.6% 22.6% 11.7% 0.3% 0.1% skip: 1.2%
x264 [info]: mb B I16..4: 0.0% 0.4% 0.0% B16..8: 25.8% 1.1% 5.3% direct: 8.5% skip:58.8%
x264 [info]: 8x8 transform intra:94.9% inter:81.9%
x264 [info]: direct mvs spatial:98.4% temporal:1.6%
x264 [info]: ref P 55.5% 28.3% 6.5% 6.7% 3.0%
x264 [info]: ref B 69.6% 22.3% 3.8% 2.7% 1.6%
x264 [info]: kb/s:4707.0
Also, I can't seem to be able run version 2.02 properly- i have already installed the required msft tool. Only v 1.2 works. Please advise
[Setup OS: xp home SP2 | MeGUI: 0.3.1004 | Avisynth: 2.57]
Thanks :)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.