Log in

View Full Version : AviSynth Q&A


Pages : 1 [2] 3 4 5

sh0dan
8th January 2003, 10:38
Originally posted by HarryM
@Sh0dan:
Can you implement into Avisynth 2.5 fast version of ReduceBy2 (maybe FastReduceBy2 named), based on simple 2x2 matrix resize (such like in Virtualdub)?

I seriouslu doubt it will be any faster than the 121 matrix currently being applied, and quality is more exact.

scmccarthy
8th January 2003, 15:25
@sh0dan&HarryM

Yes, a 121 kernel sites the resize over the right line and a 22 kernel would shift the image a half line. It's analogous to the siting issues for chroma.

Stephen

Wilbert
23rd January 2003, 18:27
I renumbered the questions in the faq. I'm sure you will get used to it :) This way it is much easier to add and delete questions!

What I'm also sure of is that I broke some links on www.avisynth.org. I will restore them and add some other stuff tomorrow.

cweb
25th January 2003, 15:26
I should write a guide on MPEG2 to KVCD. ;)

Originally posted by sh0dan
I've been doing some updates on avisynth.org - and I'm beginning to love wiki very much.

I would encourage everybody to start creating some guides. Topics could cover:

MPEG2 -> XviD
MPEG2 -> VCD / SVCD
AVI -> MPEG
DV -> DVD
CleaningCaptures
CleaningDV
AdjustingColors

hakko504
25th January 2003, 15:33
I have started with the MPEG2 -> AVI guide, and I intend to cover DVD-decryptor(done), DVD2AVI(done), GordianKnot(done), manual encodes with DivX 3.11, 5.02, 5.03 (Mostly done, minor adjustments might be necessary).

Xvid guide still not done. I'll take a look at it, but I still might need help with it. I also added a quick guide for DivX5Enc, and I've asked Dolemite to write something about DVX.

Wilbert
7th February 2003, 17:16
I added a bunch of stuff to the faq last week:


added Q1.13: I got the message "LoadPlugin: unable to load "xxx" is not an AviSynth 1.0 plugin ?
added Q1.14: How do I know which colorspace I'm using at a given place in my script ?
added Q1.21: Where can I find VCF2AVS ?
Restyled Q2.10, added: how to open ATSC/PVA transport streams in AviSynth. I hope Nic/Tom will correct it if necessary :)
updated our filter list in Q3.3 and Q3.4.
Several other little things.

Wilbert
8th June 2003, 21:34
I reorganized the faq:


removed outdated stuff related to old AviSynth/DVD2SVCD/TMPGEnc versions
replaced link2 by makeAVIS
added the PluginPace frameserver (Vegas, Premiere, Ulead -> AVS)
removed chapter 5
a lot of other minor improvements

Loul
21st June 2003, 21:46
Looks like some idiot erased the faq.

http://www.avisynth.org/index.php?page=Section+3%3A+Filters%2C+plugins+and+colorspaces

http://www.avisynth.org/index.php?page=Section+3%3A+Filters%2C+plugins+and+colorspaces

Well the good thing is that we can still access the old pages through http://www.avisynth.org/index.php?page=RecentChanges

Edit : looks like wilbert repaired it all, thanks !

Wilbert
23rd June 2003, 10:08
Edit : looks like wilbert repaired it all, thanks !
Someone else repaired it. Thanks, nkotb!

arlsair
23rd July 2003, 22:34
The FAQ is now available in german.

