fukiburi
fukiburi

Reputation: 653

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...

Upvotes: 1

Views: 2669

Answers (2)

Debanjan Dutta
Debanjan Dutta

Reputation: 11

Ubuntu also does not comes with ffmpeg. As mentioned by @fukiburi, once ffmpeg (which mostly acts as a independent binary,nothing to deal with python or skvideo python package itself) is downloaded using sudo apt-get install ffmpeg, it makes default installation of ffmpeg, ffprobe, ffplay etc in /usr/bin/, which in turn solves the problem.

Upvotes: 0

fukiburi
fukiburi

Reputation: 653

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)

Upvotes: 1

Related Questions