Log in

View Full Version : Too Much Noise...


Kyaneos
2nd December 2005, 01:03
Hi. I'm trying to do a backup of an ancient tv Show, it has quality very small, I have used enough filters, but none convinces me, the problem that has the video is that has many vibrations and it is difficult to remove without impoverishing the image or losing great quantity of details. I have tried with filters like " Temporary cleaner ", "fluxsmooth", "FFT3Dfilter" ... and none convinces me. I like that the experts in the matter were giving to me something advice on that filters to use, here I leave you a sample of the TV Show without compressing (it's the original .vob)

Thanks

Sample:

http://www7.rapidupload.com/d.php?file=dl&filepath=3083

Guest
2nd December 2005, 01:30
Please read and follow forum rules, specifically rule 9: use a proper thread title. Thank you.

The server is downloading for me at 10K/sec. Sorry, don't have the patience. Post a JPG.

danpos
2nd December 2005, 02:11
@Kyaneos

I did download the vob provided for you and I didn't see any 'vibrations' into it. Could you to elaborate more what do you want and what do you think to be the problem?

Cheers,

Chainmax
2nd December 2005, 04:31
Wow, this sample is seriously f***ed up. I think it has some blocking aside from the heavy noise. You probably won't be able to clean it up without removing a lot of detail. I tried several alternatives but none worked too well.

Kyaneos
2nd December 2005, 04:56
Please read and follow forum rules, specifically rule 9: use a proper thread title. Thank you.

Ok, sorry, i have changed thread title. this is my first post, i follow the rules in the next post, once again, sorry.

The server is downloading for me at 10K/sec. Sorry, don't have the patience. Post a JPG.

I have re-uploader the file to another server, hope that it will go more quickly, but you can not download I will post a jpgs.

The alternative Link: http://www7.rapidupload.com/d.php?file=dl&filepath=3083

I didn't see any 'vibrations' into it

The video has a too many noise, concretly "temporal noise" with grain, vibrations and generalized noise. I haven´t founded the way of correcting it without damaging the image. ATC, temporalsoften, temporal cleaner... spoil the video.

Mug Funky
2nd December 2005, 09:43
i'm having a shot downloading it from the alternate source (btw, that "megaupload" is a bit of a dud... full of crap porn ads).

from the 2 frames i got out of megaupload before i cancelled, it doesn't look too bad. probably mvflow + interleave + removedirt for this one.

i'll check it out in a sec.

[edit]

by "vibration", do you mean very slight movement in static areas that shouldn't be there?

that's caused by noise pushing the motion-estimation around when the source was encoded.

[edit 2]

try this:
assumetff()

dedot()

even=last.separatefields().selecteven()
odd=last.separatefields().selectodd()

vfe = even.mvanalyse(truemotion=true,pel=2,isb=false)
vbe = even.mvanalyse(truemotion=true,pel=2,isb=true)

vfo = odd.mvanalyse(truemotion=true,pel=2,isb=false)
vbo = odd.mvanalyse(truemotion=true,pel=2,isb=true)

interleave(even.mvflow(vfe),even,even.mvflow(vbe),odd.mvflow(vfo),odd,odd.mvflow(vbo))
removedirt()
selectevery(6,1,4)
weave()
temporalsoften(4,2,4)

requires DeDot, Kassandro's removedirt, and fizick's latest version of manao's lovely MVtools. searching the forum will give you the required links (and discussions) for these plugins.

99% noise gone, 99% of signal intact.

Kyaneos
2nd December 2005, 14:26
Mug Funky:

I uploading to alternative server:

http://www7.rapidupload.com/d.php?file=dl&filepath=3083

