Log in

View Full Version : Help me restore the worst Blu-ray source ever.


Dark Shikari
25th February 2008, 11:22
The Cowboy Bebop movie has to be the worst BD source I have ever seen.

It not only has ridiculous film grain for an animated source--it has all sorts of artifacts on the film itself including very weird shadowing/haloing, and it shakes a little bit between frames :eek:

I cannot believe they can justify this crap as "1080p".

On that note, I intend to actually try to fix this. Grab 50 frames of FFV1-encoded Bebop (http://mirror05.x264.nl/Dark/force.php?file=./bebop.avi) and see what you think of it.

Depan doesn't seem to be able to handle the shaking at least with what I've tried--though the noise is easy to deal with; even Deen takes care of it fine, let alone dfttest. But I have no idea how to deal with the dirt and artifacting on the film or the weird halos.

Any ideas?

G_M_C
25th February 2008, 11:56
Is the movement mainly horizontal or mainly vertical ? If it is "deinterlacing gone wrong", than i would expect mainly vertical movement (jumping up/down). If so, you could try to twek DePan to correct onky vertical movement (dymax parameter).

(/me is @ work, so i cant watch the sample).

Anyway, IF it is deinterlacing gone wrong, it would allmost mean that the original was 1080i wich was deinterlaced to 1080p. If that is the case, than resizing to 720p dimensions might help improve things visionally.

Dark Shikari
25th February 2008, 21:38
I've been able to take care of the jittering and the noise--but now the problem I've hit is the dirt in the film. It should be easy to remove, since every frame is repeated multiple times (as its anime), but RemoveDirt doesn't seem to do it--what other options are there?

My script so far:

denoised=dfttest(tbsize=5,sigma=1)
mdata = DePanEstimate(denoised)
DePanStabilize(denoised,data=mdata,dxmax=6,dymax=6)
Crop(80,72,-80,-72)

foxyshadis
26th February 2008, 00:26
DeSpot?

Dark Shikari
26th February 2008, 00:29
DeSpot?I tried quite hard but I couldn't get it to do anything whatsoever to the noise. Anyone else more experienced with it want to give it a shot?

A high-threshold ttempsmooth combined with deflicker seemed to deal with most other issues in the source (after dfttest for the noise).

scharfis_brain
26th February 2008, 00:33
You may use dup:
http://neuron2.net/dup/dupnew.html

it is able to detect duplicates and blend them all together thus reducing noise a lot.

I would use dup() as first filter, followed by depanstabilize() and then maybe a further (spatial) denoising filter and finally dehaloing

Dark Shikari
26th February 2008, 00:37
You may use dup:
http://neuron2.net/dup/dupnew.html

it is able to detect duplicates and blend them all together thus reducing noise a lot.

I would use dup() as first filter, followed by depanstabilize() and then maybe a further (spatial) denoising filter and finally dehaloingI'm already using dup in blend mode; it helps decently.

Dehaloing does absolutely nothing because this kind of haloing is a gray region beyond a black line, rather than the standard "oversharpened" halo. I'm not sure I can do much about this haloing.

Why depanstabilize after Dup, rather than before?

scharfis_brain
26th February 2008, 00:53
Why depanstabilize after Dup, rather than before?
Cause there are no dups anymore if you smooth out the instability over the grouped stable frames.

Dark Shikari
26th February 2008, 00:58
Cause there are no dups anymore if you smooth out the instability over the grouped stable frames.From what I understand, if I don't depan the frames first, there definitely won't be any dupes.

Dup is working fine as it is with a threshold of 5, at least it seems so.

My current script:
SetMemoryMax(384)
DirectShowSource("bebop.grf",audio=false).ConvertToYV12()
denoised=fft3dgpu(bt=4,sigma=1.5,sharpen=0.5)
mdata = DePanEstimate(denoised)
DePanStabilize(denoised,data=mdata,dxmax=6,dymax=6)
DeFlicker(scene=30)
Dup(blksize=32,threshold=5,show=false,blend=true)
ttempsmoothF(maxr=7,strength=5,lthresh=10,cthresh=14)
Crop(80,72,-80,-72)
Spline36Resize(1352,720)

*.mp4 guy
26th February 2008, 02:35
The "haloing" doesn't effect all of the image, so there isn't any way to remove it without destroying uneffected areas. For what its worth, I've got the region 1 dvd, and it also has the shadowing artifacts, so chances are that it is present in whatever masters they have, it might be a compositing artifact, if traditional animation techniques were used instead of cg.

mikeytown2
26th February 2008, 06:21
I was thinking about the dup plugin. The blending of noise could make a very powerful filter chain. Split the source into large blocks then, where there is no motion, the blending continues. I'm not sure if thats what blksize is for.

DePan/deshaker with dup might be a good combo as well for global motion [http://bag.hotmail.ru/depan/depan.dhtml][http://www.guthspot.se/video/deshaker.htm]. Reversing DePan/deshaker to get the global motion back would be very hard to do though.

R3Z
26th February 2008, 06:33
I had a bit of luck with the following;

FFMPEGSource("C:\Documents and Settings\kingj\Desktop\bebop.avi")

source=last

d_int = last
pre_f = last

bw2_vec = pre_f.MVAnalyse(isb=true, delta=2,pel=2,blksize=8,overlap=8/2,idx=1)
bw1_vec = pre_f.MVAnalyse(isb=true, delta=1 ,pel=2,blksize=8,overlap=8/2,idx=1)
fw1_vec = pre_f.MVAnalyse(isb=false, delta=1,pel=2,blksize=8,overlap=8/2,idx=1)
fw2_vec = pre_f.MVAnalyse(isb=false, delta=2,pel=2,blksize=8,overlap=8/2,idx=1)

bw2_comp = d_int.MVCompensate(bw2_vec,idx=2)
bw1_comp = d_int.MVCompensate(bw1_vec,idx=2)
fw1_comp = d_int.MVCompensate(fw1_vec,idx=2)
fw2_comp = d_int.MVCompensate(fw2_vec,idx=2)


Interleave(bw2_comp,bw1_comp,d_int,fw1_comp,fw2_comp)
RemoveDirt(5,2)
ttempsmooth(2,6,6,2,2,strength=5,pfclip=last.BinomialBlur(vary=1.5,varc=1.5))
SelectEvery(5,2)

My usual scripts wouldnt get rid of the scratches, so i experimented. Just another idea, albeit probably equivelent of barfing into your own sleeping bag :)

Dark Shikari
26th February 2008, 06:40
I'll try your script in a bit; here's what I have now:

SetMemoryMax(384)
DirectShowSource("bebop.grf",audio=false).ConvertToYV12()
Crop(60,52,-60,-52)
denoised=fft3dgpu(bt=4,sigma=1.5,sharpen=0.5)
mdata = DePanEstimate(denoised,dxmax=8,dymax=8)
DePanStabilize(denoised,data=mdata,dxmax=8,dymax=8)
DeFlicker(scene=30)
Dup(blksize=32,threshold=5,show=false,blend=true)
ttempsmoothF(maxr=1,strength=3,lthresh=6,cthresh=8)
Crop(20,20,-20,-20)
Spline36Resize(1280,680)

My previous script caused way too much ghosting; this eliminates it, and keeps just enough grain on the edges to stop banding.

Dark Shikari
26th February 2008, 08:44
Got it working (http://mirror05.x264.nl/Dark/force.php?file=./bebop.mkv).

2.5 megabit video, 640kbps AC3 audio. Seems surprisingly good.

Mug Funky
26th February 2008, 12:06
@ dark shikari:

if that's the worst HD source you've seen...

considering cowboy bebop never had a digital intermediate, this is about as good a transfer as you're likely to get without the distributors going all out on stabilizing/noise reducing it (and even then it'd still have the white dust on the actual cels, and those shadows between the cels and the background). bear in mind that such a project would likely run into the hundreds of thousands of dollars to produce what is basically a niche title (that's already been adequately covered on DVD for years, and that everyone who's going to see it has already seen) on a niche format (blu-ray hasn't taken off and will likely never see the audience that DVD enjoys).

IMHO that's what makes filmed animation special. digital anime looks cheap, and usually is. animation just isn't done that way anymore and it's kinda sad.

scharfis_brain
26th February 2008, 12:12
@R3Z:

Interleave(bw2_comp,bw1_comp,d_int,fw1_comp,fw2_comp)
RemoveDirt(5,2)
ttempsmooth(2,6,6,2,2,strength=5,pfclip=last.BinomialBlur(vary=1.5,varc=1.5))
SelectEvery(5,2)

this will produce non-aptimal denoising, cause the actual temporal readius you have from mvtools is 2.
removedirt take 1 of this.
and the following temporalsoften uses 2 and extends it by 1.
so temoralsoften actually takes frames in account the are from the neightboring compensation step.

so either increse the motzion compensation to radius 3 or lower the radius of temporalsoften to 1.

Didée
26th February 2008, 12:45
@ scharfis_brain:

Technically, you're fully correct. However: since RemoveDirt basically is a temporal median filter, it should be acceptable. Imagine 99-22-20 ... if the very different "99" is due to the break between the interleaved snipplets, temp.median-filtering the "22" still won't result in noticeable harm.

BTW, in this case one could increase the radius without actually doing an additional motion search: just place a compensation from the other side, instead of doing one more search & compensation :sly:

Interleave(fw1_comp, bw2_comp,bw1_comp,d_int,fw1_comp,fw2_comp, bw1_comp)
RemoveDirt(5,2)
ttempsmooth(2,6,6,2,2,strength=5,pfclip=last.BinomialBlur(vary=1.5,varc=1.5))
SelectEvery(7,3)

Sloppy it is, but working it does. ;)

scharfis_brain
26th February 2008, 12:51
but actually I find this idea quite interesting :)

