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 3rd June 2023, 09:45   #1  |  Link
Rob105
Registered User
 
Join Date: Oct 2021
Posts: 43
Grid plugin usage.

Grid plugin is very unintuitive, i used manyPlus version for Avisynth+

Usage described here (its same as instruction coming with plugin).

However sf and ef properties do not work, no way to specify grid display to start/end from frame number?

Code:
FFmpegSource2("C:\vid\00007.mp4")
Grid(last, lineint=60, bold=2, vbold=2, color=$cccccc, bcolor=$AA0000, vbcolor=$AAAA00, grid=true, axis=false)
Also if any problem it simply shows error File "Grid.avs" does not have a video stream., not saying what the problem is, so troubleshooting is close to impossible.

Last edited by Rob105; 3rd June 2023 at 10:35.
Rob105 is offline   Reply With Quote
Old 3rd June 2023, 13:40   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
V.C Mohan aint been around since Aug 2022.
You could try PM him, and/or email him, see http://www.avisynth.nl/users/vcmohan/vcmohan.html

V.C, is I think 80+ Y.O, you may not be successful.

From an Old source for grid that I have, [EDIT: AvisynthPluginInit2, ie avisynth 2.58]
Code:
// Calls the constructor with the arguments provied.
}
// The following function is the function that actually registers the filter in AviSynth
// It is called automatically, when the plugin is loaded to see which functions this filter contains.
/*
extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env)
{
    env->AddFunction("Grid", "cii[lineint]i[bold]i[vbold]i[color]i[bcolor]i[vbcolor]i[grid]b[axis]b", Create_Grid, 0);
				
    return "Grid  Plugin";
}

*/
the 'sf' and'ef' args [ii in red] are NOT optional, however that whole block is commented out using "/* ... */" style comments, perhaps came from some other
dll source which had Grid() as one of many functions.

Source linked for separate Grid() plugin on Wiki uses this
Code:
    env->AddFunction("Grid", "c[sf]i[ef]i[lineint]i[bold]i[vbold]i[color]i[bcolor]i[vbcolor]i[grid]b[axis]b", Create_Grid, 0);
which shows both 'sf' and 'ef' args as optional.

Looks to me like current wiki dll (ii, not optional, "Grid Does not have a named argument 'sf'") and current wiki source ([sf]i[ef]i, are optional), not from the same version project.
__________________
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; 3rd June 2023 at 14:44.
StainlessS is offline   Reply With Quote
Old 3rd June 2023, 17:15   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Further to above.

Comments in above post for 21 Mar 2017 x64 version.
The later 25 June 2020, Grid_2_6.zip is x86 only, no x64 version.

I'll try to rejig versions for v2.58, v2.6, v2.6 Avs+ x86 and x64. (just incase V.C. does not make a show)
__________________
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 June 2023, 01:29   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
OK, maybe this of use, maybe not.
Grid_25.dll, Avs v2.58 colorspaces only.
Grid_x86.dll, Avs v2.6 Std 8 bit colorspaces only, except YV411.
Grid_x64.dll, Avs v2.6 Std 8 bit colorspaces only, except YV411.

https://www.mediafire.com/file/fn08y...230604.7z/file

Fixed a couple of very minor bugs.

