Log in

View Full Version : Using avisynth


carlmart
22nd February 2009, 15:58
I need some help on how you load scripts to process a file.

Even if I have read quite a bit on avisynth FAQ, I failed to see how you practically do it.

So I have been using some GUI programs that let me do it. But I don't think that's the right way to do it.

Between the programs that were recommended to me, HCEnc seems to be the best. But I can't make it run: it goes out in 5 seconds. So I don't know how I should input a script into it.

Where should I start?

tebasuna51
22nd February 2009, 16:12
Between the programs that were recommended to me, HCEnc seems to be the best.

Do you want encode to MPEG2?
Why not MPEG4-ASP (XviD) or MPEG4-AVC (h264)?

How do you execute HCEnc?

carlmart
22nd February 2009, 21:20
Do you want encode to MPEG2?
Why not MPEG4-ASP (XviD) or MPEG4-AVC (h264)?

How do you execute HCEnc?

I had a recent problem with a DVD that I own which was authored in letterbox 4:3.

In that case I was very recommended and I used AVStoDVD as the program to load my scripts in. With my very limited knowledge that was probably the best path.

AVStoDVD does use HCEnc for that conversion, which involved blowing up to 16:9 and correcting some other problems.

But I was also told that I should learn how to use the scripts directly, like in HCEnc.

I downloaded and installed HCEnc version 2.3. But when I click on the executable a page opens. It already has a count down going and says there's en error: no input file, no output file, not bitrate, etc. Of course: I don't know where to load the data!

So maybe someone can tell me how to proceed so I can start trying scripts and all that.

Gavino
22nd February 2009, 21:43
I downloaded and installed HCEnc version 2.3. But when I click on the executable a page opens. It already has a count down going and says there's en error: no input file, no output file, not bitrate, etc.
You need to click on HCgui_023.exe, not HCenc_023.exe, which is the batch processing interface.
You can then specify your input script file, configuration, etc.

poisondeathray
22nd February 2009, 22:30
For a dvd / MPEG2 source, use DGMPGDec . There is a short <1 page quickstart manual included in the documentation that explains how to make a basic .avs script

carlmart
23rd February 2009, 00:11
For a dvd / MPEG2 source, use DGMPGDec . There is a short <1 page quickstart manual included in the documentation that explains how to make a basic .avs script

Thanks. That seems to be a great start.

carlmart
16th March 2009, 01:24
For a dvd / MPEG2 source, use DGMPGDec . There is a short <1 page quickstart manual included in the documentation that explains how to make a basic .avs script

How do you load a DV file? The original is in avi, captured from my camera.

DGIndex seems to be for mpeg files only. What should I use for others?

Guest
16th March 2009, 02:25
For AVI, use a script like this:

AviSource("yourfile.avi")

You will need to have a DV codec installed. Try this one:

www.neuron2.net/misc/cedocida020.zip

Read the material at www.avisynth.org for more information.

carlmart
16th March 2009, 17:12
For AVI, use a script like this:

AviSource("yourfile.avi")

OK. I did write it like this on the first line:

AVISource("C:\pedro\testDV1_a.avi")

It's where it's located on my HD.


You will need to have a DV codec installed. Try this one:

www.neuron2.net/misc/cedocida020.zip


I did have another one, but just did install cedocida.


Read the material at www.avisynth.org for more information.

Thas is the problem. I can't make it work following the instructions here:

http://avisynth.org/mediawiki/First_script

Where do I load the script? I don't seem to find a step by step instruction that I could use as an example. I am stuck there. In fact I think something like that should be written if it's not. If I get to understand the steps better maybe I will do it.

Guest
16th March 2009, 17:20
It says right there on the page you linked:

"You now have a script that can be opened by most AVI players in your machine: Windows Media Player 6.4 (aka "mplayer2") will play the script; so will VirtualDubMod or plain VirtualDub. So far as they care, your text document is an AVI file."

Is there something unclear about that?

Open VirtualDub and select File/Open video file... Then select your script file (*.avs) and hit OK. Your video should appear.

The encoder GUIs also allow you to open the script similarly.

Leak
16th March 2009, 17:22
http://avisynth.org/mediawiki/First_script