German AviSynthFAQ (http://www.avisynth.org/index.php?page=AviSynthFAQ+Deutsch)

Just for info.

Wilbert
23rd July 2003, 23:19
Great work. I'm sure German people will appreciate this!

Selur
24th July 2003, 15:55
hail to arlsair :D

coaa
8th July 2004, 03:58
Originally posted by Wilbert
Corrected Q13.3:
How to read import mpeg2-files in AviSynth.

Removed Q36:
That was about the mpeg2enc.dll plugin, that had nothing to do with AviSynth.

Added Q35:
Q35: When i try to use SpatialSoftenMMX, it crashes in VirtualDub ?
A: You probably used this filter before resizing. Apperently SpatialSoftenMMX doesn't like resolutions that cannot be divided by 8 or 16. So if you use it after resizing it works, of course.

Hey guys.. Where exactly is this FAQ posted? I can't find these questions listed anywhere on http://www.avisynth.org/index.php?action=history&page=AviSynthFaq

Wilbert
8th July 2004, 09:31
Those are questions from a faq which is a dozen times updated.

How to read import mpeg2-files in AviSynth.
Is listed in Q3.5: MPEG Decoder (source) Plugins: (...). (and also in Q2.8).

SpatialSoftenMMX
Nobody uses this plugin anymore. I thought it was a filter from mpeg2dec.dll, but looking at http://users.win.be/dividee/avisynth.html I guess I'm wrong. Anyone?

esby
12th January 2005, 16:50
I don't know if it is mentionned anywhere...

But there is a bug that scarface encountered on a script he copy pasted from the forums..

the script was saved in unicode:
so when you open it with notepad, nothing seems wrong...
but when you try to load it, it will throw an exception.

check http://esby.free.fr/perso/scarface/
for a working and non working script...

esby

ilovejedd
11th September 2006, 00:32
I didn't find this in the FAQ so I'm asking here regarding function name precedence. The AviSynth website has the following information:
The order in which function names take precedence is as follows:

1. user-defined function (always have the highest priority)
2. plugin-function (have higher priority than built-in functions - they will override a built-in function)
3. built-in function

Inside those groups the function loaded at last takes precedence, there is no error in a namespace conflict.

What is the order in which AviSynth loads functions? For example, I have the following plugins in the AviSynth plug-ins directory: dgdecode.dll, mpeg2dec.dll, mpeg2dec3.dll and I use the following script:
mpeg2source("test.d2v")
Which mpeg2source() function will AviSynth use?

Also, say I have DGDecode.dll v1.4.8 in the AviSynth plug-ins directory. However, a particular project requires DGDecode.dll v1.1.0 which I have saved in C:\DVD-RB\. If I use the following script:
LoadPlugin("C:\DVD-RB\DGDecode.dll")
mpeg2source("test.d2v")
Will AviSynth use v1.4.7 (auto-loaded) or v1.1.0?

Thanks!

foxyshadis
11th September 2006, 03:51
Precedence of autoloading is alphabetical; the last loaded is the one that wins, but you can still use dgdecode_mpeg2source() even if mpeg2dec3 takes the unspecified name over. Giving them new names so they load before dgdecode is wise; but I'd keep them in a manually loaded "obselete" folder anyway, especially since mpeg2dec3 doesn't play nicely with 2.5.7 at all.

In the second question, you're manually loading one, which always takes precedence over an autoloaded function.

ilovejedd
11th September 2006, 07:35
Thanks for the very helpful info! I know that AviSynth supports DLLname_function() but since the script is automatically generated, I wanted to know which function will be used. I don't really have mpeg2dec.dll or mpeg2dec3.dll as I'm very happy with DGDecode. I just used them as an example. I kinda thought it might be alphabetical but I just wanted to make sure. :)

Ð.Sp!dér
20th February 2007, 14:11
Why does Avisynth show "fps=23.9759856527702" while GSpot only sees 23.976 ? :|

foxyshadis
20th February 2007, 20:00
The internal fps is an arbitrary precision division of two numbers, and usually isn't exact. The gspot one just rounds it off to three places to make it look nice (and possibly fits it to the nearest "normal" ratio). The exact one would be 24000/1001.

Gilgamesh83
27th February 2007, 12:45
I recently posted something like this in another thread but if you wanna solve the problem with the fps in avisynth is to in my case with convertfps is to write not convertfps=23.976 which results in a 23.975 encode and playback of that avis but to enter convertfps=23.9762 thats right just a simple 2 after the 23.976 crazy eh! But not really since I came up with the idea of entering 23.9762 after I looked into a statsfile created by x264.exe and saw that it uses the division 250000/10427=23,976215594130622422556823630958