This doesn´t has porn ads and it`s more quick, please download you from it.

Mug Funky
2nd December 2005, 14:34
oh, that's okay. i downloaded it from the other link hours ago. did you try my script yet? it worked fine for the sample you gave, but you'll have to check it out on stuff like slow pans and varying brightness (either fades or flickering film) as these are potential problems with the approach i've used.

i find noise reduction is a big problem when the noise level is very close to the signal level, but your source is far from that and so there's lots of hope for it yet.

try 16mm film from 1963... that's hellish to denoise. you're lucky the origin of your source is a tube video camera - those things make video that's easy to denoise, and quite forgiving. film is lots harder, especially high-speed stuff - you get registration problems which screw up temporal filters, luminance flicker which screws up everything, and dust-and-scratch which would be removable but for the other problems. then there's grain. lots of grain.

Kyaneos
2nd December 2005, 17:35
Hi!

Mug Funky your script give me an error:

"Script error: there is no function named "removedirt"

This is my avs script:

LoadPlugin("C:\ARCHIV~1\ARCALC~1\dgmpgdec\DGDecode.dll")
LoadPlugin("C:\ARCHIV~1\ARCALC~1\AVS_Plugins\TomsMoComp.dll")
LoadPlugin("C:\ARCHIV~1\ARCALC~1\AVS_Plugins\MVTools.dll")
LoadPlugin("C:\ARCHIV~1\ARCALC~1\AVS_Plugins\RemoveDirt.dll")
LoadPlugin("C:\ARCHIV~1\ARCALC~1\AVS_Plugins\De.dll")




Mpeg2Source("C:\DOCUME~1\ADMINI~1\ESCRIT~1\TEMPFT~1\VTS_01_1.d2v")


assumetff()

dedot()

even=last.separatefields().selecteven()
odd=last.separatefields().selectodd()

vfe = even.mvanalyse(truemotion=true,pel=2,isb=false)
vbe = even.mvanalyse(truemotion=true,pel=2,isb=true)

vfo = odd.mvanalyse(truemotion=true,pel=2,isb=false)
vbo = odd.mvanalyse(truemotion=true,pel=2,isb=true)

interleave(even.mvflow(vfe),even,even.mvflow(vbe),odd.mvflow(vfo),odd,odd.mvflow(vbo))
removedirt()
selectevery(6,1,4)
weave()
temporalsoften(4,2,4)

I have msvcr71.dll and i have intalled the Kassandros' removedirt correctly, do you know where is the error?

Thanks

acrespo
2nd December 2005, 18:31
Removedirt is a avisynth function. removedirt.dll has some plugins used in Removedirt() function

Here is Removedirt():


function RemoveDirt(clip input, bool "_grey", int "repmode")
{
_grey=default(_grey, false)
repmode=default(repmode, 16)
clmode=17
clensed=Clense(input, grey=_grey, cache=4)
sbegin = ForwardClense(input, grey=_grey, cache=-1)
send = BackwardClense(input, grey=_grey, cache=-1)
alt=Repair(SCSelect(input, sbegin, send, clensed, debug=true), input, mode=repmode, modeU = _grey ? -1 : repmode )
restore=Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode)
corrected=RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, gmthreshold=70, dist=1, dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode )
}

krieger2005
2nd December 2005, 23:27
There is still the old RemoveDirt (not the script... the plugin). Maybe Mug Funky mean this one for the example above?

Kyaneos
3rd December 2005, 04:05
Mug Funky thanks for your script, i have tried it but i don´t like the results. The image has movement in statics areas yet (i say vibrations XD). This is the script that i obteined the best results:

TomsMoComp(1,15,1)
atc(3,6,9,0.5,false)
fluxsmoothst(15,15)
undot()
unfilter(5,5)
Crop(12,2,-12,-2)
Lanczos4Resize(576,432)
LumaYV12(2,1)


But this script doesn't like to me either :( Do You have some idea?

Chainmax
3rd December 2005, 13:49
Preliminary tests with LTSLP and ffdshow's SPP deblocking look promising, I will post an Xvid encode soon.

Kyaneos
3rd December 2005, 15:39
Thanks Chainmax, I will hope the xvid encode ;)

Didée
3rd December 2005, 16:15
It's a bit difficult, Kyaneos ... we've heard plenty of "I don't like it/that" by now. But how are we supposed to know what you DO like?

However: First off, consider using TDeint instead of TomsMoComp for deinterlacing. TMC is prone to artefacting (spray pixels), especially with a search setting as high as "15". (Tom recommends to not go beyond 5.) Then, using the line averaging mode of TMC will also smear the noise, which will actually lower its spatial frequeny. Though this seems to calm down the noise in first place, it may make the job for any aftercoming deinterlacer more difficult.

Just for fun, I tried a script function that from the start was not meant to use for real encoding (only for internal use to gather more stable metrics). However it seems to mostly do a reasonable job in fact, so here it is:

function LTbS(clip clp, int "nr", int "fr", int "mode", int "_uv")
{
nr = default(nr,3)
fr = default(fr,1)
mode = default(mode,2)
cmod = (_uv==3) ? 1 : (_uv==2) ? 0 : -1
NRstr = string(nr)
spat = clp.removegrain(4,4*cmod,4*cmod).removegrain(19,19*cmod,19*cmod)
temp = clp.temporalsoften(fr,111,222,24,2)
spatd = yv12lutxy(clp,spat,"x y - 128 +","x y - 128 +","x y - 128 +",U=_uv,V=_uv)
tempd = yv12lutxy(clp,temp,"x y - 128 +","x y - 128 +","x y - 128 +",U=_uv,V=_uv)
diff1 = yv12lutxy(tempd,spatd,"x 128 - y 128 - * 0 < y 1 x 128 - x 128 - abs 0.0001 + / * + x 128 - abs y 128 - abs > y 1 x 128 - x 128 - abs 0.0001 + / * + x ? ?",
\ "x 128 - y 128 - * 0 < y 1 x 128 - x 128 - abs 0.0001 + / * + x 128 - abs y 128 - abs > y 1 x 128 - x 128 - abs 0.0001 + / * + x ? ?",
\ "x 128 - y 128 - * 0 < y 1 x 128 - x 128 - abs 0.0001 + / * + x 128 - abs y 128 - abs > y 1 x 128 - x 128 - abs 0.0001 + / * + x ? ?",U=_uv,V=_uv)
diff2 = repair(tempd,spatd,1,1*cmod,1*cmod)
out = yv12lutxy(clp,diff1,"y 128 - abs "+NRstr+" > x "+NRstr+" y 128 - y 128 - abs / * - x y 128 - - ?","x y 128 - -","x y 128 - -",U=_uv,V=_uv)
out2 = yv12lutxy(clp,diff2,"y 128 - abs "+NRstr+" > x "+NRstr+" y 128 - y 128 - abs / * - x y 128 - - ?","x y 128 - -","x y 128 - -",U=_uv,V=_uv)
(mode==1) ? out : out2
return last
}

The purpose is to use temporalsoften, but limit all pixel changes to what a spatial smoother would do (plus a little). Hence the Name LTbS - - "Limit Temporal by Spatial".
To try it, you'll need the MaskTools (http://manao4.free.fr/MaskTools-v1.5.8.zip), and RemoveGrain and Repair from the actual prerelease (http://home.arcor.de/kassandro/RemoveGrain/RemoveGrain.rar).

I tried TDeint()
LTbS(nr=3,fr=2,mode=2,_uv=3) and it didn't look all that bad ;)
Some more processing might be wished, of course.

But somehow I could imagine that "you don't like it" ... ;)

Chainmax
3rd December 2005, 16:18
Ok then, this is the Xvid encode, made at single pass Q4 with the SixOfNine-HVS matrix, Adaptive Quantization and QPel. It might need some slight adjusting, but tell me what you think for now:

http://www7.rapidupload.com/d.php?file=dl&filepath=3589

Didée
3rd December 2005, 16:53
What did you do with all the detail? Sold it on E-bay? :D

Kyaneos
3rd December 2005, 18:19
Didée are very funny :D

I finish of realizing that I have not used well the scripit of mug funky, I was absent the line "removedirt ()" :( Now already I have it well (believe), the script stays this way:
LoadPlugin("C:\ARCHIV~1\ARCALC~1\dgmpgdec\DGDecode.dll")
LoadPlugin("C:\ARCHIV~1\ARCALC~1\AVS_Plugins\TDeint.dll")
LoadPlugin("C:\ARCHIV~1\ARCALC~1\AVS_Plugins\MVTools.dll")
LoadPlugin("C:\ARCHIV~1\ARCALC~1\AVS_Plugins\De.dll")
LoadPlugin("C:\ARCHIV~1\ARCALC~1\AVS_Plugins\RemoveDirtSSE2.dll")

function RemoveDirt(clip input, bool "_grey", int "repmode")
{
_grey=default(_grey, false)
repmode=default(repmode, 16)
clmode=17
clensed=Clense(input, grey=_grey, cache=4)
sbegin = ForwardClense(input, grey=_grey, cache=-1)
send = BackwardClense(input, grey=_grey, cache=-1)
alt=Repair(SCSelect(input, sbegin, send, clensed, debug=true), input, mode=repmode, modeU = _grey ? -1 : repmode )
restore=Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode)
corrected=RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, gmthreshold=70, dist=1, dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode )
}

Mpeg2Source("C:\DOCUME~1\ADMINI~1\ESCRIT~1\TEMPFT~1\VTS_01_1.d2v")

TDeint()
assumetff()

dedot()

even=last.separatefields().selecteven()
odd=last.separatefields().selectodd()

vfe = even.mvanalyse(truemotion=true,pel=2,isb=false)
vbe = even.mvanalyse(truemotion=true,pel=2,isb=true)

vfo = odd.mvanalyse(truemotion=true,pel=2,isb=false)
vbo = odd.mvanalyse(truemotion=true,pel=2,isb=true)

interleave(even.mvflow(vfe),even,even.mvflow(vbe),odd.mvflow(vfo),odd,odd.mvflow(vbo))
removedirt()
selectevery(6,1,4)
weave()
temporalsoften(4,2,4)

But it gives me the following mistake:

Script error: there is no function named "Clense"


(C:\Documen...., line 18)
(C:\Documen...., line 44)



Certainly dideé I don't displease your script ;)

Didée
3rd December 2005, 18:31
Also import "RemoveGrain.dll" and "Repair.dll", then it should work. There's quite some confusion going on with the "old" RemoveDirt (plugin) vs. the "new" RemoveDirt (script function) ...

However, Mug Funky's script from above works field based. You *must not* deinterlace before it! So, here you've to comment out TDeint ...

Kyaneos
3rd December 2005, 18:39
Thanks I am going to try it

Kyaneos
3rd December 2005, 19:27
OK. Didée thanks for your script, i will use it because "I LIKE MORE IT!!" jeje

But, now i have a new problem. The clip lasts 53 minutes and i would made in 700 mb and i would like to use 640x480 but in this resolution the quality and Brightness of the video deteriorates compared with 576x432:

- 640x480 Lanczos4resize -

http://img115.imageshack.us/img115/7452/640x4805dc.jpg

- 576x432 Lanczos4resize -

http://img115.imageshack.us/img115/9886/5764320xr.jpg

Some suggestion?

Didée
3rd December 2005, 21:16
It's not always Lanczos4. The last script I encoded your Sample with was

import("J:\_UnderWork\LimitedSharpen.avs")
import("J:\_UnderWork\Soothe.avs")
import("J:\_UnderWork\LTSLP_v02.avs")

Mpeg2Source("J:\_UnderWork\Sample.d2v")

TDeint(mthreshl=4,mthreshc=4,type=3)
crop(24,4,-8,-4)
o = last
shrp = o.LimitedSharpen(Smode=4,strength=133,soft=34)

Soothe(shrp, o, 16 )
LTbS(nr=3, fr=2, mode=2, _uv=3)

bicubicresize(640,480,.2,.4)

return( last )

Used version of LimitedSharpen was this one (http://forum.doom9.org/showthread.php?p=731909#post731909), and Soothe is here (http://forum.doom9.org/showthread.php?p=708217#post708217).
Attention, this will run rather slow.

Kyaneos
3rd December 2005, 22:13
Didée: Which Do you like more? your first script or your second script?

Chainmax
4th December 2005, 00:14
What did you do with all the detail? Sold it on E-bay? :D

I don't see any other way by which the moving noise/artifacting can be avoided, and if you look closely even in my encode there is still some motion/posterizing/whatever the hell it is. I haven't tried your script, does it eliminate the nasty artifacting and reduces most of the noise?

Didée
4th December 2005, 05:24
Didée: Which Do you like more? your first script or your second script? The first one I didn't even encode, only looked at the preview in Vdub. The 2nd just tries to enhance the sharpness somewhat, however it could be that it was a tad too much. Try yourself and see.
From the few encodes I've made ;) , it's my impression that XviD does better with sufficient sharp sources than with soft ones. That is, I encode almost always with qpel activated ... but qpel works better if there actually is some subpixel sharpness present where it can grip onto. If this sharpness is not there, qpel kind of "grips into empty space", and pays bits for hot air ... this is quite technical, and also highly a matter of personal taste. Other points of view on this are perfectly warrantable.


I don't see any other way by which the moving noise/artifacting can be avoided, and if you look closely even in my encode there is still some motion/posterizing/whatever the hell it is. I haven't tried your script, does it eliminate the nasty artifacting and reduces most of the noise?
No, not completely. However, for me the weak point most probably is the spatial smoothing you used. Spatial blurring never eliminates noise, basically. It softens the noise down, and leaves back noise of lowered spatial frequency. And it's just this kind of noise that ME based encoders like XviD do not like. If residual noise is still "sharp", chances are better to still get a stable image. However if the residual noise actually is of low spatial frequency, it is much more likely to fool the motion estimation, and to falsely get interpreted as motion where it shouldnt. The frequently mentioned "floating wall" problem is not only a codec's problem, often it is "assisted" by disadvantageous filtering.

Chainmax
4th December 2005, 20:52
I just used LTSLP + ffdshow SPP deblocking at strength 25 or so.

Kyaneos, at 53mins on a 700MB CD you'd have a total average bitrate of a little over 1800kbps. You should be able to safely use the AC3 audio (192kbps if I recall correctly) and have more than enough bitrate leftover for a comfy 640x480 encode, providing you use all the options like VHQ4, VHQ for bframes, Trellis and so on. Given that the source is so screwed up though, I'd bet a low bitrate matrix like eqm_v3ulr would be better suited for thi encode.

Mug Funky
5th December 2005, 04:55
btw, FWIW i used the old removedirt. didn't realise there was a script function for it (hope it removes spots and scratches like the old one did - real compression gain there, and with mvflow style motion-compensation there's almost no artefacts at all, except on really old film that flickers).

Didée
5th December 2005, 08:56
Just BTW, because it fits to the topic title ... here (http://home.arcor.de/dhanselmann/_samples/Babylon5_snip.m2v) is a (rather short, 5MB) sample of one of my current GRAIN test cases. If wanted, I could provide more of it.

(I wonder how calm you will get it with MVFlow+RemoveDirt, Mug Funky :) )

videoFred
5th December 2005, 11:18
try 16mm film from 1963... that's hellish to denoise. you're lucky the origin of your source is a tube video camera - those things make video that's easy to denoise, and quite forgiving. film is lots harder, especially high-speed stuff - you get registration problems which screw up temporal filters, luminance flicker which screws up everything, and dust-and-scratch which would be removable but for the other problems. then there's grain. lots of grain.

OK, but some grain is so typical (and awesome) for film...
A good 16mm film transfer easy blows out every digital film, believe me!
Old analogue video is a disaster compared with old 8mm film.

But flicker is caused by transfer equipment.
What do you think about the example movies on my site? (WMV format)
I see no flicker, no hotspot, low grain.
These are 1972 -8mm films....

OK: for the definitive versions I must crop borders more, there is a hair visible from the projectors gate, and zooming/motion can be a lot smoother, but we have a tool for this, now, right? :)

Fred.

Mug Funky
5th December 2005, 11:46
aaah, on live action there should indeed be no flicker (unless there's fades that have been sloppily done).

but anime is a different story :) i'm talking about 16mm transfers from the original 1960's Astroboy series. that means it's been copied from the japanese master (so it can have english audio printed on it) onto (usually) cheap B&W stock. i'll grab a sample next time i've got a sec at work... in cases like this film grain definitely is not cool... though removing too much is a bad idea too. (temporal smearing is really obvious when there's registration errors on the film... subtle shades stay still but obvious ones move about). and then there's the missing episodes that were only recently found. episode 20 has some kind of fungus in the darker areas (looks like whatever those splotches are, they love film emulsion). there's crap on every single frame of that episode...

[edit]

@ didee: that's some noisy stuff. try add another 6dB or so and you'll have the stuff i'm talking about :)

[edit 2]

this goes some way to removing the noise, but not far enough (and at what cost...)

mpeg2source("D:\Stuff\Babylon5_snip.d2v",idct=7,cpu=0,ipp=true)
deblocker(quant=4,ipp=true)

vb=last.mvanalyse(truemotion=true,pel=2,blksize=16,isb=true)
vf=last.mvanalyse(truemotion=true,pel=2,blksize=16,isb=false)
vf2=last.mvanalyse(truemotion=true,pel=2,blksize=16,isb=false,delta=2)

interleave(last.mvflow(vf2),last.mvflow(vf),last,last.mvflow(vb))
removedirt()
fft3dfilter(sigma=5,bt=4)
selectevery(4,2)

videoFred
5th December 2005, 15:34
but anime is a different story :) i'm talking about 16mm transfers from the original 1960's Astroboy series. that means it's been copied from the japanese master (so it can have english audio printed on it) onto (usually) cheap B&W stock.


I see...
And then transfered to video, I assume?
You are not going to tell me you have these 16mm films, do you?
Anyhow, I would like to see some stills!
Have your tried already degrainmedian()+fft3d()?

And some despot(), deflicker()..
You know, all the Fizick stuff, hehe :p

Fred.

Mug Funky
8th December 2005, 06:24
@ videofred: yeah, xfer'd to NTSC digibeta (bugger them! they know we want PAL. they had the gain up way too high on some of them as well - lots of episodes are unusable. it's a good thing the japanese already did a restoration that we can stick over the top and keep the english sound...).