Log in

View Full Version : A guide on how to use Gordian Knot and Nandub with AVI sources


Darksoul71
16th January 2002, 06:57
Hi !

I know that Wef has promised to add AVI support for GKnot ASAP but Iīm writting this guide for all people that canīt wait (like me :)).

Note: This is neither a guide for GKnot professionals (you already know how to do this), nor is it a guide for absolute GKnot newbies.

OK, now lets begin:
GKnot & Nandub are great tools but currently more leaned toward DVD/MPEG transcoding.
Thatīs sad for all the people out there that do TV captures or capture from their old VHS tapes.

Why not giving the power of Nandub & GKnot to them ?

How to do it:
1) Open up your captured AVI files in Virtual Dub
2) Cut out all unwanted parts (commercials, etc) and scroll to the end of the movie.
Write down the frame number.
3) Apply all filters
Hereīs a list of filters I use in order:
a) Smart deinterlace
b) Nulltransform (cropping away black bars and damaged parts of the movie)
c) Resize
d) Denoise with Smart Smoother and/or temporal smoother
IMPORTANT: Save all settings including your cut movie or they will be lost if VDub crashs.

OK, till resize there is no "trick" but Iīll explain this now:
Launch GKnot. Enter the resolution of your movie after the nulltransform filter and set input pixel aspect ratio to 1:1. Now you have to enter the number of frames your movie has. From this point on you can use the resolution slider of GKnot as if you would convert a DVD. Smart cropping should be enabled. Look for the "Bits/(Pixel*Frame)" value youīre aiming for. The boarderlines for DVD (0.2 for 1CD/0.3 for 2 CDs) work mostly for VHS tapes unless you got a pretty bad one.

After adjusting your res you have to look at the cropping values GKnot "made" to the movie. Write down the values and enter them at the "nulltransform" filter in VDub. The values are the same as for GKnot/AVISynth. So you shouldnīt have a problem here. GKnot has suggested a target resolution. You should enter the values to your resize filter (BTW: resizing esp. bilinear filtering works as some sort of denoise filter so I strongly suggest that you use your denoise filters after resizing) and weīre ready for the first pass and/or a short compressibility test.

For DVD sources a compressibility test tells you if the choosen res will give you a good quality when encoding with the actual setting but for AVI sources GKnot doesnīt have such feature.

OK, hereīs how to do this:
Set up a VDub frame server (here called test.vdr). Open up a texteditor and write down this small AVISynth script:

-----------------
LoadPlugin("C:\WINAPP\AVSGEN\BIN\MPEG2DEC.dll")
AVISource("D:\test.vdr")
SelectRangeEvery(260,13)
-----------------
You have to load the MPEG2DEC.DLL because SelectRangeEvery is part of it. You can also use my tool AVSGen for this :)

OK, now save this script and open it with Nandub. Do a first pass like youīre used to.
I usually save this to a stats file called "quick.stats" so I donīt mess up any movie stats file but thatīs up to you.

Now you can open this stats file in GKnot and look for the quality. Donīt be supprised if you end up with a much lower resolution than GKnot first suggested. This can be a result of very noisy videos. I often ended up somewhere around a with of 416 or 448 where GKnot suggested 640 first.
Of course you must "finetune" the res again. Drag the res slider to the left until you end up somewhere around 65% quality. If your movie is too noisy or too long for a certain number of CDīs you might end up with a pretty low res. May be even below 320 pixels width. That is because GKnot tries to reach maximum balance between res and quality for a certain filesize. Donīt get mad and spend another CD for your movie.

When you get a "around 65% quality" res you have re-adjust your cropping and resize settings in VDub. Save your settings and quit VDub. Now launch Nandub. Open up your AVI sources and load the settings youīve saved before. Nandub usually loads them without probs as itīs based on VDub (opening settings saved by Nandub in VDub might not work. So I suggest you save Nandub settings to different files).

Voilā: We are ready for the first pass.
From here on everything works as usual:
1) Doing a first pass
2) Analysing the stats file in GKnot.
3) Recalculating a new stats file
4) Encoding your movie with Nandub and the recalculated stats file.

I also suggest you extract your audio track and denoise/normalize it before setting up Gordian Knot. By using a wave editor such as Soundforge or Cooledit2k you can easily remove any audio hiss and may be add a fade in/out. After this you could encode the cleaned up
wave file by using LAME.

If youīve read till this point I would like to thank you for your attention. :)

Suggestions are welcomed !

May be we should add this to CKīs video guide ? <ggg>

c u,
D$

TheWEF
17th January 2002, 01:03
great, thank you!

could be part of the Q&A...

wef.

Darksoul71
17th January 2002, 10:37
Hi wef !

I would be glad if people make suggestions on doing this in some easier way. So if someone comes up with an idea to save work, let me know via PM.

Here you can see the problems for GKnot to support AVI sources:
1) How to cut before using GKnot for parameter calculation (bitrate, res, etc) ? I came up with two ideas: Either you cut in VDub and frameserve to GKnot with Video set to streamcopy or you cut in VDub, save a VCF file and GKnot uses the VCF file in order to do source file loading and cutting via AVISynth.
This week Iīll finish my studies for the next 6 weeks so I have some sparetime to program again ;)
I could offer my help in order to write a small code snippet that extract the source file information and a "cut list" for AVISynth from a standard VDub ECF file. Would this be usefull for you to support AVI sources in GKnot ?

2) How to apply all res settings to the source material ?
This could be solved via the normal AVS from GKnot.

P.S.:
Iīve taken a quick look to VDubīs VCF file. Cuts are saved like this:

VirtualDub.subset.AddFrame(10280,22991);
VirtualDub.subset.AddFrame(38112,26721);
VirtualDub.subset.AddFrame(70320,53491);

AVISynth uses Trim as delete function. So I could write a small function that "translates" from VDubs "cutlist" to AVISynth trim function.
The AddFrame stuff from VDub should look like this in AVISynth:

Trim(0,10279)
Trim(22992,26720)
Trim(38113,53490)
Trim(70321,0)

Should work but Iīll do some testīs first. Would this be of interest for you ?

-D$

TheWEF
17th January 2002, 11:07
blacksun said he is a little lazy atm but he "promised" to adapt some powerdivx code (that can read any avi and stuff) and send it to me.

i will have more time in a few days as well, so i hope we will get avi-support before christmas this time ;).

thanx for your offer but hold your horses for now! let's wait...

wef.