Anyway this solved my problem with my fps in avisynth, oh and this also applies to 119.880 fps which must be entered as 119.881=correct.

IanB
27th February 2007, 13:59
Read this thread! ... nicefps() into changefps()/assumefps() (http://forum.doom9.org/showthread.php?t=104681)

abood-conan
20th April 2007, 21:27
Hi everybody,

i Don't write a lot in this forum maybe because I still need the experience ...
anyway, I will not take too long time from you
but I want to ask a question .. encoding an anime ( avi ) .. how can i use avisynth to help me improve the overall look of the video .. i don't want you to explain .. just suggest some plugins that can be useful and i will search about the rest ^^
please help me guys.

anahita
23rd May 2007, 11:18
Ok, thanks Richard.

abood-conan
6th August 2007, 06:12
guys .. i'm trying to encode anime in avi which is DVD originally .. but i don't know how to deinterlace it .. dvd2avi says it's interlaced .. so can you give me any way to deinterlace ..

Leak
6th August 2007, 08:20
guys .. i'm trying to encode anime in avi which is DVD originally .. but i don't know how to deinterlace it .. dvd2avi says it's interlaced .. so can you give me any way to deinterlace ..
If it's anime, it's most definitely telecined which usually means that the original progressive video can be restored.

Don't just deinterlace it, since that'll ruin it. Search for the TIVTC AviSynth filter and give it a try.

Guest
27th August 2007, 14:44
From Avisynth documentation:

It turns variable framerate video (vfr) into constant framerate video (cfr) by duplicating or skipping frames. This is useful when you want to open vfr video (for example mkv, rmvb, mp4, asf or wmv with hybrid video) in AviSynth. It is most useful when the fps parameter is set to the least common multiple of the component vfr rates, e.g. 120 or 119.880.

Guest
27th August 2007, 15:04
Set it to true.

Wilbert
27th August 2007, 18:06
Both false and true will result in cfr. The difference is that setting it to false, it will load the video with fps=25. If the frame rate is different, or variable, you will get video and audio which is not in sync. When setting it to true it will add/delete frames (to match the specified fps), with the result that the video and audio is in sync.

Since asf is vfr, yes, you should use it.

Wilbert
29th August 2007, 19:58
Ok thanks! That explains a lot! What exactly is happening if I don't specify any fps parameters? If I just have a script like this:
It tries to guess the fps, but i forgot how that works. Perhaps someone else knows?

Would this result in audio sync errors too?
Yes. Arguments have a default value (which is false for convertfps), which are used if you don't specify the arguments.

foxyshadis
29th August 2007, 21:30
It uses whatever framerate the splitter reports back. Since directshow is based on timecodes, there's no harm in returning totally off-the-wall framerates, or one framerate for everything, so some do. Others will report the average duration, the framerate muxed into the container (which can anything for the same reason, but muxers are better in this respect), the duration of the first frame, and so on. Obviously a completely unreliable value, you're better off never trusting the splitter.

AkumaX
27th September 2007, 17:16
i'm looking to use a built in filter (logo, specifically) from vdm, in avisynth. is there a way i can do that? (i'd use donald graft's logo 1.34a but it doesn't give me the intended results)

thanks in advance!

foxyshadis
27th September 2007, 18:08
Not without breaking it out as an external plugin, unfortunately.

For logo, you can use Overlay or Layer to get the same effect in avisynth. You can also try the xlogo plugin for more options.

Guest
9th October 2007, 04:19
Guys, you won't get specific help on problems in this thread. Please start a new thread for your problems.

video
3rd January 2008, 14:23
have anybody have/seen the sources of the pixiedust (dust.v5.dll) avisynth plugin?
thx.

unskinnyboy
3rd January 2008, 15:19
have anybody have/seen the sources of the pixiedust (dust.v5.dll) avisynth plugin?
thx.Nope. Steady never released the source.

