VideoHelp Forum

+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. I'm trying to use my script I usually use for things, this script always worked without fail but I get this error now:
    Code:
    Failed to evaluate the script:
    Python exception: No attribute with the name grain exists. Did you mistype a plugin namespace?
    
    Traceback (most recent call last):
    File "src\cython\vapoursynth.pyx", line 2242, in vapoursynth.vpy_evaluateScript
    File "src\cython\vapoursynth.pyx", line 2243, in vapoursynth.vpy_evaluateScript
    File "C:/Users/bri/Documents/scripts/tst.vpy", line 25, in 
    lineart_mask = kgf.retinex_edgemask(scaled, 1).std.Maximum().std.Binarize()
    File "C:\Users\bri\AppData\Roaming\Python\Python39\site-packages\kagefunc.py", line 128, in adaptive_grain
    grained = core.grain.Add(clip, var=strength, constant=static)
    File "src\cython\vapoursynth.pyx", line 1891, in vapoursynth._CoreProxy.__getattr__
    File "src\cython\vapoursynth.pyx", line 1754, in vapoursynth.Core.__getattr__
    AttributeError: No attribute with the name grain exists. Did you mistype a plugin namespace?

    My script being this:
    Code:
    import vapoursynth as vs
    import lvsfunc as lvf
    import kagefunc as kgf
    import vsTAAmbk as taa
    import fvsfunc as fvf
    import havsfunc as haf
    import functools
    import cooldegrain
    from vsutil import *
    from nnedi3_rpow2 import *
    core = vs.core
    
    src = lvf.src(r'E:\VideoWork\tst.mkv')
    src = src[20336:20373]
    src = fvf.Depth(src, 16)
    
    scaled = core.resize.Spline36(src, 854, 480, matrix_in_s="709", matrix_s="170m")
    
    aamask = kgf.retinex_edgemask(scaled).std.Binarize(12000).std.Inflate()
    aa = taa.TAAmbk(scaled, aatype='Nnedi3', mclip=aamask)
    dehalo = haf.HQDeringmod(aa, darkthr=0, sharp=0, mthr=50)
    
    dark_mask = kgf.adaptive_grain(scaled, show_mask=True, luma_scaling=12).std.Binarize()
    lineart_mask = kgf.retinex_edgemask(scaled, 1).std.Maximum().std.Binarize()
    deband_mask = core.std.Expr([dark_mask, lineart_mask], expr='x y -', format=vs.GRAY)
    
    deband_a = core.f3kdb.Deband(dehalo, range=13, y=28, cb=16, cr=16, grainy=12, grainc=0, output_depth=16)
    deband_b = core.f3kdb.Deband(dehalo, range=15, y=28, cb=32, cr=32, grainy=16, grainc=0, output_depth=16)
    deband = core.std.MaskedMerge(deband_a, deband_b, deband_mask)
    grain = kgf.adaptive_grain(deband, 0.2, luma_scaling=12)
    
    out = grain
    final = fvf.Depth(out, 10)
    final.set_output()

    I initially updated to R57 a few days ago but I encountered an error saying this with the same script:
    Code:
    Failed to evaluate the script:
    Python exception: module 'vapoursynth' has no attribute 'YCOCG'
    
    Traceback (most recent call last):
    File "src\cython\vapoursynth.pyx", line 2832, in vapoursynth._vpy_evaluate
    File "src\cython\vapoursynth.pyx", line 2833, in vapoursynth._vpy_evaluate
    File "C:/Users/bri/Documents/SciptsVS/maid.vpy", line 20, in 
    aamask = kgf.retinex_edgemask(scaled).std.Binarize(12000).std.Inflate()
    File "C:\Users\bri\AppData\Roaming\Python\Python39\site-packages\kagefunc.py", line 222, in retinex_edgemask
    luma = get_y(src)
    File "C:\Users\bri\AppData\Roaming\Python\Python39\site-packages\vsutil\func.py", line 31, in _check
    return function(clip, *args, **kwargs)
    File "C:\Users\bri\AppData\Roaming\Python\Python39\site-packages\vsutil\clips.py", line 92, in get_y
    if clip.format.color_family not in (vs.YUV, vs.YCOCG, vs.GRAY):
    AttributeError: module 'vapoursynth' has no attribute 'YCOCG'

    So I went to downgrade back to R54 but I now have the grain error. How would this be fixed? Any help is appreciated
    Quote Quote  
  2. No attribute with the name grain exists. Did you mistype a plugin namespace?
    -> seems like you are missing: https://github.com/HomeOfVapourSynthEvolution/VapourSynth-AddGrain

    AttributeError: module 'vapoursynth' has no attribute 'YCOCG'
    Yup, YCOCG and COMPAT got removed.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. Originally Posted by Selur View Post
    No attribute with the name grain exists. Did you mistype a plugin namespace?
    -> seems like you are missing: https://github.com/HomeOfVapourSynthEvolution/VapourSynth-AddGrain

    AttributeError: module 'vapoursynth' has no attribute 'YCOCG'
    Yup, YCOCG and COMPAT got removed.

    Cu Selur
    I still have the error on R54 even with the grain plugin added. And that's a shame about by YCOCG.
    Quote Quote  
  4. navigate to vsutil.py and delete that vs.YCOCG with that comma in:
    Code:
    if clip.format.color_family not in (vs.YUV, vs.YCOCG, vs.GRAY):
    check if there is more of that in that script,
    also, not that is wrong, but:
    Code:
    from vsutil import *
    from nnedi3_rpow2 import *
    is dumping a lots of functions unmarked on a pile, because if having more modules loaded like that, you loose readability, you do not know what function is from what module
    Quote Quote  
  5. kagefunc.py is using this function error, it says it is in this line:
    Code:
    grained = core.grain.Add(clip, var=strength, constant=static)
    so looking at that kagefunc.py script:
    Code:
    def adaptive_grain(clip: vs.VideoNode, strength=0.25, static=True, luma_scaling=12, show_mask=False) -> vs.VideoNode:
        """
        Generates grain based on frame and pixel brightness. Details can be found here:
        https://kageru.moe/blog/article/adaptivegrain
        Strength is the strength of the grain generated by AddGrain, static=True for static grain, luma_scaling
        manipulates the grain alpha curve. Higher values will generate less grain (especially in brighter scenes),
        while lower values will generate more grain, even in brighter scenes.
        """
        mask = core.adg.Mask(clip.std.PlaneStats(), luma_scaling)
        grained = core.grain.Add(clip, var=strength, constant=static)
        if get_depth(clip) != 8:
            mask = fvf.Depth(mask, bits=get_depth(clip))
        if show_mask:
            return mask
    
        return core.std.MaskedMerge(clip, grained, mask)
    those pages does not seam to have a link for downloads, but here: https://git.kageru.moe/kageru/adaptivegrain/releases , that might be his adaptive grain
    Quote Quote  
  6. Thanks for the help, AL. I will give these a shot again tomorrow. I do actually have that adaptive grain plugin downloaded in my plugins64 folder though, so I don't think it's that unless that is the wrong place to put it but that's where it always was before when this script was working fine without issue until now
    Quote Quote  
  7. In older version of Vapoursynth the grain filter did come bundled with Vapoursynth, with API4 and R55+ most of the bundled filters were removed so you have to download them seperately.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  8. I'm sorry for the very late reply but that indeed work, thank you very much
    Quote Quote