pythonffmpegscikits

skvideo + ffmpeg: Can't set path to binaries


For some reason, setting the path to the ffmpeg binaries doesn't work completely.

While it seems like this works like it should:

import skvideo.io
import skvideo.datasets

ffmpeg_path = "C:/Users/xyz/ffmpeg-4.3.1-win64-static/bin/"
skvideo.setFFmpegPath(ffmpeg_path)
print("FFmpeg path: {}".format(skvideo.getFFmpegPath()))
print("FFmpeg version: {}".format(skvideo.getFFmpegVersion()))

>>> FFmpeg path: C:/Users/xyz/ffmpeg-4.3.1-win64-static/bin/
>>> FFmpeg version: b'4'.b'3'.b'1'

Running these lines directly after does not:

videodata = skvideo.io.vread(skvideo.datasets.bigbuckbunny())
print(videodata.shape)

[...]
>>> File "C:\Users\xyz\Anaconda3\envs\cv_env\lib\site-packages\skvideo\io\io.py", line 133, in vread
  assert _HAS_FFMPEG, "Cannot find installation of real FFmpeg (which comes with ffprobe)."
>>> AssertionError: Cannot find installation of real FFmpeg (which comes with ffprobe).

Can't figure out, why it's not set correctly...


Solution

  • I figured it out thanks to some hidden comment in the official scikit-video repo. Apparently you have to set the path and then import the package again:

    import skvideo
    
    ffmpeg_path = "C:/Users/xyz/ffmpeg-4.3.1-win64-static/bin/"
    skvideo.setFFmpegPath(ffmpeg_path)
    
    import skvideo.datasets
    import skvideo.io
    
    print("FFmpeg path: {}".format(skvideo.getFFmpegPath()))
    print("FFmpeg version: {}".format(skvideo.getFFmpegVersion()))
    
    videodata = skvideo.io.vread(skvideo.datasets.bigbuckbunny())
    print(videodata.shape)
    
    >>> FFmpeg path: C:/Users/xyz/ffmpeg-4.3.1-win64-static/bin/
    >>> FFmpeg version: b'4'.b'3'.b'1'
    >>> (132, 720, 1280, 3)