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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th December 2020, 00:35   #161  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Here is the answer,

Code:
SZ=20
BlankClip(width=80,height=360).Trim(0,-1)
For(n=$80,$8F) {
    s = RT_String("$%02X %s",n,Chr(n))
RT_DebugF("%s",S)
    Subtitle(s,font="Courier New",size=SZ,y=(n-$80)*SZ)
}

Return  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 ???
StainlessS is offline   Reply With Quote
Old 9th December 2020, 03:26   #162  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
OK, This should produce (more or less) good results whatever charset.
We have fixed numbers (sizes) so that both Courier New and WingDings fonts look OK-ish.

Code:
########
# Mod ADD_Y and ADD_X to give more or less spacing to characters in Characterset grid (at least 0)

###############          Try eg SIZE_Y=40 SIZE_X=32 ADD_Y=0 ADD_X=32
SIZE_Y   = 20          # Font size (For Hex Numbers)
SIZE_X   = 16          # Font size (For Hex Numbers [actually spacing allotted])
ADD_Y    = 0           # Additional vertical spacing for character grid (over and above hex number font)
ADD_X    = 16          # Additional horizontal spacing for character grid (over and above hex number font)
CELL_H  = SIZE_Y+ADD_Y # Character Box Height
CELL_W  = SIZE_X+ADD_X # Character Box Width (Adjust for font)
VLINE_W = 2            # Vertical grid lines thickness
HLINE_H = 2            # Horizontal grid lines thickness
LINECOL =$808080       # grid color
BORDCOL= $FF0000       # outer lines color
#Font = "Courier New"   # Character set Font name (Numbers always done in "Courier New")
Font = "WingDings"
#Font = "Symbol"
#Font = "OpenSymbol"
#Font = "Times New Roman"
#Font = "WebDings"
#######################
HexDigit = "0123456789ABCDEF"
T=BlankClip(Length=1,width=CELL_W,height=CELL_H)

# Do Character Set grid
for(y=0,15) {
    For(x=0,15) {
        n = y * 16 + x
        char  = Chr(n)
        charC = T.Subtitle(char,font=FONT,size=SIZE_Y)
        xclip = (x==0) ? charC : xclip.StackHorizontal(charC.AddBorders(VLINE_W,0,0,0,LINECOL))
    }
    CHARSET = (y==0) ? xclip : CHARSET.StackVertical(xclip.AddBorders(0,HLINE_H,0,0,LINECOL))
}
#return charset

# Vertical Hex Numbers
TV=T.BlankClip(Width=SIZE_X*3)
for(y=0,15) {
    numC  = TV.Subtitle("$"+HexDigit.MidStr(y+1,1)+"0",font="Courier New",size=SIZE_Y)
    yNumC = (y==0) ? numC : yNumC.StackVertical(numC.Addborders(0,HLINE_H,0,0,LINECOL))
}
#return yNumC

for(x=0,15) {
    numC  = T.Subtitle(HexDigit.MidStr(x+1,1),font="Courier New",size=SIZE_Y)
    xNumC = (x==0) ? numC : xNumC.StackHorizontal(numC.Addborders(VLINE_W,0,0,0,LINECOL))
}
#return xNumC

yNumC = yNumC.AddBorders(0,0,VLINE_W,0,LINECOL) # Line between vertical numbers and charset
xNumC = xNumC.AddBorders(0,0,0,HLINE_H,LINECOL) # Line between horizontal numbers and charset

Corner= T.BlankClip(Width=SIZE_X*3).AddBorders(0,0,VLINE_W,HLINE_H,LINECOL) # Top LHS corner

TOP   = Corner.StackHorizontal(xnumC)
BOT   = yNumC.StackHorizontal(CHARSET)
StackVertical(TOP,BOT)                          # Glue the whole lot together

AddBorders(VLINE_W,HLINE_H,VLINE_W,HLINE_H,BORDCOL)  # Add Outer border

Return  Last

Font = "Courier New"


Font = "WingDings"


Win7 Symbol


Win7 OpenSymbol


