Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th April 2015, 14:19   #101  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by kotuwa View Post
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.
Reel.Deel is offline   Reply With Quote
Old 12th April 2015, 16:26   #102  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
The first version is the short form of

Code:
last = Crop(last, 0, 10, 0, -10)
last = Spline64Resize(last, 1280, 720)
...and the second version is the short form of

Code:
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:

Code:
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:

Code:
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:

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

Last edited by creaothceann; 12th April 2015 at 16:41.
creaothceann is offline   Reply With Quote
Old 16th October 2017, 21:30   #103  |  Link
ale_x
Registered User
 
Join Date: Jan 2012
Posts: 23
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 =)
ale_x is offline   Reply With Quote
Old 16th October 2017, 21:52   #104  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by ale_x View Post
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).
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 17th October 2017, 10:40   #105  |  Link
ale_x
Registered User
 
Join Date: Jan 2012
Posts: 23
Quote:
Originally Posted by Groucho2004 View Post
You're probably using an older version of AVS+ that does not have that function. Update to the latest version (r2508).
Thank u very much =).
ale_x is offline   Reply With Quote
Old 17th October 2017, 15:13   #106  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
I think last posts should move to https://forum.doom9.org/showthread.php?t=174120
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 26th December 2017, 07:25   #107  |  Link
ilko
Registered User
 
Join Date: Nov 2016
Posts: 12
Q : is there a way to enumerate variables in avs ?

I'm trying to do something similar to the following batch script :
Code:
set /a count=1
set var=video%count%
echo the resulting var is "video1"

set /a count+=1
echo we add 1 to the initial count so it's now 2
echo then we set the var gain

set var=video%count%
echo the var is now "video2"

pause
__________________
AviSynth+ Fansub Edition

Last edited by ilko; 26th December 2017 at 07:27.
ilko is offline   Reply With Quote
Old 26th December 2017, 10:39   #108  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
RT_Stats:- https://forum.doom9.org/showthread.p...light=RT_Stats

Code:
RT_VarExist(string)
 Given the name (string) of the variable that you want to test for existence, returns true if exists, else false.
 Eg, #a=32
    RT_Debug(string(RT_VarExist("a")))  # would output 'false' to debugview unless '#a=32' uncommented. {Defined(a) would fail with error}.
    return colorbars()
Could also simulate (for Globals) with Try/Catch in script (within a function, and return as result).

EDIT:

Code:
Function VarType(String GlobalName) {
    Try {
	g = Eval(GlobalName) # Fail here if not exist
        res=    g.IsBool   ? 1
            \ : g.IsInt    ? 2
            \ : g.IsFloat  ? 3
            \ : g.IsString ? 4
            \ : g.IsClip   ? 5
            \ : 0
    } Catch (msg) {
        res = 0 # Not Exist
    }
    return res
}

Function VarTypeName(Int TypIx) {Assert(0 <= Typix <= 5,"VarTypeName: Bad Typix") Return Select(TypIx,"NOT_EXIST","Bool","Int","Float","String","Clip")}

Global G_i = 666   # Comment Me Out

Type = VarType("G_i")

TypeName=VarTypeName(Type)

MessageClip("Global G_i Type = "+String(Type) + " : TypeName='"+TypeName+"'")
EDITED:

EDIT: RT_VarExist just returns result of an Avisynth function, would do equivalent of VarExist on local of that name, and if failed then on Global of that name.
We cant test locals in script within a separate function, you would need to inline script try/catch in-situ if required for local.

EDIT: Something like
Code:
    Try {Dummy=Eval(LocalName) LocalExist=True} Catch(msg) {LocalExist=False} # Dummy, avoid assign anything to Last
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 26th December 2017 at 11:29.
StainlessS is offline   Reply With Quote
Old 18th April 2018, 08:04   #109  |  Link
ShogunGino
Registered User
 
Join Date: Apr 2018
Posts: 5
Was looking through the guides and the wiki and seemed to find that the Force Film, IVTC, and Deinterlacing tutorial link seems to be dead. Does anyone have a zip file of it? It looks like its the main tutorial that I need for my current situation.
ShogunGino is offline   Reply With Quote
Old 29th August 2018, 18:34   #110  |  Link
Seedmanc
Registered User
 