Where do I load the script? I don't seem to find a step by step instruction that I could use as an example. I am stuck there. In fact I think something like that should be written if it's not. If I get to understand the steps better maybe I will do it.
It says RIGHT THERE:
Open up any text editor, type the above on the first line (using any AVI file on your machine as "myclip.avi"), and save it as "myclip.avs". You now have a script that can be opened by most AVI players in your machine: Windows Media Player 6.4 (aka "mplayer2") will play the script; so will VirtualDubMod or plain VirtualDub. So far as they care, your text document is an AVI file.
Just about anything that opens AVI files should also play AVS files as soon as you have AviSynth installed. And that's exactly what that paragraph says.

EDIT: Whoops... too late.

np: Apollo 440 - Time Is Running Out (Dude Descending A Staircase (Disc 1))

Guest
16th March 2009, 17:30
A concurring second opinion is always valuable. :)

You also pointed out that Avisynth must be installed, which the OP may not have realized.

carlmart
16th March 2009, 17:32
It says right there on the page you linked:

"You now have a script that can be opened by most AVI players in your machine: Windows Media Player 6.4 (aka "mplayer2") will play the script; so will VirtualDubMod or plain VirtualDub. So far as they care, your text document is an AVI file."

Is there something unclear about that?

Open VirtualDub and select File/Open video file... Then select your script file (*.avs) and hit OK. Your video should appear.


Well, I do not want to play the avi file. I already know how to do that. I want to load the script.


The encoder GUIs also allow you to open the script similarly.

Where? VDM allows running a script that is vcf, not avs.

Leak
16th March 2009, 17:35
Where? VDM allows running a script that is vcf, not avs.
VCF scripts are VirtualDubs internal scripts. Nothing to do with AviSynth at all.

Just open your AVS file with "Open video file", and VirtualDub will show you the result of the script.

If you want to edit the script, open it in a text editor, change it, save it and hit F2 in VirtualDub. (Or use VirtualDubMod, but it's ancient and unsupported so I wouldn't recommend it...)

If you want to compress the AviSynth script to a video file, set up compression in VirtualDub and use "Save as AVI...".

If you want to do anything else you need to tell us what exactly you want to do.

NB: AviSynth is a Video for Windows codec. Any video editor that supports VfW can use it to open AVS files exactly like a video file. AviSynth then reads the script, compiles it and returns the processed video frame by frame just like, say, the XviD codec does with XviD encoded video.

np: Apollo 440 - Diamonds In The Sidewalk (Dude Descending A Staircase (Disc 2))

poisondeathray
16th March 2009, 17:36
You can load it into avsp, for editing and preview (push f5 to toggle the preview, or move the slider)

vdub and vdubmod can open the .avs directly, as well as many media players (like mpc) that support .avs - this can be used to preview the script

carlmart
16th March 2009, 17:37
OK. Let's go one step more forward.

Suppose my script is this.


AVISource("C:\pedro\testDV1_a.avi")

TempGaussMC_Alpha3()
spline36resize(1920,1080)



The output should be HD video.

poisondeathray
16th March 2009, 17:40
OK. Let's go one step more forward.

Suppose my script is this.


AVISource("C:\pedro\testDV1_a.avi")

TempGaussMC_Alpha3()
spline36resize(1920,1080)



The output should be HD video.

Did you try it? You're right - it should be resized to 1920x1080 are you claiming it isn't?

Leak
16th March 2009, 17:40
The output should be HD video.
What, as in Blu-Ray compatible H.264 files/disc images/whatever?

Then you need a H.264 encoding application. Your AviSynth script only gives you uncompressed HD-sized video frames; encoding is not it's job.

np: Apollo 440 - Somethings Got To Give (Dude Descending A Staircase (Disc 2))

carlmart
16th March 2009, 18:20
Ok. The original script, as suggested on another topic, was:

AVISource("C:\pedro\testDV1_a.avi")

TempGaussMC_Alpha3()
spline36resize(1920,1080)

fft3dgpu(plane=3, sigma=1, sigma2=2, sigma3=4, sigma4=1, sharpen=.4)

lsfmod(smode=5)

grainfactory3(g1str=5, g2str=8, g3str=10)
addgrainc(0,2)