Dark Shikari
26th February 2008, 17:20
@ dark shikari:

if that's the worst HD source you've seen...

considering cowboy bebop never had a digital intermediate, this is about as good a transfer as you're likely to get without the distributors going all out on stabilizing/noise reducing it (and even then it'd still have the white dust on the actual cels, and those shadows between the cels and the background). bear in mind that such a project would likely run into the hundreds of thousands of dollars to produce what is basically a niche title (that's already been adequately covered on DVD for years, and that everyone who's going to see it has already seen) on a niche format (blu-ray hasn't taken off and will likely never see the audience that DVD enjoys).

IMHO that's what makes filmed animation special. digital anime looks cheap, and usually is. animation just isn't done that way anymore and it's kinda sad.They did the full remastering to the DVDs of the TV series ;)

Ranguvar
26th February 2008, 23:52
Got it working? Then, please, post the script :p

Unless you just used R37's?

Dark Shikari
27th February 2008, 01:13
Got it working? Then, please, post the script :p

Unless you just used R37's?I used a slight modification of my previous script (the video I posted was not with the modifications--I found some mistakes in it due to improper thresholds that I fixed).

I'll post it when I get back to my main computer.

Dark Shikari
27th February 2008, 02:52
SetMemoryMax(384)
DirectShowSource("bebop.grf",audio=false).ConvertToYV12()
Crop(60,52,-60,-52)
denoised=fft3dgpu(bt=4,sigma=1.5,sharpen=0.5)
mdata = DePanEstimate(denoised,dxmax=8,dymax=8)
DePanStabilize(denoised,data=mdata,dxmax=8,dymax=8)
DeFlicker(scene=10)
Dup(blksize=16,threshold=5,show=false,blend=true)
ttempsmoothF(maxr=1,strength=3,lthresh=6,cthresh=8)
Crop(20,20,-20,-20)
BlackmanResize(1280,688)

Mug Funky
27th February 2008, 09:03
They did the full remastering to the DVDs of the TV series

hehe... and they did the dubs via composite. remember noticable gate float in HD will be in the subpixel range in SD. and a remaster in SD is cheaper and easier than in HD. there's lots of NR options in SD, but very very few in HD (i can think of 2 off the top of my head - the GRACE and algolith's effort). but i'll stop hijacking this thread now. denoising HD is definitely relevant to my interests, and i dig the fact that avisynth can do it for free, and better in most ways than any hardware out there :) if it did 10 bit RGB it'd be perfect.