Join Date: Sep 2010
Location: Russia
Posts: 85
Do we have a definitive guide for MVTools options that does a better job at explaining what the more obscure settings do than the official page? I'm particularly interested in what typical situations the options like divide, trymany, temporal, rfilter and so on should be used.
You'd think after all this time somebody would have done a proper analysis and comparison the way they're done for videocodecs. For example, by taking a source video, halving its framerate then upsampling it back and comparing with the original using tools like MSU VQM or other stuff with metrics like PSNR. This is the way I'm trying to do it, but there's only so much you can derive from metrics you don't know comparing options you don't understand.
For example I was surprised to find out that a combination of block size 32 and truemotion=true gives results a lot worse than most other combinations of sizes and values. Another counter-intuitive discovery was that the search method 3 (which is claimed to be similar to x264's ESA) is actually faster and not better than 5 (UMH).
What options should be tweaked first when dealing with 2K video with lots of flickering? I'm under the impression that most of Avisynth's filters were written in the DVD era and might have SD resolution dependency hardcoded in one way or another somewhere.
Seedmanc is offline   Reply With Quote
Old 28th April 2019, 06:30   #111  |  Link
imsrk48
Registered User
 
imsrk48's Avatar
 
Join Date: Nov 2017
Posts: 154
I want to learn about this plugin more better

http://www.infognition.com/super_resolution_avisynth/
imsrk48 is offline   Reply With Quote
Old 29th April 2019, 07:49   #112  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
Originally Posted by imsrk48 View Post
I want to learn about this plugin more better

http://www.infognition.com/super_resolution_avisynth/
According to the comparison screenshots they posted on their websites, it looks like a decent upscaling kernel vs PointResize.



I think that you can achieve something like this by using a decent upscaling kernel yourself, especially in combination with NNEDI and 16bit precision to get better results.

Start with something like:

Code:
nnedi3_rpow2(cshift="Spline64Resize", rfactor=2, fwidth=1920, fheight=1080, nsize=4, nns=4, qual=1, etype=0, pscrn=2, threads=0, csresize=true, mpeg2=true, threads_rs=0, logicalCores_rs=true, MaxPhysCore_rs=true, SetAffinity_rs=false, opt=3)
for 8bit.
If you want more precision, you can use:

Code:
nnedi3_resize16(target_width=1920, target_height=1080, mixed=true, thr=1.0, elast=1.5, nns=4, qual=2, etype=0, pscrn=4, threads=0, tv_range=true, kernel_d="Spline", kernel_u="Spline", taps=6, f_d=1.0, f_u=2.0, sharp=0, lsb_in=true, lsb=true)
It will use more taps for Spline so it will be very sharp, but it will also try to preserve edges and avoid ringing and aliasing thanks to the trained neural netowk; it's also gonna work with 16bit precision and since it works in 16bit stacked, it's compatible with the normal Avisynth 2.6.1 from 2016.

Cheers,
Frank.
FranceBB is offline   Reply With Quote
Old 16th May 2019, 07:28   #113  |  Link
imsrk48
Registered User
 
imsrk48's Avatar
 
Join Date: Nov 2017
Posts: 154
Quote:
Originally Posted by FranceBB View Post
According to the comparison screenshots they posted on their websites, it looks like a decent upscaling kernel vs PointResize.



I think that you can achieve something like this by using a decent upscaling kernel yourself, especially in combination with NNEDI and 16bit precision to get better results.

Start with something like:

Code:
nnedi3_rpow2(cshift="Spline64Resize", rfactor=2, fwidth=1920, fheight=1080, nsize=4, nns=4, qual=1, etype=0, pscrn=2, threads=0, csresize=true, mpeg2=true, threads_rs=0, logicalCores_rs=true, MaxPhysCore_rs=true, SetAffinity_rs=false, opt=3)
for 8bit.
If you want more precision, you can use:

Code:
nnedi3_resize16(target_width=1920, target_height=1080, mixed=true, thr=1.0, elast=1.5, nns=4, qual=2, etype=0, pscrn=4, threads=0, tv_range=true, kernel_d="Spline", kernel_u="Spline", taps=6, f_d=1.0, f_u=2.0, sharp=0, lsb_in=true, lsb=true)
It will use more taps for Spline so it will be very sharp, but it will also try to preserve edges and avoid ringing and aliasing thanks to the trained neural netowk; it's also gonna work with 16bit precision and since it works in 16bit stacked, it's compatible with the normal Avisynth 2.6.1 from 2016.

Cheers,
Frank.
Thanks a Lot
imsrk48 is offline   Reply With Quote
Old 25th May 2019, 12:14   #114  |  Link
imsrk48
Registered User
 
imsrk48's Avatar
 
Join Date: Nov 2017
Posts: 154
Please suggest me script for add .png logo on a video.
imsrk48 is offline   Reply With Quote
Old 4th September 2019, 08:00   #115  |  Link
imsrk48
Registered User
 
imsrk48's Avatar
 
Join Date: Nov 2017
Posts: 154
Quote:
Originally Posted by imsrk48 View Post
Please suggest me script for add .png logo on a video.
Anyone Answer Please

Sent from my LG-M700 using Tapatalk
imsrk48 is offline   Reply With Quote
Old 4th September 2019, 08:02   #116  |  Link
imsrk48
Registered User
 
imsrk48's Avatar
 
Join Date: Nov 2017
Posts: 154
Quote:
Originally Posted by FranceBB View Post
According to the comparison screenshots they posted on their websites, it looks like a decent upscaling kernel vs PointResize.



I think that you can achieve something like this by using a decent upscaling kernel yourself, especially in combination with NNEDI and 16bit precision to get better results.

Start with something like:

Code:
nnedi3_rpow2(cshift="Spline64Resize", rfactor=2, fwidth=1920, fheight=1080, nsize=4, nns=4, qual=1, etype=0, pscrn=2, threads=0, csresize=true, mpeg2=true, threads_rs=0, logicalCores_rs=true, MaxPhysCore_rs=true, SetAffinity_rs=false, opt=3)
for 8bit.
If you want more precision, you can use:

Code:
nnedi3_resize16(target_width=1920, target_height=1080, mixed=true, thr=1.0, elast=1.5, nns=4, qual=2, etype=0, pscrn=4, threads=0, tv_range=true, kernel_d="Spline", kernel_u="Spline", taps=6, f_d=1.0, f_u=2.0, sharp=0, lsb_in=true, lsb=true)
It will use more taps for Spline so it will be very sharp, but it will also try to preserve edges and avoid ringing and aliasing thanks to the trained neural netowk; it's also gonna work with 16bit precision and since it works in 16bit stacked, it's compatible with the normal Avisynth 2.6.1 from 2016.

Cheers,
Frank.
How Can I Use This in MeGUI?

Sent from my LG-M700 using Tapatalk
imsrk48 is offline   Reply With Quote
Old 4th September 2019, 10:03   #117  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
How Can I Use This in MeGUI?
Learn how to use Avisynth, then most of your requests could be done by yourself.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 4th September 2019, 11:07   #118  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by imsrk48 View Post
Please suggest me script for add .png logo on a video.
you could try this

Code:
# SomeLogo.avs
# with Avisynth installed, play avs in most any player except VLC.                      # ie, get it working BEFORE try use in MeGUI
Colorbars(Pixel_Type="YV12").KillAudio                                                  # Testing subtstitute for your source video clip as YV12, ie delete line or comment out [insert '#' before line]
#AviSource("D:\Parade.avi").ConvertToYV12

I=ImageSource(".\Imagemagick-logo.png",END=0)                                           # Your Logo in current directory (or specify path)

#####  CONFIG #####
I_Width     = 128                                                                       # Your required width of Logo, multiple of 2
I_HEIGHT    = 96                                                                        # Your required Height of Logo, multiple of 2
LOGO_X      = -20                                                                       # Logo X position
LOGO_Y      = -20                                                                       # Logo Y position
RGT_REL     = True                                                                      # If True then LOGO_X adjusts right aligned, ie LOGO_X=0 is hard against Right hand side)
BOT_REL     = True                                                                      # If True then LOGO_Y adjusts Bottom aligned, ie LOGO_Y=0 is hard against bottom)
OPACITY     = 0.5                                                                       # 0.0 -> 1.0, 0.0=NO LOGO, 1=ALL LOGO
START_FRAME = 25
END_FRAME   = 100                                                                       # 0 = Do Till End of clip
### END CONFIG ###

Assert(I_WIDTH%2==0 &&I_HEIGHT%2==0,"SomeLogo: I_Width and I_Height have to be multiple of 2")
I=(I.Width!=I_WIDTH || I.Height != I_HEIGHT) ? I.Spline36Resize(I_WIDTH,I_HEIGHT) : I   # Resize to required
I=I.ConvertToYV12                                                                       # Same As Source clip
END_FRAME = (END_FRAME==0) ? Framecount-1 : END_FRAME
LOGO_X = (RGT_REL) ? (Width -I.Width  + LOGO_X) : LOGO_X
LOGO_Y = (BOT_REL) ? (Height-I.Height + LOGO_Y) : LOGO_Y
MASK=I.BlankClip(Color_YUV=$FF8080)                                                     # Solid White (just dummy for ApplyRange really)

(START_FRAME==0 && END_FRAME==FrameCount-1)
    \ ? Last.Overlay(I,x=LOGO_X,y=LOGO_Y,Opacity=OPACITY)
    \ : Last.ApplyRange(START_FRAME,END_FRAME,"Overlay",I,LOGO_X,LOGO_Y,MASK,OPACITY)

#return last.info                                                                        # Uncomment for TESTING

EDIT: Mod
Code:
# SomeLogo.avsi # Put in Avisynth Plugins AND MeGUI Plugins (NOTE, AVSI)
Function SomeLogo(clip c,clip Img,Int "I_Width",Int "I_Height",Int "Logo_X",Int "Logo_Y",Bool "Rgt_Rel",Bool "Bot_Rel",Float "Opacity",Int"Start_Frame",Int "End_Frame") {
    c                                                  # Last = c
    I_Width     = Default(I_Width, img.Width)          # Default original Image Width
    I_Height    = Default(I_Height,img.Height)         # Default original Image Height
    Logo_X      = Default(Logo_X,0)                    # Default 0
    Logo_Y      = Default(Logo_Y,0)                    # Default 0
    Rgt_Rel     = Default(Rgt_rel,False)               # Default False
    bot_Rel     = Default(bot_rel,False)               # Default False
    Opacity     = Default(Opacity,1.0)                 # Default 1.0, ALL image
    Start_Frame = Default(Start_Frame,0)               # Default frame 0
    End_Frame   = Default(End_Frame,0)                 # Default 0 = LAST FRAME
    Assert(I_WIDTH%2==0 &&I_HEIGHT%2==0,"SomeLogo: I_Width and I_Height have to be multiple of 2")
    Img=(Img.Width!=I_WIDTH || Img.Height != I_HEIGHT) ? Img.Spline36Resize(I_WIDTH,I_HEIGHT) : Img   # Resize to required
    Img=Img.ConvertToYV12                                                                             # Same As Source clip
    END_FRAME = (END_FRAME==0) ? Framecount-1 : END_FRAME
    LOGO_X = (RGT_REL) ? (Width -Img.Width  + LOGO_X) : LOGO_X
    LOGO_Y = (BOT_REL) ? (Height-Img.Height + LOGO_Y) : LOGO_Y
    MASK=Img.BlankClip(Color_YUV=$FF8080)                                                             # Solid White (just dummy for ApplyRange really)

    (START_FRAME==0 && END_FRAME==FrameCount-1)
        \ ? Last.Overlay(Img,x=LOGO_X,y=LOGO_Y,Opacity=OPACITY)
        \ : Last.ApplyRange(START_FRAME,END_FRAME,"Overlay",Img,LOGO_X,LOGO_Y,MASK,OPACITY)
    Return Last
}
# END SomeLogo.avsi    # For initial testing, can have above function in this test script, when move above to avsi in plugins, then remove above from this script.


# Your script calling the function in plugins [ someLogo.avsi : SomeLogo() ]
# with Avisynth installed, play avs in most any player except VLC.                      # ie, get it working BEFORE try use in MeGUI
Colorbars(Pixel_Type="YV12").KillAudio                                                  # Testing subtstitute for your source video clip as YV12, ie delete line or comment out [insert '#' before line]
#AviSource("D:\Parade.avi").ConvertToYV12

Img=ImageSource(".\Imagemagick-logo.png",END=0)                                         # Your Logo in current directory (or specify path)

#####  CONFIG #####
I_Width     = 128                                                                       # Your required width of Logo, multiple of 2
I_HEIGHT    = 96                                                                        # Your required Height of Logo, multiple of 2
LOGO_X      = -20                                                                       # Logo X position
LOGO_Y      = -20                                                                       # Logo Y position
RGT_REL     = True                                                                      # If True then LOGO_X adjusts right aligned, ie LOGO_X=0 is hard against Right hand side)
BOT_REL     = True                                                                      # If True then LOGO_Y adjusts Bottom aligned, ie LOGO_Y=0 is hard against bottom)
OPACITY     = 0.5                                                                       # 0.0 -> 1.0, 0.0=NO LOGO, 1=ALL LOGO
START_FRAME = 25
END_FRAME   = 100                                                                       # 0 = Do Till End of clip
### END CONFIG ###

SomeLogo(Img,I_Width=I_WIDTH,I_Height=I_HEIGHT,Logo_X=LOGO_X,Logo_Y=LOGO_Y,Rgt_Rel=RGT_REL,Bot_Rel=BOT_REL,Opacity=OPACITY,Start_Frame=START_FRAME,End_Frame=END_FRAME)
#SomeLogo(Img,128,96,Opacity=0.5,Start_Frame=25,End_Frame=100)                          # Logo_X, Logo_Y,Rgt_Rel, Bot_rel, ALL DEFAULT ::: ALL CONFIG part can be missed out
#SomeLogo(Img,128,96,-20,-20,true,true,0.5,0,100)                                       # ALL CONFIG part can be missed out

#return last.info                                                                       # Uncomment for TESTING
EDIT: So with SomeLogo.avsi in plugins, can use just like so:-
Code:
Colorbars(Pixel_Type="YV12").KillAudio                                                  # Testing subtstitute for your source video clip as YV12, ie delete line or comment out [insert '#' before line]
Img=ImageSource(".\Imagemagick-logo.png",END=0)                                         # Your Logo in current directory (or specify path)
SomeLogo(Img,128,96,-20,-20,true,true,0.5,0,100)                                        # ALL CONFIG part can be missed out
#SomeLogo(Img,I_Width=128,I_Height=96,Logo_X=-20,Logo_Y=-20,Rgt_Rel=True,Bot_Rel=True,Opacity=0.5,Start_Frame=0,End_Frame=100) #  ALL CONFIG part can be missed out
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 5th September 2019 at 14:59.
StainlessS is offline   Reply With Quote
Old 5th September 2019, 02:44   #119  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 985
Is it possible to get path to avisyth.dll in use from avs script? Maybe invoke some error with try and catch?
VoodooFX is offline   Reply With Quote
Old 5th September 2019, 14:32   #120  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
VDX, Think that is best in realm of Groucho2004 SysInfo plug [if/when implemented], G2K4 has code to get real path to system32/sysWOW64, and I think it was a bit tricky to achieve
as system tries to make everything [x86 or x64] seem to appear in system32. (Of course it may not even be in system32, could be in eg MeGUI folder or whatever).

Maybe ask G2K4 bout it, he's a nice fella and if you beg sufficiently well [bit of praise also works I hear], then maybe he do it. [EDIT: Refer to him as "My Leader", I believe he likes that]

EDIT: Also note, RT_Stats GetSystemEnv thing (or other GetSystemEnv type plugs) for eg "COMSPEC" return path to eg "d:\Windows\system32\Cmd.exe",
as that is how is set in system environment, even though it may really be in sysWOW64. So, if you need real path, G2K4 is the man that can.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 5th September 2019 at 15:23.
StainlessS is offline   Reply With Quote
Reply

Tags
avisynth, faq

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:38.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.