Font = "Times New Roman"


Font = "WebDings"


Font ="WingDings" # BIG with mods
Code:
SIZE_Y   = 40          # Font size (For Hex Numbers)
SIZE_X   = 32          # Font size (For Hex Numbers [actually spacing allotted])
ADD_Y    = 0           # Additional vertical spacing for character grid (over and above hex number font)
ADD_X    = 32          # Additional horizontal spacing for character grid (over and above hex number font)


WebDings Big


Spot any more probs Wonkey ?

EDIT:We seem to have a "Bullet" at chr(7) [Bell control code character] in both Courier New and Wingdings.
__________________
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; 9th December 2020 at 05:55.
StainlessS is offline   Reply With Quote
Old 9th December 2020, 05:23   #163  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
Quote:
Originally Posted by wonkey_monkey View Post
Or you change the encoding of your script in your text editor to "UTF-8 no BOM" and type or copy/paste directly into your script:

Code:
subtitle("•", utf8 = true)
Or change the Windows 10 system locale to UTF-8 and drop the utf8=true parameter, because it's not necessary in that scenario (this tactic works with 2.6 as well).
qyot27 is offline   Reply With Quote
Old 9th December 2020, 06:06   #164  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Previous post removed RT_Stats requirement, only AVS+ required.

Converterted to Function, might want to create muiltiple example font frames.

eg SubtitleCharacterSet("Symbol") ++ SubtitleCharacterSet("webdings")++SubtitleCharacterSet("Times New Roman")

SubtitleCharacterSet.avsi
Code:
# SubtitleCharacterSet.avsi

/*
    SubtitleCharacterSet() ::: by StainlessS @ https://forum.doom9.org/showthread.p...08#post1930308

    Req Avs+

    Produces an RGB32 single frame showing characterset for a particular Subtitle font, in Hex/ASCII table.

    SubtitleCharacterSet(
        String Font,            [* Font Name, Not Optional, Default Arial if "" or invalid font *]
        Int "Size_y" =20,       [* Height of Hex numbers [Courier New) *]
        Int "Size_X" =16,       [* Width of Hex numbers  [Courier New) *]
        Int "Add_Y"  =0,        [* Vertical  Spacing to add for Font characterset, over and obove that allotted for Hex Numbers *]
        Int "Add_X"  =16,       [* Hoizontal Spacing to add for Font characterset, over and obove that allotted for Hex Numbers *]
        Int "VLine_W"=2,        [* Width of Vertical lines in grid    *]
        Int "HLine_H"=2,        [* Height of Horizontal lines in grid *]
        Int "LineCol"=$808080,  [* Color of Lines in grid *]
        Int "BordCol"=$FF0000,  [* Color of border line   *]
        Bool "Title "=True      [* Show Font title on top of frame *]
        )

    eg
        SubtitleCharacterSet("Arial")
        SubtitleCharacterSet("Courier New")
        SubtitleCharacterSet("Symbol")
        SubtitleCharacterSet("OpenSymbol")
        SubtitleCharacterSet("Times New Roman")
        SubtitleCharacterSet("WebDings")
        SubtitleCharacterSet("WingDings")
        SubtitleCharacterSet("WebDings" ,Size_Y=40,Size_X=32,Add_Y=0,Add_X=32)
        SubtitleCharacterSet("WingDings",Size_Y=40,Size_X=32,Add_Y=0,Add_X=32)
        SubtitleCharacterSet("Symbol") ++ SubtitleCharacterSet("webdings")++SubtitleCharacterSet("Times New Roman")

*/

