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. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,988
|
AviSynth DV cleanup script
If you haven't been following the thread I've got about cleanup in the capture area, go take a look. Regardless of what you're doing with DV, you'll probably be quite stunned how much noise is there. The script is NOT refined yet. I know that. There are some sample grabs on my page at http://www.geocities.com/fredthompson6
If you shoot DV, you really should see what's happening. The results are getting VERY good.
__________________
Reclusive fart. Collecting Military, Trains, Cooking, Woodworking, Fighting Illini, Auburn Tigers |
|
|
|
|
|
#3 | Link |
|
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,988
|
Oh, guess I should included that, huh?
The page is outdated. The unwanted artifacts shown in 2 of the screen grabs do NOT exist with the current script. GeoCities has been acting up so I haven't been able to edit the page. If you use the current script and frame server from NTSC DV source the image quality can be higher than if you write a DV file from the script because of the lossy nature of DV. There IS one thing I'm still working on that's quite important for cleanup. The current script fuzzes up the last frame before a scene change. That should be fixed fairly soon. |
|
|
|
|
|
#4 | Link |
|
Registered User
Join Date: Apr 2002
Posts: 134
|
I can't wait to try this when I get home. I played around with it right before we left on vacation and my wife wasn't too pleased. I'm sure I'll have some questions about this when I get back as the end result on your web page looked fantastic and you are doing what I want to do. While the original capture isn't terrible, I'd like to be able to clean it up a bit.
Thanks and I'm sure I'll get back to you in a few weeks! |
|
|
|
|
|
#5 | Link |
|
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,988
|
Right now I'm working on fine-tuning and making the scripts more easily used by other people. Also, I'm working on some laserdisc capture issues. Can't get into too may details but anyone with laserdisc might be interested in the attacks on moire if we're successful.
Hope to have that page updated by the weekend then I'll start on a complete how-to set of instructions. I'll submit them to doom9 first because of the dl cap at GeoCities. |
|
|
|
|
|
#6 | Link |
|
Registered User
Join Date: Aug 2002
Posts: 467
|
Fred, one of your images compares 4:1:1 to something else. But the problem you show is specific to your DV codec, not 4:1:1. I'm guessing the "something else" you compare it to is probably 4:2:2, but the same type of problem would show up there if the codec didn't interpolate the chroma. For some reason the DV codecs don't all do this for 4:1:1.
Just basic linear interpolation helps a lot, done after the DV codec. I think you can do this with AVISynth's separation of luminance and chrominance, although I couldn't figure out how to last year, so I wrote a plugin to play with. But I wasn't satisfied with that. I had a video where a red ball was on a blue rug, and the red and blue colors bled into one-another using linear interpolation. Anyway, I got the idea to do a "luma follower" interpolation. The idea was that there might be enough information in the luminance for the interpolation of the chromanance to follow and do a better job. For example: Contrived original 4:4:4 (C is representative of U and V): Y 100 101 150 149 150 C 50 51 80 79 80 4:1:1 Y 100 101 150 149 150 C 50 80 Replicated (like in your example) 4:1:1 to 4:4:4 Y 100 101 150 149 150 C 50 50 50 50 80 Linear interpolated 4:1:1 back to 4:4:4 Y 100 101 150 149 150 C 50 58 65 73 80 Luma follow (linear) 4:1:1 back to 4:4:4 Y 100 101 150 149 150 C 50 50 80 80 80 Unfortunately, in reality the noise and sharpening of the camera and/or DV codec caused me to have to add a floor and ceiling, slowing down the already unoptimized code. And the results weren't as good as I thought they should be. I don't have this plugin with me, but if you want to see the results, I'll try to remember to grab it. But in any case, you should try interpolating the chroma, or using a DV codec that does so. Xesdeeni |
|
|
|
|
|
#7 | Link |
|
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,988
|
Yes, please, I'll be very interested to see what you've got. The comparison screenshot was with FlyVideo doing 4:2:0. At least, that's my understanding. I don't have that hardware.
The source is IanD who has recently been posting in the DV forum. I've got a 2-frame clip from him with the second frame having the saturated red streak. What you are seeing is the result of the MainConcept codec. It's also visible with the Canopus and Panasonic codecs, Cnaopus having the worst performance. If there's a way to filter, sure, I'd love help. FWIW, I'm also now working on some laserdisc-specific denoising. Apparently, they can have a problem with moving moire. |
|
|
|
|
|
#8 | Link |
|
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,988
|
ok, site should be properly updated now. I've added the 2-frame sample of IanD's FlyVideo3000 capture from the Star Wars laserdisc. Frame 2 is the one that's causing problems with DV. All I did to create the screengrab problem was load his file into VirtualDub then save as MainConcept DV. The problem seems common to DV encoders but the amount of unwanted color varies.
Cleanup script has also been slightly modified. |
|
|
|
|
|
#9 | Link |
|
Registered User
Join Date: Aug 2002
Posts: 467
|
I'm sorry, I forgot to grab my Luma Follow filter. But as penance, I've created an AVISynth script you can try:
Code:
AVISource("FlyVideoStarWars-MCDV.avi")
#chroma = BilinearResize(180,480).BilinearResize(720,480)
#chroma = BicubicResize(180,480).BicubicResize(720,480)
chroma = LanczosResize(180,480).LanczosResize(720,480)
MergeChroma(chroma)
Xesdeeni |
|
|
|
|
|
#10 | Link |
|
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,988
|
I'll give it a shot.
This is resizing the chroma to 1/4 res then enlarging it to fit the full frame hoping rounding will get rid of some of the junk, right? I forgot to mention that I've come to believe the only efficient way to work with filtered video is frame serving given the size of lossless storage or artifacts from lossy compression. Given those thoughts, it's not important to force the chroma into the 4:1:1 configuration. Right now I'm not so concerned about absolute "perfect" chroma consistency from source to destination, I'm more interested in image quality. Have come to recognize that, just like physical pigment, removing "dirt" lightens the image. It's similar to cleaning a stained glass window or the effect when the Sistene Chapel was properly cleaned. My filtering is using a mix of YUY2, YV12 and RGB colormodels out of necessity. Maybe AviSynth 3.0 will give an internal 4:4:4 mode and properly emulate other modes for interfacing with filters while properly handling oversampling. Uh...I mean the internal version stays 4:4:4 but will appear to any of the other 3 to suite the filter. Sort of like applying a 16-bit audio filter to a 96 kHz audio sample. That would be real cool.
__________________
Reclusive fart. Collecting Military, Trains, Cooking, Woodworking, Fighting Illini, Auburn Tigers |
|
|
|
|
|
#11 | Link | |
|
Registered User
Join Date: Aug 2002
Posts: 467
|
Quote:
Umm...actually. Now that I look at it, the 180x480 downscale should really be just decimation. Hmmm. Can you do that in AVISynth? Xesdeeni |
|
|
|
|
|
|
#12 | Link |
|
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,988
|
Dunno. I'll look into it tonight.
But....howsabout pointing me to your plugin. Can always load the VirtualDub and run it that way. Like I said, I'm not a stickler for absolute color match 'cause we're removing dirt so what's the "true" color?
__________________
Reclusive fart. Collecting Military, Trains, Cooking, Woodworking, Fighting Illini, Auburn Tigers |
|
|
|
|
|
#14 | Link |
|
Registered User
Join Date: Aug 2002
Posts: 467
|
If you can get it, it's at http://www.geocities.com/xesdeeni2001/411Helper.zip. If not, I'll try to update the main page to point at it tomorrow.
Xesdeeni |
|
|
|
|
|
#18 | Link |
|
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,988
|
Hey, that's pretty cool.
Interpolation is the better of the 2 options for saturated red on black. The junk isn't removed, it's turned into more of a somewhat dampened blob. That's a huge improvement from the grid-like original. I've not finished testing it inside my AviSynth scripting and am wondering how it will perform at the beginning of the filter chain. Maybe if it's first, followed by CNR2 and other noise filters, the red smear will be reduced even more. Can't test that wiht VirtualDub because VirtualDub filters come after the AviSynth processing. Is this filter something you're open to actively working on? I'm wondering how performance could change with an agressive weighting for very low luminence regions. The idea being this distortion is far more evident when the background should be black. So...how about a way to dramatically decrease the chroma if the luma is very low a la DarkSmoother?
__________________
Reclusive fart. Collecting Military, Trains, Cooking, Woodworking, Fighting Illini, Auburn Tigers |
|
|
|
|
|
#19 | Link | |||||
|
Registered User
Join Date: Aug 2002
Posts: 467
|
Quote:
Quote:
Quote:
Quote:
Quote:
There was another thing that always annoyed me about sub-sampled YUV space I have never actually experimented with. Say you have two pixels (assuming 4:2:2), one that is bright and one color, and right next is a dark and another color. Code:
Y 192 10 C red blue Code:
Y 192 10 C yellow Code:
Y 192 10 C red Code:
Y 192 10 C red red Code:
Y 192 193 9 10 9 ... C red red blue blue blue ... Y 192 193 9 10 9 ... C red blue ... Code:
Y 192 193 9 10 9 ... C red red blue blue blue ... Code:
Y 192 193 9 10 9 ... C yellow blue ... Y 192 193 9 10 9 ... C yel yel blue blue blue ... |
|||||
|
|
|
|
|
#20 | Link |
|
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,988
|
Yes, you are correct on many points
![]() Maybe I didn't fully elaborate on the weighting idea. If you look at the comparision of FlyVideo and NTSC DV capture on this page: http://www.geocities.com/fredthompson6 you'll see the 4:1:1 distortion in all its glory. That's where the color bleed looks worst, saturated colors on a black background. There's another example near the bottom of the page. Well, I'm wondering about an area-based method to look at the surrounding luma and mess with the chroma as needed. If you've got: red black black black black black black... It should be easy enough to determine where to chop off the chroma. Uh....black means near-black... So it's really a horizontal-only analysis and the trigger is a string of near-black pixels. Then again, maybe it won't work. I notice this much more when there's a lot of black so I'm assuming other people would also. Short gaps are a little different and that's where your example comes in. Think of how DarkSmoother and ShadowSmoother work on only the very low luminence pixels. That's what I'm wondering about.
__________________
Reclusive fart. Collecting Military, Trains, Cooking, Woodworking, Fighting Illini, Auburn Tigers |
|
|
|
![]() |
|
|