separatefields.selectevery(4,0,3).weave


What I can't run in VDM and I get errors are:

TempGaussMC_Alpha3()
lsfmod
grainfactory3
addgrainc

Before you ask, of course the addgrain.dll is in the script directory.

poisondeathray
16th March 2009, 18:41
Do you have all the prerequisite filters, plugins installed and/or loaded? Many of those filters rely on other filters, read the documentation for instructions on which filters are required.

What specific error messages are you getting?

Start with a simple script - just the AVISOURCE("movie.avi") - then slowly start adding the other filters one by one - otherwise it will be impossible to troubleshoot

carlmart
16th March 2009, 19:13
Do you have all the prerequisite filters, plugins installed and/or loaded? Many of those filters rely on other filters, read the documentation for instructions on which filters are required.

AFAIK they are. The meaning of terms I don't quite grasp yet. A plugin seems to rely on a .dll file. But what about .avs files like some others, like TempGaussMC_Alpha3 seems to be? BTW: that filter specifically I can't seem to find anywhere, only Beta1 version.

Just to format things right, my suggested script was:


LoadPlugin("C:\video\AviSynth 2.58\plugins\FFT3dGPU.dll")
LoadPlugin("C:\video\AviSynth 2.58\plugins\addgrain.dll")
AVISource("C:\pedro\testDV1_a.avi")

TempGaussMC_Alpha3()
spline36resize(1920,1080)

fft3dgpu(plane=3, sigma=1, sigma2=2, sigma3=4, sigma4=1, sharpen=.4)

lsfmod(smode=5)

grainfactory3(g1str=5, g2str=8, g3str=10)
addgrainc(0,2)

separatefields.selectevery(4,0,3).weave


What I got to work was:


LoadPlugin("C:\video\AviSynth 2.58\plugins\FFT3dGPU.dll")
LoadPlugin("C:\video\AviSynth 2.58\plugins\addgrain.dll")

AVISource("C:\pedro\testDV1_a.avi")

spline36resize(1920,1080)

fft3dgpu(plane=3, sigma=1, sigma2=2, sigma3=4, sigma4=1, sharpen=.4)

separatefields.selectevery(4,0,3).weave


If I add those missing lines I get errors

What specific error messages are you getting?

For TempGaussMC_Alpha3(): "There is no function named 'TempGaussMC_Alpha3'"

For lsfmod(smode=5): "There is no function named 'lsfmod'"

For grainfactory3(g1str=5, g2str=8, g3str=10)
addgrainc(0,2): "There is no function 'AddgrainC'"



Start with a simple script - just the AVISOURCE("movie.avi") - then slowly start adding the other filters one by one - otherwise it will be impossible to troubleshoot

That's what I did to make it work: add one by one and see what worked and what didn't.

rkalwaitis
16th March 2009, 19:25
LSFMod and GrainFactory are avs ir avsi files and should be imported .......
LoadPlugin("C:\Users\baba\Desktop\MCTemporalDenoise\AddGrain-Ver 1.4\AddGrainC.dll")
import("C:\Users\baba\Desktop\MCTemporalDenoise\GradFun2DBmod.v1.3.avsi")
import("C:\Users\baba\Desktop\MCTemporalDenoise\LSFmod.v1.7.avsi")
import("C:\Users\baba\Desktop\MCTemporalDenoise\MCTemporalDenoise.v1.2.02.avsi")
import("C:\Users\baba\Desktop\MCTemporalDenoise\Deblock_QED.avs")

if you have your avsi files in the avisynth plugins directory, you do not have to import them. Mine are not in that directory.

As far as I know avs files must be imported even if they are in the avisynth plugins directory.

make sure you have the latest dlls or the version of the one required by plugins or avsi files you are using. Like there are two addgrainc plugins out there so make sure you have the correct one.

There is a new LSFMod--LSFmod.v1.7.avsi a very nice script by Lato http://forum.doom9.org/showthread.php?t=142706

try using his MCTemporalDenoise Script, I think you will like it :)

rkalwaitis
16th March 2009, 19:34
addgrainc comes with an avs file that must be edited ans then resaved as an avs file.