KG6ZVP
17th December 2008, 00:54
I have been developing software for use on PSP: PSP_Converter (http://pspslimhacks.com/forum/index.php/topic,4479.0.html)

This software automatically performs the following tasks via AVIsynth:
> automatic resizing of video clips to a maximum size of 480x272, but retains their original aspect ratio

> If framerate contains more than 3 decimal places, it is rounded (ex. 23.976043 to 23.976) and converted to that rate.

> If framerate is above 30 fps, it changes it to 29.970 fps

> Loads any file that can be converted in ffmpeg without that video codec being installed



I have two problems:

> Cannot handle variable framerate video files. Audio is very far out of sync. Is there a way to tell avisynth to change the framerate to one that is in sync with the audio before it is rounded?

> Cannot convert any input file which uses DAR, SAR or PAR in it's display. Is there a way to retrieve one of those values in order to calculate the output video size?


Below is my script. I have included brief explainations along with each section. I am a developer. This script must work for ANY input file and cannot be engineered for specific files.


#Load necessary plugins
LoadPlugin("FFmpegSource.dll")
LoadPlugin("Autocrop.dll")

#Load and crop input clip
Input_Clip = FFmpegSource("C:\Users\Jim\Videos\Clip.avi", vtrack=-1, atrack=-1).autocrop(mode=0)

#Calculate video width and height based on the autocropped Input_Clip and a maximum output resolution of 480x272
i_width = Input_Clip.Width
i_height = Input_Clip.Height
d_a_r = float(i_width) / float(i_height)
p_o_height = (d_a_r < 1.7647058823529411764705882352941) ? 272 : 480/float(d_a_r)
p_o_width = (d_a_r < 1.7647058823529411764705882352941) ? 272*d_a_R : 480

#Sets output width and height to numbers divisible by 4
p2_o_width = Round(p_o_width/4)*4
p2_o_height = Round(p_o_height/4)*4
o_width = Round(float(p2_o_width))
o_height = Round(float(p2_o_height))

#Retrieve framerate of input_clip, multiply by 1000 (this will be framerate denominator) and round it to a whole number
first = Input_Clip.Framerate*1000
second = Round(Float(first))
FPS_oi = int(second)

#If the rounded framerate is greater than 30.000fps, then set it equal to 29.97 fps
FPS = (FPS_oi > 30000) ? 29970 : FPS_oi

#Output is input clip, changed to the desired framerate numerator (whole number) and a denominator of 1000. The clip is also resized maintaining aspect ratio.
Output = Input_Clip.changefps(int(FPS), 1000).LanczosResize(o_width,o_height).converttoyv12()
Return Output



I'm a noob, I'm probably missing something obvious.

Guest
17th December 2008, 04:59
You're breaking two rules with this post.

1. You can't repost an issue that was closed for a rule violation in another thread. That's a 16 strike.

http://forum.doom9.org/showthread.php?p=1224905#post1224905

2. You shouldn't be posting in this thread. Didn't you get the idea when I moved your other posts? This thread is for discussion of FAQs, not for specific problems. That's a rule 3 strike.

http://forum.doom9.org/showthread.php?p=1053536#post1053536

Do not bring up this issue again. You can't change history. And don't start debating me here either. Send a PM if you want to challenge a moderating decision.

peter71
2nd June 2010, 15:39
Hi,

The avisynth documentation mentions operator precedence, but does not say anything about the '.' operator.

I mean, experience shows that

v1+v2.bob() means v1+(v2.bob()) and not (v1+v2).bob()

but is this actually a defined behaviour ?

thanks,
Peter

Gavino
2nd June 2010, 18:45
experience shows that
v1+v2.bob() means v1+(v2.bob()) and not (v1+v2).bob()
but is this actually a defined behaviour ?
Yes, it is.
'.' is not really an operator (what would its right operand be?), just a syntactic element, but in effect it binds more tightly than any operator.

http://avisynth.org/mediawiki/The_full_AviSynth_grammar#Expressions

ProDigit
4th January 2011, 00:56
request a clear wiki page for older anime! (low bitrate,low motion encoding).

mastrboy
26th August 2012, 21:47
I guess this question does not need it's own thread, but fits right into this one.
Is there a bug with the behavior of Eval()?

This works:
Clip
Eval("filter_string")

This does not work, which to me is kind of weird...:
Clip.Eval("filter_string")

IanB
26th August 2012, 23:56
Eval is a little strange, it parses the expression in place where the eval call is. So case 1 isLast=Clip
Filter(Last, _string) # Implicit last handling for Arg[0]if "filter_string" need a clip source orLast=Clip
Filter_string # Implicit last not required for Arg[0]if it does not take a clip source.

And for case 2Filter(Clip, _string) # Explicit Clip as Arg[0]i.e. "filter_string" is expected to take a clip source.

The implicit last handling can make thing a little tricky e.gBlankClip(Height=420)
BlankClip(Height=240).Eval("Subtitle(String(Height()))")Which evaluates toLast=BlankClip(Height=420)
BlankClip(Height=240).Subtitle(String(Height(Last)))So you end up with a 240 high clip with the number 420 stencilled over it.

mastrboy
27th August 2012, 01:41
So it's not a bug, but "intended" behavior.

btw, the Eval entry in the wiki could probably use a little more documentation, it basically only says "Eval evaluates a string as if it was part of the script. " and gives a example...

Gavino
7th September 2012, 09:15
The implicit last handling can make thing a little tricky e.gBlankClip(Height=420)
BlankClip(Height=240).Eval("Subtitle(String(Height()))")Which evaluates toLast=BlankClip(Height=420)
BlankClip(Height=240).Subtitle(String(Height(Last)))So you end up with a 240 high clip with the number 420 stencilled over it.

No it doesn't, it produces the error 'Invalid arguments to function "Eval"'.
Just like any other use of the '.' notation, clip.Eval(filter_string) is the same as Eval(clip, filter_string).
This can never be correct since Eval does not have a clip argument.

The original intent can be achieved by writing
Eval("clip."+filter_string)

kotuwa
12th April 2015, 14:12
What is the difference between putting two functions in two lines vs in one line with a period/dot (.)
!?


For an example,


crop(0,10,0,-10)
Spline64Resize(1280,720)

vs

crop(0,10,0,-10).Spline64Resize(1280,720)


Performance-wise differences,
And differences in Qulaity and Lossyness...
:)

