Forums [Archives] Forums [Archives] (
-   Avisynth Scripting (
-   -   Avisynth: Script Challenge - Gentlemen, start your editors... (

MrTibs 06-05-2003 06:15 PM

Script Challenge - Gentlemen, start your editors...
This is a friendly contest for the best script to clean and encode a very noisy analog capture. To make everything fair, I've provided a sample avi to work against.

The rules are simple:

- use any version of Avisynth you choose.
- use any filter existing or new you want
- quality, not speed, is the focus
- use any TMPGEnc templates or filters you want
- post you best attempt to this thread
- no nasty bashing of other's scripts (friendly bashing is OK)
- the final results will be based on an 120 min MPeg1 encode (settings
estimated based on length of sample)
- the contest ends July 7

Here is here is the correct clip: (5.15Mb, Mpeg2, 352x240)

After July 7th, we'll vote on the results.

rendalunit 06-05-2003 10:27 PM

hey cool idea!


Originally Posted by MrTibs
- the final results will be based on an 120 min MPeg1 encode (settings
estimated based on length of sample)

The source for the two hour mpeg-1 encode is the same capture right? If so then you have something like a 30 gig capture on your hard drive for one month :D Cool 8) By settings you mean TMPG cq value settings right?

sorry for all the questions :oops:

MrTibs 06-05-2003 10:49 PM


By settings I mean the TMPG CQ and various settings. I think we need to include the while encoding process because what we see go into TMPG isn't always what we see coming out. (Sometimes things look better AFTER they are encoded and TMPG also has filters that could be used to further improve the results.)

So, the final file of the test MPEG video should have the correct bits/sec. ratio that we would see in a 120 min. encode.

GFR 06-06-2003 06:22 AM

Your sample didn't look all that bad, to me.

Anyway, here's the code I used for my last capture.


LoadPlugin("C:\Arquivos de programas\DVD2SVCD\MPEG2Dec\Cnr2.dll")
LoadPlugin("C:\Arquivos de programas\DVD2SVCD\MPEG2Dec\GuavaComb.dll")
LoadPlugin("C:\Arquivos de programas\DVD2SVCD\MPEG2Dec\MJPEGCorrect.dll")
LoadPlugin("C:\Arquivos de programas\DVD2SVCD\MPEG2Dec\Ghostbuster.dll")
LoadPlugin("C:\Arquivos de programas\DVD2SVCD\MPEG2Dec\Dup.dll")
LoadPlugin("C:\ARQUIVOS DE PROGRAMAS\MOVIESTACKER\Filters\DecombLegacy.dll")
LoadPlugin("C:\ARQUIVOS DE PROGRAMAS\MOVIESTACKER\Filters\Convolution3D.dll")
LoadPlugin("C:\ARQUIVOS DE PROGRAMAS\MOVIESTACKER\Filters\STMedianFilter.dll")

AviSource("C:\Meus documentos\capture_1.00.avi")
UnFilter(50, 50)
STMedianFilter(8, 32, 0, 0, 8, 32)
TemporalSmoother(1, 2)
GuavaComb(Mode = "NTSC", Recall = 83, MaxVariation = 23, Activation = 40)

Some notes:
1) the capture (Final Fligth of Osiris) was in 352x480, Main Concept MJPEG @ 75% (so the MJPEG correct line)
2) encoded to SKVCD (352x480 mpeg-2)
3) The level line is because this particular TV station is somewhat dark.
4) Besides the "usual" smoothing filters, some specific filters good for captures are Cnr2 (Marc FD) and GuavaComb.
5) SansGrip's port of Ghostbuster (not Blockbuster) is to remove ghosts. You can find the appropriate numbers using Virtualdub's exorcist filter or using the automatic setting feature of the built-in ghost eliminator in TMPGEnc (not too reliable).
6) IVTC because the movie was telecined.

vhelp 06-06-2003 08:36 PM

@ MrTibs..

I think you made a mistake by U/L'ing the wrong .AVI clip :!:

You U/L'ed an already filtered clip !!
* 23.976 fps (you performed an IVTC)
* you did a temporal or 3d or convolution on this clip

Based on the above, we really can't give you an honest filtering for YOUR
given clip, if you've already filtered it :wink:

Is this source from Cable, and then recorded to VHS, and now you
are capturing those VHS tapes ??

If you are having trouble w/ U/L'ing a reasonable sized .AVI, then just
do the following:
* get rid of the audio (every little bit helps (for bandwidth reasons))
* give us more meat, 2 to 5 seconds, and at least one scene change.
* and finally, use winRAR and compress it - don't worry about the compression. will look just fine, and wont taint your .AVI file any.

Don't worry about the size too much. Even if it's 20mb or more. Just let
us know in advance, and we can make the decision to give your clip a go
or not. The more we have to play with, the better are our (your) chances
w/ us helping you. K? :D

Have a good evening !!

MrTibs 06-07-2003 03:19 AM


:oops: Um... Ya you're right.

I will get the correct file to Kwag to post as soon as I can.


vhelp 06-07-2003 10:52 AM

hi MrTibs..

you're welcomed.

Listen, about the winRAR thing.. I does work pretty well, when you are
strapped for space and wanna get as much out for others to work with.
winZIP doesn't save much space at all.

When inside, if you select [x] Create solid archive, it will create the
smallest filesize as possible. I also use [x] Use multimedia compression as well.
Follow it with an Compression method [BEST] and you should have
as smallest filesize as possible for an .AVI/MPEG/MOV .RAR file.

