Quantcast Avisynth: Filter Introduction for Newbies - digitalFAQ.com Forums [Archives]
02-01-2004, 05:12 AM
wgamer wgamer is offline
Free Member
Join Date: Jan 2004
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
This is just a collection of bits and pieces about the avisynth filters and some tips for using them that I collected mostly from this site and others. Hope this helps newbies like myself. The first one is Dialhot's reply to my doubts and what prompted me to start this.
I hope kwag and others will appprove and let others also post their tips so that we newbies could benefit.
LanczosResize(336, 192, 6, 0, 340, 182)
UnFilter(70, 70)
BlockBuster(method="sharpen", strength=17)

Whoaow ! THREE sharpening lines ? Your CQ must suffer a lot from this !
BlockBuster(method="noise", detail_max=20, seed=1)

Your script does nothing but adding noise and raising sharpness -> the CQ will be half it would have been without the script.
The purpose of a script is to raise the CQ, not the opposite

Effectively, as I told some times, I NEVER use any sharpening filters in my scripts (asharp or unfilter with negative values)
(I even never used the optimal MA script as it is given on the site except when I tested it when it was released).
Kwag explained why there is this "sharpening then bluring" operation in the script but I never stuck with the explanation and, like you, I prefer to remove it (and use Lanczosresize to obtain an sharper image than with bicubic).

you can use "Addborders(left,top,0,0)" to adjust the size (the idea is to reach the next value that is divisible by 16. See example just after). Don't worry, this border will be removed by the gripcrop command.
Example : source is 636 * 477, you need to change it to 640 * 480 (640/16 = 40; 480/16 = 30). So just add this after the line Avisource :

If you are magnifying your video, you will get much better-looking results with BicubicResize than with BilinearResize. However, if you are shrinking it, you are probably just as well off, or even better off, with BilinearResize. Although VirtualDub's bicubic filter does produce better-looking images than its bilinear filter, this is mainly because the bicubic filter sharpens the image, not because it samples it better. Sharp images are nice to look at--until you try to compress them, at which point they turn nasty on you very quickly. The BicubicResize default doesn't sharpen nearly as much as VirtualDub's bicubic, but it still sharpens more than the bilinear. If you plan to encode your video at a low bitrate, I wouldn't be at all surprised if BilinearResize yields better quality.


The BilinearResize filter rescales the input video frames to an arbitrary new resolution. If you supply the optional source arguments, the result is the same as if you had applied Crop with those arguments to the clip before BilinearResize (except faster).
================================================== ===

LanczosResize is an alternative to BicubicResize with high values of c about 0.6 ... 0.75 which produces quite strong sharpening. It usually offers better quality (fewer artifacts) and a sharp image.
Lanczos was created for Avisynth because it retained so much detail, more so even than BicubicResize(x,y,0,0.75). As you might know, the more detail a frame has, the more diffiult it is to compress it. This means that Lanczos is NOT suited for low bitrate video, the various Bicubic flavours are much better for this. If however you have enough bitrate then using Lanczos will give you a better picture, but in general I do not recommend using it for 1 CD rips because the bitrate is usually too low (there are exceptions of course).


Can you add bars on the top and bottom on a full screen movie without screwing uyp the aspect ratio if so can someone show me how it would look in a script

Fullsceen is fullscreen man ! When the bottle is full you can't fill it more.
Bicubic is better than bilinear. Bicubic precise is a little sharper then bicubic "normal".
I have a PAL 4:3 movie that will be resized to 352x288. However this will stretch the vertical too much. I want to add borders that will display the viewable at 352x240. My question is where do I put the addborders command.I assume that the Gripcrop command will resize the movie to 352x240 and the addborder will add the necessary black borders so the finished size will be 352x288.

If I understand you well, you want to resize the viewable part of the film to 352x240, and output the film in 352x288 format, isn't it?.
Well, if you make use of GripFit, as far as I know you just need to use:
GripCrop(352, 240, source_anamorphic=false)

I think no AddBorders is needed, 'cos GripBorders will do this work. In case you want, you can employ LetterBox, but don't think you need in your case.

You cant use Addborders() together with GripFit as GripFit does the WHOLE job internal, the borders will be added with GripBorders() correctly.

I know what I was doing wrong now. I was putting 352x288 in the script and in TMPGenc. What I need to do is put Gripcrop 352x240 in the script but keep 352x288 in TMPGenc. This gives me what I need.

This is wrong. Your aspect ratio will be off, and it is not good idea to resize with TMPG.

You are right for general cases.. But if you read what is the problem of jim here you can see that he has a matter of wrong aspect ratio and try to restore it. And I think that his solution is to process like he does. His source is clearly a NTSC video taht was badly resized to PAL resolution, screwing up the A/R.
And to unscrew something there is no other way than doing an other screwed operation

