Error:VideoExport.startFfmpeg(Unknown Source) but ffmpeg is already installed

Ffmpeg is already installed on your computer

C:\Users\Fu>ffmpeg
ffmpeg version 5.0.1-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers

NullPointerException
at com.hamoid.VideoExport.startFfmpeg(Unknown Source)
at com.hamoid.VideoExport.initialize(Unknown Source)
at com.hamoid.VideoExport.startMovie(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:188)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:206)
at org.python.core.PyObject.call(PyObject.java:480)
at org.python.core.PyObject.call(PyObject.java:484)
at org.python.core.PyMethod.call(PyMethod.java:126)
at org.python.pycode._pyx11.setup$1(musice.pyde:16)
at org.python.pycode._pyx11.call_function(musice.pyde)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:125)
at org.python.core.PyFunction.call(PyFunction.java:403)
at org.python.core.PyFunction.call(PyFunction.java:398)
at jycessing.PAppletJythonDriver.setup(Unknown Source)
at processing.core.PApplet.handleDraw(PApplet.java:2432)
at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1547)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:313)
at jycessing.mode.run.SketchRunner.convertPythonSketchError(Unknown Source)
at jycessing.mode.run.SketchRunner.lambda$startSketch$3(Unknown Source)
at java.lang.Thread.run(Thread.java:748)

code

add_library('VideoExport')
add_library('minim')
minim = Minim(this)
export = VideoExport(this)

def setup():
    global player, fft, fftScale, export
    bg = loadImage("001.jpg")
    size(720,540)
    export.startMovie()
    player = minim.loadFile("2.mp3")
    player.play()
    fft = FFT(player.bufferSize(), player.sampleRate())
    fftScale = 50
    colorMode(HSB)
    frameRate(30)
    
def draw():
    background(255, 204, 0)
    fft.forward(player.mix)
    specLength = fft.specSize()/2
    j = 0
    for i in range(specLength):
      j = j +1
      if (j %2 == 0):
          continue
      
      ffti = sqrt(fft.getBand(i)) * fftScale
      basis = width/6 + 2 *sin(0.5*i + frameCount)
      angle = map(i, 0, specLength-1, -0.5*PI, 1.5*PI)
      
      startX = width/2 + cos(angle)*basis
      startY = height/2 + sin(angle)*basis
      
      endX = width/2 + cos(angle) * (basis+ffti)
      endY = height/2 + sin(angle) * (basis+ffti)
      
      stroke(map(i, 0, specLength-1, 0, 255), 255, 255)
      strokeWeight(2)
      line(startX, startY, endX, endY)
      export.saveFrame()
      
def keyPressed():
  if (key == 'q'):
    export.endMovie()
    exit()

Welcome, @salt

Move your VideoExport(this) line to the setup block instead. For example –

add_library('VideoExport')

def setup():
    global export
    export = VideoExport(this)
    export.startMovie()
    
def draw():
    background(0)
    circle(frameCount%width, height/2, 10)
    export.saveFrame()
      
def mouseClicked():
    export.endMovie()
    exit()
2 Likes