View Full Version : AVI encoding in GKnot
hakko504
5th June 2002, 07:26
It's amazing what ideas you can get at 3am when you can't sleep. This is one of them.
HOW TO ENCODE AVI's WITH GORDIAN KNOT
[list=1]
Create an .avs file in notepad that looks like this:
AVIsource("Capture.avi").ConvertToYUY2()
#
# ENABLE ANY OF THE FOLLOWING LINES THAT YOU FEEL SHOULD BE APPLIED TO THE CLIP.
#Don't forget to load corresponding plugins with correct path's
#
# PLUGINS
#LoadPlugin("mpeg2dec.dll")
#LoadPlugin("Decomb.dll")
#LoadPlugin("Avisynth_Spatial.dll")
#LoadPlugin("GreedyHMA.dll")
#
# DEINTERLACING
#
#fielddeinterlace()
#GreedyHMA(1,0,0,0,0,0,0,0)
#verticalreduceby2()
#
# IVTC
#
#Telecide()
#Decimate()
#
# CROP
#
#crop(0,0,last.width,last.height)
#
# RESIZE
#
BicubicResize(width,height,0,0.5)
#
# DENOISE
#
#SpatialSoftenMMX(2,4,6,false,false,4,4,6,8)
#TemporalSmoother(3)
#SpatialSoftenMMX(1,4,6,false,false,4,4,6,8)
#
# TRIM
#
#trim(start,end) #use this to get main movie
#trim(start, end_part_1)+trim(start_part_2,end)
#+trim(...) to get rid of commercials etc.
Open this script in VirtualDub and extract the audio ('save wav...')
While the file is open, find the length of movie (frames)
Open GKnot and enter correct framenumber and framerate.
On the bitrate tab select your bitrate (i.e. 1CD/700MB or 2CD/1380 or ....)
On the resizing tab, select the size you entered in the .avs! Make sure you get a good bits/pixel value. You can not make compression tests with this method! You can of course select something else and go back and edit the .avs file to match GKnot's suggestion. To get correct crop values, enter the AVI size in the 'input resolution other...' boxes, and the correct aspect ratio in the 'Display AR' box (or in most cases when transcoding from AVI to AVI you can select '1:1')
Go to the encode tab and press add job.
Select your video codec, Divx3 or DivX5
Under main movie, open the .avs containing the main movie. Enable the options you feel apply to you (Pro freatures, GMC, B-frames)
If you want to add audio, go to Audio tab and select the file containing the audio. Also set mp3 bitrate to use (or just mux if you already have mp3 audio)
Go back to video tab and press 'add job'. If you want to start encoding immediately then feel free to do so.
[/list=1]
cofferscuffs
5th June 2002, 09:36
*Sticky* :)
hakko504
5th June 2002, 17:32
Sorry, like I wrote I thought this up at 3am and didn't quite have time to test it properly. I started a test before I went to work, and wrote the post while at work. Now when I came home I found that the first video I tried with had failed because GKnot didn't like the credits. You probably have to set this the hard way by opening a .d2v and press the button credits start. If anyone can confirm that opening a 'dummy d2v' and setting start of credits in this way too as per my original post, please post here and say so. I will test this myself, but it will probably take a few days before I can get around to that. I do currently not have a ripped DVD long enough to set credits where I want them with the video I tested this morning and I do not have the space left on my HD to rip another DVD. At the moment, you will have to encode credits separately and allow a few MB for this when calculating bitrate or simply don't lower the bitrate for the credits.
Abond
12th June 2002, 13:55
http://forum.doom9.org/showthread.php?s=&threadid=25756
Well, regarding this post the deinterlacing should be after the croping. Here above, in the avs it is not so. How should be?
:confused:
hakko504
12th June 2002, 14:47
Nothing wrong with putting crop after de-interlacing, but if you enable verticalreduceby2() then you must halve the vertical values by 2 to get correct crop, or put crop before deinterlacing.
Darksoul71
14th July 2002, 09:48
@hakko504:
May be Iīm stupid but what it the advantage of your method when compaired to my GKnot methode (http://gknot.doom9.org/avi.html) ?
Donīt forget that the most analogue captures have to be cut. Either cutting of adds or just removing a part of the start/end of the movie. So you have the movie loaded to VDub / Nandub anyway.
Correct me if Iīm wrong but with your method you still have to:
1) Finding out maximum playtime by "hand"
2) enter playtime by hand
3) enter res by hand
So, the only bonus I see is that the included encoding joblist of GKnot can be used but thatīs all.
Also, you donīt care about the cropping that it useful for all VHS captures to get rid of the disturbing lines at the top/bottom of your picture.
just me 2 cents
-D$
hakko504
17th July 2002, 09:54
@D$
It's not better, it's just different.
Actually I invented it beacuse I had missed your guide for using GKnot to encode AVI's and I had some problem with making VD do DivX5.02 encodes properly. This way I am also able to use all AVIsynth filters and since most stuff I do are PAL captures that needs to be de-interlaced I can use Greedy for de-interlacing. Besides, I can use fast recompress, something that speeds up the process slightly if I don't apply any other filters.
As for cropping, this can and should be applied in step 6 as per my method.To get correct crop values, enter the AVI size in the 'input resolution other...' boxes, and the correct aspect ratio in the 'Display AR' box. Hmm... maybe I'm not quite clear on this point, but of course all other methods availabel in GKnot can also be used for deciding what crop/resize values to use.
Darksoul71
18th July 2002, 10:38
Hi hakko !
I was just wondering. Iīve tried to program some sort of GKnot for AVI by myself but stopped the project because having not enough time. Cropping calculation (to correct AR after cropping away unwanted parts of the movie) and bitrate calculation work fine BUT I have a serious problem: I canīt get frames from an AVI using Aquaplanings vid_frame DLL. I only get an access violation when accessing a Virtual Dub frameserver. Hopefully TheWef will include AVI support for GKnot in the next time.
I had the following things in mind to work with GKnot (or my "AVIKnot"):
1) Opening up the captured AVI in Virtual Dub (or any other Videoeditor that is able to frameserve)
2) Editing out all commercial, credits, unwanted stuff
3) Setting audio & video to streamcopy (for VDub)
4) Starting a frameserver
5) Opening up the frameserver in "AVI GKnot"
6) Croping away all unwanted parts of the movie (may be with Autocrop function but I think any autocrop function has to fail with analogue material because of damaged lines & noise)
7) "AVI GKnot" reads the duration from the frameserver and calculates the correct cropping settings
8) "AVI GKnot" encodes using batch encoding with VDub / Nandub
My problems here:
1) Getting a frame of the frameserver and display it in a form for cropping
2) Getting duration from the frameserver file for bitrate calculation
I wouldnīt support encoding from my app itself but save the AVISynth script and you can easily use any of the "auto joblist generators" out there.
Well, thatīs it. May be Iīll find out how to get a frame from the AVI server in Delphi or Wef adds AVI support for GKnot earlier. It pi.... me off personaly to add all this values by hand for AVI files in GKnot because I still have around 50 movies to convert from VHS to DivX. So please hurry wef :D
Cheerio,
D$
FSB-SPY
5th November 2002, 05:13
I'm having a problem; VirtualDub is telling me there is a syntax error in the first line, first column.
Here's the code I have in my avisynth.avs file:
AVIsource("G:\Movie.avi").ConvertToYUY()
LoadPlugin("G:\mpeg2dec.dll")
Both of those files do reside in the root of my G: drive. I do not need to apply any filters or do anything too strenuous. The 'source' is captured from a video game, and I simply want to use GordianKnot's advanced options with DivX 5 (b-frames, 2-pass, etc, etc).
Any ideas on what I am doing wrong? :(
Thanks in advance!
Darksoul71
5th November 2002, 08:43
Hi,
it should be ConvertToYUY2() instead of ConvertToYUY()
-D$
hakko504
5th November 2002, 08:50
:stupid: Sorry, my mistake. I fixed it in the sample-script.
@ FSB-SPY
If you don't use any filters there is no need to load mpeg2dec.dll
FSB-SPY
5th November 2002, 16:57
Thanks guys. I can now see the movie in VDub play.
Unfortunately it seems to be upside-down, but even worse, it seems to have a lot of garbage on a lot of the frames. Any ideas as to why this happens?
Thanks again!
FSB-SPY
5th November 2002, 17:16
I've looked at the AVI guide over at the GKnot page, but this is the part where I'm stuck on their guide:
Set up a VDub frame server (here called test.vdr). Open up a text editor 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
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.
Nandub is telling me it cannot open my test.vdr frameserver file that I make with Virtual Dub. Any clues on that one?
Darksoul71
5th November 2002, 18:30
Have you installed the frameserver handler for VDub ?
This can be done with the additional tool included with Virtual Dub (Auxsetup.exe I believe).
-D$
FSB-SPY
5th November 2002, 19:11
Ahh - that would be why! Thanks!
Now I can't seem to generate the Nandub .STATS file. I open my .AVS file in it successfully, then go to File -> 1 pass, then type out the name of my .STATS file and location... hit OK, and then it processes my file. Then nothing. No .STATS file in sight. :(
stax76
6th November 2002, 12:33
@hakko504
using DVX maybe would be a little bit easier, I've never worked with AVISource in DVX, but there should be no limitations, compressibility test, cutting and all the other things should work
N_F
24th November 2002, 02:00
I've skimmed through this thread a few times since it came up in June. I never could figure out what it was about. GKnot only encodes to avi, so what's new with this? I thought. Only one minute ago I studied the avs script more carefully and realised the issue was using avi as source through GKnot. :/
I'm sitting here starring at the title wondering if it's correctly written or if my english is worse (not badder :p )than I thought.
hakko504
22nd December 2002, 23:25
And now it's absolete anyway as v0.27 can open AVI directly.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.