R3Z
29th February 2008, 07:48
@R3Z:

Interleave(bw2_comp,bw1_comp,d_int,fw1_comp,fw2_comp)
RemoveDirt(5,2)
ttempsmooth(2,6,6,2,2,strength=5,pfclip=last.BinomialBlur(vary=1.5,varc=1.5))
SelectEvery(5,2)

this will produce non-aptimal denoising, cause the actual temporal readius you have from mvtools is 2.
removedirt take 1 of this.
and the following temporalsoften uses 2 and extends it by 1.
so temoralsoften actually takes frames in account the are from the neightboring compensation step.

so either increse the motzion compensation to radius 3 or lower the radius of temporalsoften to 1.

@ scharfis_brain:

Technically, you're fully correct. However: since RemoveDirt basically is a temporal median filter, it should be acceptable. Imagine 99-22-20 ... if the very different "99" is due to the break between the interleaved snipplets, temp.median-filtering the "22" still won't result in noticeable harm.

BTW, in this case one could increase the radius without actually doing an additional motion search: just place a compensation from the other side, instead of doing one more search & compensation :sly:

Interleave(fw1_comp, bw2_comp,bw1_comp,d_int,fw1_comp,fw2_comp, bw1_comp)
RemoveDirt(5,2)
ttempsmooth(2,6,6,2,2,strength=5,pfclip=last.BinomialBlur(vary=1.5,varc=1.5))
SelectEvery(7,3)

Sloppy it is, but working it does. ;)

I am not suprised its sloppy :) I have average knowledge about what i am doing, but when i see results that are positive it only makes me want to learn more.

Thanks for the clarification guys, proper theory has got to lead to better practices :)