Function SubtitleCharacterSet(String Font,Int "Size_y",Int "Size_X",Int "Add_Y",Int "Add_X",
        \ Int "VLine_W", Int "HLine_H",
        \ Int "LineCol",Int "BordCol",
        \ Bool "Title"
        \ ) {
    Size_Y  = Default(Size_Y,20)
    Size_X  = Default(Size_X,16)
    Add_Y   = Default(Add_Y, 0)
    Add_X   = Default(Add_X, 16)
    VLine_W = Default(VLine_W,2)
    HLine_H = Default(HLine_H,2)
    LineCol = Default(LineCol,$808080)
    BordCol = Default(BordCol,$FF0000)
    Title   = Default(Title,True)
    #
    CELL_H  = SIZE_Y+ADD_Y # Character Box Height
    CELL_W  = SIZE_X+ADD_X # Character Box Width (Adjust for font)
    T=BlankClip(Length=1,width=CELL_W,height=CELL_H)
    HexDigit = "0123456789ABCDEF"
    # Do Character Set grid
    for(y=0,15) {
        For(x=0,15) {
            n = y * 16 + x
            char  = Chr(n)
            charC = T.Subtitle(char,font=FONT,size=SIZE_Y)
            xclip = (x==0) ? charC : xclip.StackHorizontal(charC.AddBorders(VLINE_W,0,0,0,LINECOL))
        }
        CHARSET = (y==0) ? xclip : CHARSET.StackVertical(xclip.AddBorders(0,HLINE_H,0,0,LINECOL))
    }
    # Vertical Hex Numbers
    TV=T.BlankClip(Width=SIZE_X*3)
    for(y=0,15) {
        numC  = TV.Subtitle("$"+HexDigit.MidStr(y+1,1)+"0",font="Courier New",size=SIZE_Y)
        yNumC = (y==0) ? numC : yNumC.StackVertical(numC.Addborders(0,HLINE_H,0,0,LINECOL))
    }
    for(x=0,15) {
        numC  = T.Subtitle(HexDigit.MidStr(x+1,1),font="Courier New",size=SIZE_Y)
        xNumC = (x==0) ? numC : xNumC.StackHorizontal(numC.Addborders(VLINE_W,0,0,0,LINECOL))
    }
    yNumC = yNumC.AddBorders(0,0,VLINE_W,0,LINECOL) # Line between vertical numbers and charset
    xNumC = xNumC.AddBorders(0,0,0,HLINE_H,LINECOL) # Line between horizontal numbers and charset
    Corner= T.BlankClip(Width=SIZE_X*3).AddBorders(0,0,VLINE_W,HLINE_H,LINECOL) # Top LHS corner
    TOP   = Corner.StackHorizontal(xnumC)
    BOT   = yNumC.StackHorizontal(CHARSET)
    StackVertical(TOP,BOT)                          # Glue the whole lot together
    AddBorders(VLINE_W,HLINE_H,VLINE_W,HLINE_H,BORDCOL)  # Add Outer border
    (TITLE)
        \ ? Last.BlankClip(Height=SIZE_Y).StackVertical(Last).Subtitle(Font,font="Courier New",size=SIZE_Y).AddBorders(VLINE_W,HLINE_H,VLINE_W,0,BORDCOL)
        \ : Last
    Return  Last
}
EDIT: Added in BLUE
Code:
[* Font Name, Not Optional, Default Arial if "" or invalid font *]
EDIT:
script with the SubtitleCharacterSet.avsi in plugins.
Code:
StackVertical(SubtitleCharacterSet("Symbol"),SubtitleCharacterSet("webdings"))



EDIT: UK NumberPlate font (Charles Write font):- https://forum.doom9.org/showpost.php...8&postcount=25
See StainlessS below in sig, DATA folder for font.
__________________
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; 8th March 2021 at 21:04.
StainlessS is offline   Reply With Quote
Old 9th December 2020, 08:42   #165  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,070
Well - I see I am lucky to have 'bullet' symbol in typically lower bytes like Chr(7) or Chr($95). But I usually use simplest and I think ANSI text editor from FAR file manager and think there were way to enter multi-byte characters by its codes to text if we have functions like utf8=true in rasterizer and some convert like StrToUTF8().

Like:
1. Create empty string.
2. Convert it to UTF8 so it is now treated as UTF8 encoded string.
3. + (add) to it our required char code like +CHR($2022).
4. Use it in Subtitle.

