ホスティング レンタルサーバ レンタルサーバー

u n d e r c u t ' s   p u b l i c   d o m a i n
Page Last Updated 06/11/2003

Back to undercut's homepage
fun with Temporal Cleaner
日本語 · articles · fansubs · Nandub_OnePass · WebFServe · MS-MPEG4 · download · email

Temporal Cleaner is a 3rd party filter for VirtualDub that has become quite useful in light of DVD ripping. Previously, noise reduction type filters such as Dynamic Noise Reduction and 2D Cleaner were used primarily for cleaning up captured video, which very often contains lots of noise. Noise reduction type filters were used to make the visual more appealing.

Now we get to DVD ripping, focus has shifted into compression efficiency. Of all the noise reduction filters, temporal cleaner stood out as the most effective in increasing efficiency of MPEG4 compression while keeping the picture quality and integrity.

Along with Temporal Cleaner, the author of VobSub has a filter called PicFix which from experiment, seems to do exactly the same thing but with less options.

Temporal cleaner does not reduce noise based on a static picture, but it works on inter-frame noise. If difference of color in a pixel in a frame, and the pixel from its previous frame, is less than the threshold specified, it locks or blends the pixel. This improves efficiency of MPEG4 compression by making less motion from noise, while keeping the picture integrity by not bluring or messing with the picture within a frame.

You have to be pretty naive to think that this process would only affect noise. Any pixel that contains smaller difference from the previous frame than specified threshold will be affected. Let's look at the example.

Here's a simple black line with antialiasing. Very common in anime.

Now lets assume that this is a video, and the next frame contain just white background without the line. With temporal cleaning, result could be something like this:

Do you get the picture? Because the edge of the line where antialias is applied is close enough to the white color that falls within the specified threshold in difference of color, that it locked the pixel. What you'll see in a video like this is that you see what is generally called ghosting effect. You see remnants from the previous frame.

How can you solve this problem? The answer is you can't. As long as you use this algorithm of analyzing pixel values, there's no solution. You get ghosting no matter what. There's no perfect method in distinguishing noise from non-noise.

However, there's a catch. If you use threshold that is small enough, you can reduce the ghosting effect enough that they are not noticable. This, at the same time, will reduce the effectiveness of the noise reduction. This becomes quite useful when you need to squeeze out the bitrate.

After some experiment, I could see some pattern. I chose to use RGB mode instead of YUV after some experimentation. I was getting better result with RGB. (uncheck Process in YUV color space)

The table below shows how much ghosting you get for certain threshold:

Blending
Threshold
Locking
Threshold
Result
4 4 No noticable ghosting.
6 6 No noticable ghosting.
8 8 Ghosting not noticable in most scene.
10 10 Ghosting noticable sometimes.
12 12 Ghosting noticable.

Notice how I used same value for locking and blending. This means I only used the pixel locking. Using the blending instead of locking will produce same amount of ghosting, but will be less noticable. So this test showed where is the sweet spot as far as eliminating ghosting.

After some more experimentation, I've gotten some interesting result regarding blending/locking. The following tests were done on a small clip with MPEG4V2 bitrate set at 6000kbps. (so that we are testing how efficiently it compresses. smaller=better or more MPEG4 compressable)

Blending
Threshold
Locking
Threshold
Filesize
- -
4954kB (without temporal cleaner)

8 4
3508kB
8 5
3398kB
8 6
3392kB
8 7
3466kB
8 8
3618kB

10 4
3400kB
10 6
3236kB
10 7
3224kB
10 8
3258kB
10 10
3586kB

The best results were 8/5 and 10/6. 8/5 showed no noticable ghosting throughout. 10/6 had a few minor noticable ghosting. Overall, 8/5 gives best overall value and visual. Though not shown on this test, 7/5, 6/4 and 5/3 give good results as well. If ghosting is noticable at 8/5, 6/4 is a good bet.

Also interesting note is that this shows the side effect of pixel locking without blending, that it causes MPEG4 compression to be not as efficient. In fact with 10/10, it is less efficient than 8/5 even though 10/10 is doing more pixel cleaning with bigger threshold.

In terms of MPEG4, you can think about saving in space to translate to more bitrate available for fast motion scenes. In fact, even if you do not get any saving in space (sometimes even increase!) the bitrate saved under low motion scenes are spent on fast motion to increase the quality.

So if you want to save space, apply temporal cleaner and reduce bitrate at the same time. Or in another sense, if you notice too much artifact in fast motion, you can instead of increasing bitrate, apply temporal cleaner. Even in another sense, use temporal cleaner and increase the resolution of the video while keeping the same bitrate.

Another note is that this (or any other noise reduction methods) are only effective in low motion scenes. Because fast motion means pixels are changing at great pace, noise becomes less of an issue in such scene. (but as noted, saved bitrate in low motion can be applied to such scene to increase quality)

Make sure you experiment first to get the right reduction in noise while keeping the ghosting to acceptable level. In some newer material (such as Black Heaven) there's so little noise that this becomes completely ineffective.

Some material (Key the Metal Idol, 3x3 Eyes, Ranma 1/2: Big Trouble.., etc) already contain ghosting that is not part of telecine.(that is, you get picture that looks like result of deinterlacing even after sucessful IVTC has been applied) In such material, do not use temporal cleaner at all or at maximum, use 4/2. Otherwise you'll get noticable ghosting much more so than proper videos. Also this filter usually does not work well with regular live movies.


Copyright © 2000-2003 Undercut.org. All rights reserved.
Managed by Site Compiler