DO NOT use MA script with avi !
Remove the Asharp line and use "Lanczosresize" to obtain a sharper image. That's all you have to do.
================================================== =====
UnDot is a simple median filter for removing dots, that is stray orphan pixels and
mosquito noise. It basicly just clips each pixel value to stay within min and max
of its eight surrounding neigbors.

Blockbuster is an Avisynth filter designed to reduce or eliminate DCT blocks from an enocode. DCT blocks, also known as "dark blocks" when they appear in low-luma areas of a frame, are ugly, distracting artifacts that MPEG encoders like to scatter liberally over our otherwise flawless encodes.
While the severity of the problem varies between the different versions of MPEG, with MPEG-1 exhibiting the most DCT blocks and MPEG-4 the least, they do occur with all versions. MPEG-1 produces them almost anywhere there is a flat surface with a low detail level (such as a wall), and MPEG-2 shows them in the same areas but less frequently (they're particularly visible at lower bitrates, as anyone familiar with digital satellite can testify). MPEG-4 has signficantly less of a problem with low detail levels, but does still produce DCT blocks, especially in dark areas (see this Doom9 thread for more on these blocks and MPEG-4).
(Incidentally, DCT stands for "discrete cosine transform", and is one of the techniques MPEG uses to do its compression. They differ from macroblocks, which are most noticible in high-motion areas when the bitrate is insufficient to describe the motion accurately, and also from mosquito noise, which is an artifact that tends to appear around edges and areas of high contast.)
As hinted at above, the cause of these blocks seems to be a lack of detail in areas of the picture, which the encoder fails to "see" and so applies too much compression. In the process what details were there are smoothed away and the area turns into a DCT block.
The aim of this filter is to attempt to make those areas more "noticible" to the encoder so that it allocates more bits and thus doesn't need to compress so much. The astute amongst you will realise this filter is, basically, designed to increase the bitrate (and decrease the compressibility) of your clip. While this is considered a cardinal sin by most, there are at least two valid reasons for doing so.
First, while the highest possible compression ratio is of course desirable, one has to consider the cost. No-one would accept a movie with a resolution of 120x90, even though everyone knows it would have an excellent compression ratio. A similar effect could be achieved by smoothing the clip until it looks like you smeared your monitor screen with vasoline, but again no-one would accept this kind of image.
It could be argued that DCT blocks are similarly unacceptable in a good-quality encode. Peoples' opinion on this differs greatly, but an increasing number, myself included, are looking for a sure-fire way to get rid of them. This filter is my contribution to the effort.
Second, as compression technology evolves and improves it is sometimes necessary to re-encode old movies into new, more advanced formats. Removing artifacts from existing movies is much more difficult than stopping them appearing in the first place. Thus removing DCT blocks from your encodes now will make it easier to re-compress your movies later.
STMedianFilter is a (slightly motion compensated) spatial/temporal median filter.

It fairly very fine grained, using only adjacent pixels in space and time, so it
looks at the adjacent 26 locations to filter each location. It now filters both
luma and chroma but chroma filtering is somewhat more limited, as described later.
DctFilter is an experimental filter that, for each 8x8 block, will do a
Discrete Cosine Transform (DCT), scale down the selected frequency values,
and then reverse the process with an Inverse Discrete Cosine Transform (IDCT).

well that explains a lot (lol)

UnFilter is a simple and reasonably fast Avisynth Soften/Sharpen filter.

It implements 5-tap user adjustable horizontal and vertical filters designed to
(slightly) reverse previous efforts at softening or edge enhancment that are
common (but ugly) in DVD mastering. Since DVD's were intended originally
for interlaced displays this has caused content providers to vertically filter
them even a bit more to hide interlacing artifacts. I don't know why they
sometimes over do the edge enhancement.
basically, this filter is a very common unsharp mask, simply because unsharp mask is the most pleasant sharpenning technique
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts

Similar Threads
Thread Thread Starter Forum Replies Last Post
KVCD guide for newbies? edmund Video Encoding and Conversion 4 01-17-2005 12:34 PM
Newbies - a way to stop them from clutering our forums rds_correia Off-topic Lounge 7 08-08-2004 03:02 PM
Bitrates: Need an introduction to CQMatic... Vanquish Video Encoding and Conversion 0 10-09-2003 08:36 PM
Bitrates: Need an introduction to CalcuMatic... muhali3 Video Encoding and Conversion 1 10-01-2003 03:29 PM
Encoding Guide: KVCD For Newbies DivXerouS Video Encoding and Conversion 38 03-15-2003 03:28 PM

Thread Tools

All times are GMT -5. The time now is 03:21 AM  —  vBulletin Jelsoft Enterprises Ltd