And, if you really want to make things interesting, give us all a good size
file to D/L and we will all have some fun (when we finally get it D/L'ed)
I've D/L'ed 35mb and higher even. But, you make it what you want in
size. :!: If you're not sure about final size (after testing compressions) post
a poll here as to what size would peoples want, in working with.

:idea: Give that a shot, k?

Good luck dude :D

rendalunit 06-12-2003 01:20 PM


Originally Posted by MrTibs
Here is here is the correct clip: (5.15Mb, Mpeg2, 352x240)

links not working- maybe should be m2v?

kwag 06-12-2003 01:41 PM

Should be


MrTibs 06-12-2003 02:57 PM

:oops: :oops: Again?

kwag 06-12-2003 05:01 PM

And where do we send the results :?:

Also, that sample is 12 seconds. So I assume, that if we encode assuming a target of 800MB without audio to simplify matter, we're talking at MAX ~1.333MB for the sample :?:


MrTibs 06-12-2003 05:14 PM

I would suggest that you post your best script here in this thread. For those who are interested in judging, we would download the sample scripts and TMPG instructions then encode them ourselves. (This will save a lot of bandwidth.)

Once all the scripts are in, we'll judge the entries and pick the best one.

Perhaps we could post screen shots of the Mpeg1 encodes from top three scripts.

Edit: Yes your 1.33 file size seems correct. Lets keep it simple.

kwag 06-12-2003 05:33 PM

Ok, so here's my script, which is just a slight mod to the current script:


Set TMPEG resolution to 352x240. Bitrates MIN=300 MAX=1,150 CQ=75

 ## DLL Section ##


## Defined Variables and Constants ##
MaxTreshold = 1.50
scd_trigger = 25 # Scene change trigger value.
nf =  0 # Current frame.

## Main section and static filters ###
#asharp(2, 4)
BicubicResize(352, 240, 0, 0.6, 0, 0, 352, 240)
STMedianFilter(8, 32, 0, 0 )

## Dynamic Linear Adaptive Filtering and Scene Change Detection ##
# ( Portions from AviSynth's manual ) - This will apply temporalsoften to
# very static scenes, and apply variable blur on moving scenes.
# We also assign a variable - and this is why a line break is inserted:

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf > 2.5 ? asharp( -(fmin((nf/30), 1)), 0 ) : \
TemporalSoften(2,7,7,3,2) ")

# Scene change detection ( kwag ) - If a scene change is detected, we
# blur heavily. This affects the scene before and the one after the
# scene change, thus providing a softer transition for the encoder instead
# of a sharp "spike".
# If it's not a scene change, then we just blur dynamically, depending on
# the action.

ScriptClip("nf > scd_trigger ? asharp( -2,0) : asharp(0,0) ")



## Functions ###

function fmin(float f1, float f2) {
  return (f1<f2) ? f1 : f2


First, I did a .d2v project with DVD2AVI. The source reads as 29.97fps, but the original was shot FILM, as you can clearly see it has been telecined.
So I had to use Telecide and Decimate, so I could encode back at 23.976fps.
I also commented the line asharp(2, 4), because the source is too noisy.
Here's my result with this script:


vhelp 06-12-2003 07:20 PM

pal ..tibs,

Suggestion.. ..
For everyone that participates w/ an U/L clip, could you please add them
to your main page here, so that all the sample clips are always at the top
of this page. I mean, it's ok that participants post in their thread, but when
you spot them (at your leasure) you could inlcude them as then come in,
on top here. That would be most greatful of you :)
Then, if anyone adds a new clip, just revise this thread and INSERT in
between the {code} new contestant {/code} (see below)
..just trying to help you out. This could be used in other future events
like these. Course, the agenda could change to suite the occation, and
you could format (below) any way that suites your fancy :)
And, you could describe your test clip there too.

Oh, replace the "{" and "}" w/ "[" and "]" (else it would cause hauvic over


TEST SOURCE: "test.m2v"

Contestant...CLIP......... details ..... ..... ..... ..... ..... ..... .....
EDIT 2: how about htis one above??

Well, it was a thought.

I'm sort of busy at the moment w/ too many things going on, but I'll D/L
your test clip right away !!

K pal ?? .. k-pasa ??

vhelp 06-12-2003 09:44 PM

@ Kwag..

finally, finished watching all of Red Planet (only saw half, till now)
and it was a great Movie :)

I've also ben encoding various sections of this Movie, since. Lots of bad,
dark background. And, I'm jugling this and another (capture) encode
project too at the moment :( .. (project for someone) Anyways..

..that was a good clip, Kwag. ..your sample, that is

would be a great idea for widescreen capture too test, too. Anyways..
I hope to see more contestants joining in here. Com'on... tomorrow's


MrTibs 06-18-2003 09:25 PM

Well, here is my script.


#Set TMPEG resolution to 352x240. Bitrates MIN=300 MAX=1,150 CQ=79.5






Same process as Kwag but using Avisynth 2.0.

kwag 06-18-2003 10:14 PM

Here's MrTibs mpeg sample: :)

Edit: And looks more clean than my sample. A little more blured, but It's necessary for that noisy material. Sample is very stable :!:


MrTibs 06-18-2003 10:28 PM

Aw shucks :oops: Thanks Kwag.

Edit: The blurring is only in motion areas. I've been working on developing in-frame motion smoothing. This clip is pretty bad and since it is only 352x240, there isn't much to work with. The idea is there though but a better mask filter is needed. (I'm working on that.)

Wilbert 06-30-2003 04:20 PM

I finished my example. I can be found here:

MrTibs 07-05-2003 12:36 AM


Great sample, how about a script to go with it?

All times are GMT -5. The time now is 11:25 PM  —  vBulletin Jelsoft Enterprises Ltd

Site design, images and content © 2002-2019 The Digital FAQ,
Forum Software by vBulletin · Copyright © 2019 Jelsoft Enterprises Ltd.