setmemorymax(1024)
#loadplugin(".\Debug\AddGrainC.dll")
LoadPlugin("C:\Users\baba\Desktop\MCTemporalDenoise\AddGrain-Ver 1.4\AddGrainC.dll")
#loadplugin(".\RelSym\AddGrainC.dll")

yv12 = blankclip(pixel_type="yv12",color=$808080,width=640,height=320,length=10)
yuy2 = blankclip(pixel_type="yuy2",color=$808080,width=640,height=320,length=10)
rgb = blankclip(pixel_type="rgb24",color=$808080,width=640,height=320,length=10)
rgba = blankclip(pixel_type="rgb32",color=$808080,width=640,height=320,length=10)

stackvertical(yv12.addgrainc(200,200).ConvertToRGB32(), \
yuy2.addgrainc(200,200,seed=12).ConvertToRGB32(), \
yuy2.addgrainc(200,200).ConvertToRGB32(), \
rgb.addgrainc(200,200).ConvertToRGB32(), \
rgba.addgrainc(200,200).ConvertToRGB32())

should look like mine but of course the dll directory would be different.

TempGaussMC_Alpha3(): Is this an avsi file or a avs file? some times they need other plugins to work.

carlmart
17th March 2009, 15:04
rkalwaitis,


You were right. You do have to import the avs or avsi files in order to process the file.

Thanks, I did download the latest LFSmod version. But still can't make grainfactory or addgrain to work.

I am not sure what file type TempGaussMC_Alpha3() is, if avs or avsi. I couldn't find it until now.

How do you use MCTemporalDenoise and where do I get it?

What do exactly do the other filters you suggest?

rkalwaitis
17th March 2009, 19:38
http://forum.doom9.org/showthread.php?t=139766 This is MCTemporal Denoise. The script tells you exactly which scripts and filters(plugins) you will need.

Im not familiar with grainfactory. Sounds like it needs another file or plugin to work. I dont know. Did you edit your addgrain.avs file that came with addgrainc.dll as I suggested above? This could be the reason.

TempGaussMC_Alpha3(), I think is one of Didee's babies. He is the local prodigy when it comes to these kind of things. I would just check the properties of the file to see what kind it is.

http://avisynth.org/mediawiki/External_filters check out these filters. Suggest MCSpuds, McTemporalDenoise, and HybridFuPP all three good scripts.

I also like SeeSaw and Spresso (Didee). I think that Didee and SageKilla made a FastDegrain or a TemporalDegrain_beta give those a look too.

carlmart
17th March 2009, 21:35
http://forum.doom9.org/showthread.php?t=139766 This is MCTemporal Denoise. The script tells you exactly which scripts and filters(plugins) you will need.

Thanks. Saved & installed.


Im not familiar with grainfactory. Sounds like it needs another file or plugin to work. I dont know. Did you edit your addgrain.avs file that came with addgrainc.dll as I suggested above? This could be the reason.

Just did. One question: what do lines 2 and 4 mean?


TempGaussMC_Alpha3(), I think is one of Didee's babies. He is the local prodigy when it comes to these kind of things. I would just check the properties of the file to see what kind it is.


Well, I did find the text on a topic, and saved it as avsi. We'll see if it works.

http://avisynth.org/mediawiki/External_filters check out these filters. Suggest MCSpuds, McTemporalDenoise, and HybridFuPP all three good scripts.

Will check on them.

I also like SeeSaw and Spresso (Didee).

What do they do?

I think that Didee and SageKilla made a FastDegrain or a TemporalDegrain_beta give those a look too.

Interesting. It's a continuous wave of adding grain and then degrain. Will I ever master this?

As of now it's like a big fruits & veggies supermarket: you look at them scripts & filters and wonder what you can do with them.

But as a friend of mine said: why rush and take just some? Let's go slow and take them all.

Sagekilla
18th March 2009, 04:11
If you still use TD, check the page I updated the scripts: http://avisynth.org/mediawiki/Temporal_Degrain


Note: TD now uses MVTools2! Please update your plugins accordingly.
Note 2: I added a new beta version working off an idea Didee left to work off of.

rkalwaitis
18th March 2009, 07:57
Spresso removes grain. Seesaw helps you tune sharpening.

Here is the script.

