-3

Trying to make a gif in vapoursynth, followed tutorials yet keep getting name error. If anyone could help explain what's wrong with it and how to fix it, I would appreciate it.

Failed to initialize script.
Failed to evaluate the script:
Python exception: name 'video' is not defined

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1927, in 
vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 1928, in 
vapoursynth.vpy_evaluateScript
File "C:/Users/caitl/Pictures/bbh.vpy", line 12, in 
core.max_cache_size = 1000 #Use this command to limit the RAM usage. 1000 or 2000 is fine.
NameError: name 'video' is not defined

Code

import os
import vapoursynth as vs
import havsfunc as haf
import mvsfunc as mvs
import descale as descale
import muvsfunc as muvs
import resamplehq as rhq
import CSMOD as cs
import Dither as dither

core = vs.get_core()
video = core.std.Trim(video, a, b)
video = haf.QTGMC(video, Preset="Slower", TFF=True)
video = core.fmtc.resample(video, css="444")
video = descale.Debilinear(video, 629,354)
video = mvs.BM3D(video, sigma=8.84, radius1=1, profile1="fast", matrix="709")
video = hnw.FineSharp(video, sstr=1.13)
video = core.std.CropRel(video, left=72, top=52, right=107, bottom=52)
video = core.fmtc.bitdepth(video, bits=8)
video.set_output()
  • I’m sure the error message has more detail to it. Why aren’t you helping us know what line the error is on? – Peter Wood Dec 15 '19 at 20:42
  • Because it says there's an error with every single line with video in it. 12-20 –  Dec 15 '19 at 20:45
  • When you run the script you will get one error – Peter Wood Dec 15 '19 at 20:46
  • Failed to initialize script. Failed to evaluate the script: Python exception: name 'video' is not defined Traceback (most recent call last): File "src\cython\vapoursynth.pyx", line 1927, in vapoursynth.vpy_evaluateScript File "src\cython\vapoursynth.pyx", line 1928, in vapoursynth.vpy_evaluateScript File "C:/Users/caitl/Pictures", line 12, in #core.max_cache_size = 1000 #Use this command to limit the RAM usage. 1000 or 2000 is fine. NameError: name 'video' is not defined –  Dec 15 '19 at 20:49
  • 1
    You should edit the question, but the error is telling you that when you use the name ‘video’ on line 12 of your script it is not defined. You pass it as a parameter but it doesn’t yet exist. – Peter Wood Dec 15 '19 at 20:52
  • How would I fix it? –  Dec 15 '19 at 20:58
  • I don’t know. You need video to reference what I guess would be a video object. There’s probably documentation to tell you how to do it. – Peter Wood Dec 15 '19 at 21:20

2 Answers2

2

You didn't define video before the call to Trim which takes it as a parameter.

Scott Hunter
  • 48,888
  • 12
  • 60
  • 101
1

The example script in the documentation says you need to create a video object, for example, by loading a file:

from vapoursynth import core
video = core.ffms2.Source(source='Rule6.mkv')

This loads a video file Rule6.mkv using the ffms2 plugin, which it assumes is installed correctly.

Peter Wood
  • 23,859
  • 5
  • 60
  • 99