So to use UTF-8 symbols and strings we need to operate avisynth script as UTF-8 encoded file ? And from 8-bit ANSI text files we can call only 256-symbols part of fonts ?

Last edited by DTL; 9th December 2020 at 08:50.
DTL is offline   Reply With Quote
Old 9th December 2020, 15:17   #166  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
You can enter multibyte characters using CHR, but you have to use the UTF-8 encoding (0xE2 0x80 0xA2), not the Unicode code point (0x2022).

Code:
... + chr($E2) + chr($80) + chr($A2) ...
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 9th December 2020, 16:30   #167  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,070
Quote:
Originally Posted by wonkey_monkey View Post
You can enter multibyte characters using CHR, but you have to use the UTF-8 encoding (0xE2 0x80 0xA2), not the Unicode code point (0x2022).

Code:
... + chr($E2) + chr($80) + chr($A2) ...
Oh - now I undrstand. It is Ms Word that shows in the single window named 'code word' 0x95 for ASCII hex 'bullet' and unicode hex 0x2022 for the Unicode 'bullet', but they are very different numbers. And I need to found somewhere convertor of 'Unicode code point' into real byte sequence to enter it using CHR().
DTL is offline   Reply With Quote
Old 9th December 2020, 20:13   #168  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I'm guessin' that MidStr() et al cannot cope with UTF-8. [?]
__________________
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 30th December 2020, 17:29   #169  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,070
Because this forum is mostly about moving pictures I finally made script for creating source data for testing resizers. Based on the 'bullet' symbol because it is closer to 'elementary moving picture object' like elementary 'dot'.

Code:
function SourceObject(clip c, float fArg)
{
 xpos_rot = c.width/3+(10*Sin(Pi()*fArg/(50)))
 ypos_rot = c.width/3-(10*Cos(Pi()*fArg/(50)))
  
 xpos_diag = c.width*2/3+(10*Sin(Pi()*fArg/(50)))
 ypos_diag = c.width*2/3-(10*Sin(Pi()*fArg/(50)))
  
 xpos_h = c.width*2/3+(10*Sin(Pi()*fArg/(50)))
 ypos_h = c.width/3
  
 xpos_v = c.width/3
 ypos_v = c.width*2/3+(10*Sin(Pi()*fArg/(50)))
  
 ch_size = (Int(fArg/100))+1
  
 xpos_rot_i=Int(xpos_rot)
 ypos_rot_i=Int(ypos_rot)
  
 xpos_diag_i=Int(xpos_diag)
 ypos_diag_i=Int(ypos_diag)
  
 xpos_h_i=Int(xpos_h)
 ypos_h_i=Int(ypos_h)
  
 xpos_v_i=Int(xpos_v)
 ypos_v_i=Int(ypos_v)
  
 c=Subtitle(c, CHR($95),font="Arial",size=ch_size,x=xpos_rot_i,y=ypos_rot_i,halo_color=$FF000000, text_color=$00e0e0e0)
 c=Subtitle(c, CHR($95),font="Arial",size=ch_size,x=xpos_diag_i,y=ypos_diag_i,halo_color=$FF000000, text_color=$00e0e0e0)
 c=Subtitle(c, CHR($95),font="Arial",size=ch_size,x=xpos_h_i,y=ypos_h_i,halo_color=$FF000000, text_color=$00e0e0e0)
 c=Subtitle(c, CHR($95),font="Arial",size=ch_size,x=xpos_v_i,y=ypos_v_i,halo_color=$FF000000, text_color=$00e0e0e0)
  
 return c
  
}
  
BlankClip(30000,800,800,"RGB24",25,color=$00202020)
  
Animate(last, 0,30000,"SourceObject",  0,  30000)
  
ConvertToYV24()
  
# production-downsizing
#SinPowResizeMT(last,width/10,height/10,p=2.6)
GaussResize(last,width/10,height/10,p=12)
#JincResize(width/10,height/10,tap=5)
#LanczosResizeMT(last,width/10,height/10,taps=8)
  