Reel.Deel
12th April 2015, 14:19
What is the difference between putting two functions in two lines vs in one line with a period/dot (.)
!?
.....
Performance-wise differences,
And differences in Qulaity and Lossyness...
:)

There should be no difference. It's just 2 different ways of achieving the same thing.

creaothceann
12th April 2015, 16:26
The first version is the short form of

last = Crop(last, 0, 10, 0, -10)
last = Spline64Resize(last, 1280, 720)

...and the second version is the short form of

last = Spline64Resize(Crop(last, 0, 10, 0, -10), 1280, 720)

The difference is that in the second version, the implied (hidden) variable "last" is not modified between the lines. Consider this example:

Version
PointResize(Width * 2, Height * 2)
PointResize(Width / 2, Height / 2)
Result_1 = last

Version
PointResize(Width * 2, Height * 2).PointResize(Width / 2, Height / 2)
Result_2 = last

Clip "Result_1" will have the same content as the result of "Version", but clip "Result_2" will be half the size of "Version" because "Width" and "Height" refer to clip "last" when not prefixed with a clip variable name.

Expanded to its full form the example looks like this:

a = Version
b = PointResize(a, a.Width * 2, a.Height * 2)
c = PointResize(b, b.Width / 2, b.Height / 2)
Result_1 = c

d = Version
e = PointResize(PointResize(d, d.Width * 2, d.Height * 2), d.Width / 2, d.Height / 2)
Result_2 = e

Btw. an easy way to add a blur effect would be this:

BilinearResize(int(Width * 0.75), int(Height * 0.75)).BilinearResize(Width, Height)

ale_x
16th October 2017, 21:30
Hi.

I used this function recently

ExtractU().dither_resize16()

But I got an error "there is no function named ExtractU"

by the way, I'm using Avynth + .

Thanx =)

Groucho2004
16th October 2017, 21:52
But I got an error "there is no function named ExtractU"
You're probably using an older version of AVS+ that does not have that function. Update to the latest version (r2508).