Txt file, Included in zip,
Code:
Supports All 8 bit AVS26 colorspaces except YV411. [x86 and x64 dll's, _25 dll is AVS v2.58 colorspace only]

NOTE, despite ManyPlus version docs of Grid, it has had Sf, Ef args removed [StartFrame, EndFrame]. [EDIT: Sf, Ef OK in this version]
Grid dll FilterName Grid() will conflict with ManyPlus Grid() Filter.
[Can call via Grid_Grid() or ManyPlus_Grid() to avoid conflict]
I'm not setup for v2019+ VS compiler, and have yet to figure out how the new stuff works for Frame Properties etc,
and would take me some time to get up to speed, so above is only for 8 bit AVS v2.6 Std Colorspaces.

Also Note, ManyPlus Grid(), will crash on YV411. [presumably the older versions of Grid() will do too]

EDIT: ONLY VERY BRIEF testing and only on x64 version, original source used was AVS 2.6 std colorspace only, the x86 Grid_2_6 source code. [incl in zip]
Report any problems.

EDIT: Added Version Resource to the dll's as below.

Assigned a version of 2.0.0, V.C, tended to just give a date or AVS version eg 2.6 for Avs v2.6.
__________________
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; 4th June 2023 at 01:53.
StainlessS is offline   Reply With Quote
Old 5th June 2023, 07:54   #5  |  Link
Rob105
Registered User
 
Join Date: Oct 2021
Posts: 43
Quote:
Originally Posted by StainlessS View Post
Report any problems.
Thanks for follow up, i did not manage to make your plugin work at all, removed all old versions and installed your DLL.

How i meant to call it Grid_Grid or Grid? Neither one work both x86 and 64bit versions.

P.S. I am not good with color spaces and YUV etc, perhaps it was an issue, but i used uncompressed AVI and same problem, it don't work.
Rob105 is offline   Reply With Quote
Old 5th June 2023, 13:24   #6  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Hi. I am 89 years old. I do check occassionally if there are any messages to me.
Grid function is now part of ManyPlus plugin. Long time back I used to provide facility to start at a specified frame and end at a specified frame. I have removed all such facilities as I found no other plugin provides such. Also that can be achieved by use of Trim and + in the avisynth+ script.
As I did not find any user observations on any of my plugin functions I am thinking of announcing my disappearance from this Forum, but now I may continue for one more year.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 5th June 2023, 18:27   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Hi V.C., nice to see that you're still kicking around
The occasional filter does allow for start and end frame, but not that many, I guess its no great loss and you can use Trim() as you say.

Here is my recompile update for bugfix, had copy/paste error.
I've left the sf,ef args alone, I want a separate version of your Grid() for myself anyway [Probably why I had the source from the ManyPlus whotsit].
Perhaps I could rename so as not to confilct with ManyPlus version, maybe Graticule() or something.

NOTE, In Grid() example on Wiki, this is bugged
Code:
Grid(last,24,200,25,4,5,$ff0000,$7f0000,$5f0000,true,false)
In red MUST be even, so I changed it in the included HTML to 24.
Also added a "$" before RRGGBB in HTML docs, result = "specified as $RRGGBB"

Sorry Rob105, cocked up the plug, below update to v2.01 fixed.

https://www.mediafire.com/file/5vz9m...230605.7z/file

Included in AVS folder.
Code:
/*
     Grid (clip, int "sf"=0, int "ef"=FrameCount-1, int "lineint"=10, int "bold"=5, int "vbold"=2, int "color"=$000000, int "bcolor"=color, int "vbcolor"=color, bool "grid"=true, bool "axis"=false)

        int     sf, Default 0.                  display to start from frame number.
        int     ef, Default last frame of clip. display to end on frame number.
        int     lineint, Default 10.            Line (dotted) interval in pixels. Must be Even AND >= 4, AND <= Height/4 AND <= width/4.
        int     bold, Default 5.                At least 1. Bold line every nth grid line.
        int     vbold, Default 2.               At least 1. Very bold line every nth bold grid line.
        int     color, Default $000000.         Color of grid line.
        int     bcolor, Default color.          Color of bold line.
        int     vbcolor, Default color.         Color of very bold line.
        bool    grid, Default true.             Whether grid lines to be displayed.
        bool    axis, Default false.            Whether axis lines to be displayed.

*/

BlankClip(Color=$FFFFFF)
#ColorBars(Pixel_Type="YV12")		# Alternative

ShowFrameNumber 

SF          = 0
EF          = 99        # End @ Frame 99
LINEINT     = 10
BOLD        = 5
VBOLD       = 2
COLOR       = $000000
BCOLOR      = $FF0000
VBCOLOR     = $0000FF
SHOWGRID    = True
SHOWAXIS    = False


Grid(last,sf=SF,ef=EF,lineint=LINEINT,bold=BOLD,vbold=VBOLD,color=COLOR,bcolor=BCOLOR,vbcolor=VBCOLOR,grid=SHOWGRID,axis=SHOWAXIS)
__________________
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 6th June 2023, 01:51   #8  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
@Stainless, can you change the name of plugin and upload to mediafire again?? Thanks
kedautinh12 is offline   Reply With Quote
Old 6th June 2023, 02:07   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
What you want to call it ?
__________________
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 6th June 2023, 02:43   #10  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
Gridstain()
kedautinh12 is offline   Reply With Quote
Old 6th June 2023, 05:35   #11  |  Link
Rob105
Registered User
 
Join Date: Oct 2021
Posts: 43
Hi guys, i actually ended up using importing Grid plugin from VirtualDub, because in Avisynth grid plugin has lines that are too thick i just need 1px width solid line, dotted lines i don't like.

If you continue to develop this plugin, please add opacity right now its too bold and covers video frame too much.

Last edited by Rob105; 10th June 2023 at 15:07.
Rob105 is offline   Reply With Quote
Old 10th June 2023, 14:28   #12  |  Link
Rob105
Registered User
 
Join Date: Oct 2021
Posts: 43
I run into some interesting bug with Grid Plugin all versions from Avisynth Wiki.

Also 64Bit version of plugin does not even open at all.


PHP Code:
v1 FFmpegSource2("c:\vid\myvid.mp4")

ruller_vert ImageSource("c:\vid\Ruller-1920px.png").crop(0,0,1080,0).TurnRight.ConvertToYV12()

v1 StackHorizontal(ruller_vertv1ruller_vert
Attached Images
 

Last edited by Rob105; 10th June 2023 at 15:06.
Rob105 is offline   Reply With Quote
Old 10th June 2023, 17:10   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Well, that looks like a problem with your video source filter, try LSMashVideoSource as it is an ISO (mp4) file.
Source filter seems to have a problem determining the width of your mp4 file.

(Nothing to do with Grid() at all, not even mentioned in your script).
Good idea to find out what the problem is, ie, is it your mp4, or is it your png,
I expect that it is your mp4.
Just insert a "return v1" immediately after ffmpesource2 thingy, I expect it looks weird.

EDIT:
Your png image could take some time for mods to get around to, suggest post on image host site,
eg PostImage.org:- https://postimages.org/
No account necessary, and no time limit before deletion [unless you set one, I think].

Use either "Thumbnail for Forum", or maybe "Image" or similar "for Forum", then paste the link.
__________________
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; 10th June 2023 at 17:18.
StainlessS is offline   Reply With Quote
Old 11th June 2023, 04:03   #14  |  Link
Rob105
Registered User
 
Join Date: Oct 2021
Posts: 43
Quote:
Originally Posted by StainlessS View Post
Well, that looks like a problem with your video source filter, try LSMashVideoSource as it is an ISO (mp4) file.
Source filter seems to have a problem determining the width of your mp4 file.

(Nothing to do with Grid() at all, not even mentioned in your script).
Good idea to find out what the problem is, ie, is it your mp4, or is it your png,
I expect that it is your mp4.
Just insert a "return v1" immediately after ffmpesource2 thingy, I expect it looks weird.


EDIT:
Your png image could take some time for mods to get around to, suggest post on image host site,
eg PostImage.org:- https://postimages.org/
No account necessary, and no time limit before deletion [unless you set one, I think].

Use either "Thumbnail for Forum", or maybe "Image" or similar "for Forum", then paste the link.
You saying image i attached to post not showing because not been approved by moderators yet?

Image https://postimg.cc/rzZ9fMxB

Video https://www.upload.ee/files/15325751...GINAL.mp4.html
Rob105 is offline   Reply With Quote
Old 11th June 2023, 09:04   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
There is something wrong with your video source ie ffmpegsource2, suspect an old version.

This works fine here with my ffmpegsource2 or LSmashVideoSource.

Also note the method of being able to return result at any stage of the script, and therefore being able to debug your own script easy.
(better than throwing your hands into the air and screaming, "it dont work").

Code:
#v1 = FFmpegSource2("c:\vid\myvid.mp4")
#ruller_vert = ImageSource("c:\vid\Ruller-1920px.png").crop(0,0,1080,0).TurnRight.ConvertToYV12()
#v1 = StackHorizontal(ruller_vert, v1, ruller_vert)

#v1 = FFmpegSource2(".\00005_ORIGINAL.mp4")             # works fine for me
v1 = LSMashVideoSource(".\00005_ORIGINAL.mp4")          # so does this
#Return v1                                              # 1920x1080 (50 fps)

ruller_H = ImageSource(".\Ruller-1920px.png",End=0)     # END=0, = single frame, else END=1000 by default with result of 1001 frames
#Return ruller_H                                         # 1920x18

ruller_H = ruller_H.crop(0,0,1080,0)                    # Make width same as v1.height
#Return ruller_H                                         # 1080x18

ruller_vert = ruller_H.TurnRight
#Return ruller_vert                                      # 18x1080

ruller_vert = ruller_vert.ConvertToYV12()
#Return ruller_vert                                      # 18x1080

v2 = v1.Grid()                                           # Apply grid only on video clip
#Return v2

StackHorizontal(ruller_vert, v2, ruller_vert)            # voila
Maybe try this link for ffmpegsource2:- https://forum.doom9.org/showthread.p...60#post1987560

EDIT:
Also, your last line (actually, the script you posted would not work at all and would produce an error message, despite your bad result image)
Code:
v1 = StackHorizontal(ruller_vert, v1, ruller_vert)
Assigns to v1, but does not return anything, you need at end of script, either
Code:
v1   # Implicit Assign v1 to special Last clip, which will be returned by default if no explicit "Return Last".
OR
Code:
Last = v1   # Explicit Assign v1 to special Last clip, which will be returned by default if no explicit "Return Last".
OR
Code:
Return v1
OR as replacement for your "v1 = StackHorizontal(ruller_vert, v1, ruller_vert)", just
Code:
StackHorizontal(ruller_vert, v1, ruller_vert)  # implicit assign to Last clip
__________________
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; 11th June 2023 at 09:50.
StainlessS is offline   Reply With Quote
Old 11th June 2023, 10:49   #16  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Perhaps of use (perhaps not). [not tested too much]

Code:
c  = LSMashVideoSource(".\00005_ORIGINAL.mp4")
rh = ImageSource(".\Ruller-1920px.png",End=0)
rh = rh.levels(32,1.0,128,0,255,false)  # Make rule, a bit more visible.
Apply_RuledGrid(c,rh,true,true)

return last

Function Apply_RuledGrid(clip c, clip rule_h, bool "horiz", bool "Vert",        [* Rule args *]
        \ int "LineInt", int "bold", int "vBold",                               [* Grid Args *]
        \ int "color", int "bcolor",int "vbcolor",                              [* Grid Args *]
        \ bool "Grid", bool "axis")                                             [* Grid Args *]
        \ {
    c
    ConvertToRGB32() # We only support RGB32 output.
    rule_h = rule_h.ConvertToRGB32()
    myName = "Apply_RuledGrid: "
    horiz = Default(horiz,false)
    vert  = Default(vert,true)
    Assert(horiz || vert,myName+"Horiz and vert both false, nothing to do")
    Assert(!horiz || rule_h.width >= c.width,myName+"clip width greater than rule_h width")
    Assert(!vert  || rule_h.width >= c.height,myName+"clip height greater than rule_h width")
    r_h = (!horiz) ? NOP : rule_h.crop(0,0,width ,0)
    r_v = ( !vert) ? NOP : rule_h.crop(0,0,height,0).TurnRight
    #  ALL Grid optionals are defaulted within Grid plugin, not here.
    g = Grid(LineInt=LineInt,bold=bold,vBold=vBold,color=color,bcolor=bcolor,vbcolor=vbcolor,Grid=Grid,axis=axis)
    corner = (horiz && vert) ? Last.Blankclip(Width=rule_h.height,Height=rule_h.height) : NOP
    h = (Corner.IsClip) ? Stackhorizontal(corner,r_h,corner) : (horiz) ? r_h : NOP
    m = (r_v.IsClip) ? StackHorizontal(r_v,g,r_v) : g
    (h.IsClip) ? StackVertical(h,m,h) : m
}
In BLUE, for ruler, other args for grid.

[clickme, twice]


EDIT:
OOoops re-posted, had bold and vbold as Bool instead of int.
Also, changed to output of RGB32 (from YV12), makes more sense when 'gridded'.

EDIT:
Moved Rule args before grid args, easier to use eg Apply_RuledGrid(c,rh,true,true)
__________________
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; 11th June 2023 at 12:01.
StainlessS is offline   Reply With Quote
Old 11th June 2023, 23:19   #17  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by Rob105 View Post
Hi guys, i actually ended up using importing Grid plugin from VirtualDub, because in Avisynth grid plugin has lines that are too thick i just need 1px width solid line, dotted lines i don't like.

If you continue to develop this plugin, please add opacity right now its too bold and covers video frame too much.

It's pretty easy to make your own grid using mt_lutspa (masktools2) . You can change the size , colors, overlay opacity etc...

This example uses 16x16 grid (change the 16 if you want different x,y dimensions) . Change the opacity parameter for overlay if you want

Code:
video=colorbars(pixel_type="YV12")

grid=video.mt_lutspa(relative=false, expr="x 16 % 0 == y 16 % 0 == | 255 0 ?", u=-128,v=-128)

overlay(video, grid, mask=grid, opacity=1)





If you're trying to censor/ mask out that guy's face in post #14 (or anything moving, really, for any video) , use a NLE with a motion tracker. That will be 10x easier , faster, more accurate and actually "stick" to the face instead of randomly wobbling around. Dedicated masking and rotoscoping tools are going to be much better for those types of tasks. Avisynth is the wrong tool for that job . I saw some of your other threads on animated a block , conditional reader, it's a waste of time doing it that way and it won't even match the motion accurately. The video content motion is not linear to begin with. If you were going to do figure out x, y coordinates, scale - you might as well rotoscope it manually, the latter would still be faster, more accurate (you aren't limited to rectangle shapes)

Last edited by poisondeathray; 11th June 2023 at 23:31.
poisondeathray is offline   Reply With Quote
Old 11th June 2023, 23:53   #18  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Some censor type stuff, here:- https://forum.doom9.org/showthread.p...93#post1935393

EDIT: Manual tracking only.
__________________
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; 12th June 2023 at 13:01.
StainlessS is offline   Reply With Quote
Reply

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 13:51.


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