#restoring vewing-upsizing
#SincLin2ResizeMT(width*8,height*8,taps=8)
SincResize(width*8,height*8,taps=5)
#JincResize(width*8,height*8,tap=5)
  
#Levels(25, 1, 55, 0, 255) # can be used for better viewing of processing errors
It feeds to resizers the number of test objects at various positions with step about 0.1 of sampling grid size and size of object with 0.1 step. After getting good result with one dot - other more complicated symbols may be tested.
DTL is offline   Reply With Quote
Old 8th March 2021, 21:05   #170  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Added UK Numberplate font image to post #164.
Also added font in zip, StainlessS@MediaFire in sig, DATA folder.
__________________
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; 9th March 2021 at 13:42.
StainlessS is offline   Reply With Quote
Old 28th April 2021, 12:53   #171  |  Link
GAP
Registered User
 
Join Date: Sep 2020
Posts: 135
What is a good way to practice making these scripts? Someone recommend another method to resize videos and they suggested that I use a AVISynth script to do that. Can anyone tell what is a good way to start? Or even have a dictionary/guide/etc. to get em started?
GAP is offline   Reply With Quote
Old 28th April 2021, 16:12   #172  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Where it says "New To Avisynth - Start Here"
http://avisynth.nl/index.php/Main_Page
__________________
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 2nd May 2021, 07:34   #173  |  Link
GAP
Registered User
 
Join Date: Sep 2020
Posts: 135
Can you have AVIsynth and AVISynth + on the same computer?
GAP is offline   Reply With Quote
Old 2nd May 2021, 11:48   #174  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Can you have AVIsynth and AVISynth + on the same computer?
Yes but only one can be "Active" at any one time [can have x86 and x64 at same time)
Universal Avisynth Installer:- https://forum.doom9.org/showthread.php?t=172124
Easy to switch, just execute the CMD file, and select which version you want to activate.

where both x86 and x64 active, use eg VDub2 x86 for x86 AVS, and VDub2 x64 for x64 AVS.

x86 VD2 requires x86 Avisynth and x86 plugins, x64 VD2 requires x64 Avisynth and x64 plugins.
__________________
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; 2nd May 2021 at 11:52.
StainlessS is offline   Reply With Quote
Old 1st June 2021, 07:27   #175  |  Link
GAP
Registered User
 
Join Date: Sep 2020
Posts: 135
Does anyone here have an AVISynth "cheat sheet"? I am not looking for anything complicated,just something simple that I can use to get me started.
GAP is offline   Reply With Quote
Old 1st June 2021, 12:00   #176  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by GAP View Post
Does anyone here have an AVISynth "cheat sheet"? I am not looking for anything complicated,just something simple that I can use to get me started.
Take a look at the AviSynth wiki page. There's a section on the front page titled "New to AviSynth – Start Here", there you will find lots of good information on how to get started. The guides page should be really helpful.
Reel.Deel is offline   Reply With Quote
Old 2nd June 2021, 09:59   #177  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Quote:
Originally Posted by GAP View Post
Does anyone here have an AVISynth "cheat sheet"? I am not looking for anything complicated,just something simple that I can use to get me started.
Avisynth Wiki - External Filters with the relative documentation: http://avisynth.nl/index.php/External_filters


My personal Avisynth Cheat Sheet to use when I'm too lazy and I just want to copy-paste: https://github.com/FranceBB/FranceBB...visynth-Script
FranceBB is offline   Reply With Quote
Old 2nd June 2021, 11:02   #178  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Thank France
kedautinh12 is offline   Reply With Quote
Old 2nd June 2021, 12:10   #179  |  Link
GAP
Registered User
 
Join Date: Sep 2020
Posts: 135
Thanks from me too.
GAP is offline   Reply With Quote
Old 3rd June 2021, 06:53   #180  |  Link
chmars
Registered User
 
Join Date: Apr 2021
Posts: 127
Thanks
Reel.deel, I had missed the guides page. Nice.
FranceBB, these are super good starting points to experiment from a already working base and learn fast.
chmars is offline   Reply With Quote
Reply

Tags
avisynth, faq


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 11:43.


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