# SeeSaw v0.3e (02 Jan 2006)
#
# (Full Name: "Denoiser-and-Sharpener-are-riding-the-SeeSaw" )
#
# This function provides a (simple) implementation of the "crystality sharpen" principle.
# In conjunction with a user-specified denoised clip, the aim is to enhance
# weak detail, hopefully without oversharpening or creating jaggies on strong
# detail, and produce a result that is temporally stable without detail shimmering,
# while keeping everything within reasonable bitrate requirements.
# This is done by intermixing source, denoised source and a modified sharpening process,
# in a seesaw-like manner.
#
# This version is considered alpha.
#
# Usage:
#
# a = TheNoisySource
# b = a.YourPreferredDenoising()
# SeeSaw( a, b, [parameters] )
#
# You're very much encouraged to feed your own custom denoised clip into SeeSaw.
# If the "denoised" clip parameter is omitted, a simple "spatial pressdown" filter is used.
#
#
# Fiddled together by Didée, for your pleasure.
#


# ======= Main function =======

function SeeSaw( clip clp, clip "denoised",
\ int "NRlimit",int "NRlimit2",
\ float "Sstr", int "Slimit", float "Spower", float "SdampLo", float "SdampHi", float "Szp",
\ float "bias", int "Smode", int "sootheT", int "sootheS", float "ssx", float "ssy")
{
ssx = default( ssx, 1.0 ) # supersampling factor x / SeeSaw doesn't require supersampling urgently.
ssy = default( ssy, ssx ) # supersampling factor y / if at all, small values ~1.25 seem to be enough.
NRlimit = default( NRlimit, 2 ) # absolute limit for pixel change by denoising
NRlimit2 = default( NRlimit2, NRlimit+1) # limit for intermediate denoising
Sstr = default( Sstr, 1.5 ) # Sharpening strength (don't touch this too much)
Slimit = default( Slimit, NRlimit+2 ) # positive: absolute limit for pixel change by sharpening
# negative: pixel's sharpening difference is reduced to diff=pow(diff,1/abs(limit))
Spower = default( Spower, 4 ) # exponent for modified sharpener
Szp = default( Szp, 16+2 ) # zero point - below: overdrive sharpening - above: reduced sharpening
SdampLo = default( SdampLo, Spower+1 ) # reduces overdrive sharpening for very small changes
SdampHi = default( SdampHi, 24 ) # further reduces sharpening for big sharpening changes. Try 15~30. "0" disables.
bias = default( bias, 49 ) # bias towards detail ( >= 50 ) , or towards calm result ( < 50 )
Smode = default( Smode, ssx<1.35 ? 11 : ssx<1.51 ? 20 : 19 )
sootheT = default( sootheT, 49 ) # 0=minimum, 100=maximum soothing of sharpener's temporal instableness.
# (-100 .. -1 : will chain 2 instances of temporal soothing.)
sootheS = default( sootheS, 0 ) # 0=minimum, 100=maximum smoothing of sharpener's spatial effect.

Szp = Szp / pow(Sstr, 1.0/4.0) / pow( (ssx+ssy)/2.0, 1.0/2.0 )
SdampLo = SdampLo / pow(Sstr, 1.0/4.0) / pow( (ssx+ssy)/2.0, 1.0/2.0 )

ox=clp.width
oy=clp.height
xss = m4(ox*ssx)
yss = m4(oy*ssy)
NRL = string( NRlimit )
NRL2 = string( NRlimit2 )
NRLL = string( int(round( NRlimit2 * 100.0/bias - 1.0 )) )
SLIM = string( abs(Slimit) )
BIAS1 = string( bias )
BIAS2 = string( 100-bias )
#ZRP = string( abs(Szp) )
#PWR = string( abs(Spower) )
#DMP = string( SdampLo )

denoised = defined(denoised) ? denoised : mt_lutxy(clp,clp.removegrain(4,-1),"x "+NRL+" + y < x "+NRL+" + x "+NRL+" - y > x "+NRL+" - y ? ?",chroma="copy first")

lines 2 and 4 are not used, we know this because of the # infront of the line. You can remove them from your avs file and it will work properly.

Personally im gonna check out Sagekilla's updated script for MVTools2. He knows what he is talking about :)