11

I was trying to fit a generator into a model and I got this error: AssertionError: Cannot find installation of real FFmpeg (which comes with ffprobe).

I have looked over many of the solutions on GitHub and other questions on Stack Overflow but none of them worked for me.

Here is one of the commands I ran:

sudo add-apt-repository ppa:mc3man/trusty-media  
sudo apt-get update  
sudo apt-get install ffmpeg  
sudo apt-get install frei0r-plugins  

pip list also indicates the presence of ffmpeg-1.4

In addition, I tried force reinstalling and updating ffmpeg just in case any dependencies were not installed properly.

I also set the skvideo's path for ffmpeg manually:

skvideo.setFFmpegPath('/usr/local/lib/python3.6/dist-packages/ffmpeg/')

This returns: /usr/local/lib/python3.6/dist-packages/skvideo/__init__.py:306: UserWarning: ffmpeg/ffprobe not found in path: /usr/local/lib/python3.6/dist-packages/ffmpeg/ warnings.warn("ffmpeg/ffprobe not found in path: " + str(path), UserWarning)

By the way, when I try installing, it also returns this error, I don't know what to do about this:

Get:127 http://archive.ubuntu.com/ubuntu bionic/main amd64 vdpau-driver-all amd64 1.1.1-3ubuntu1 [4,674 B]
Fetched 60.4 MB in 7s (8,769 kB/s)
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/w/wavpack/libwavpack1_5.1.0-2ubuntu1.1_amd64.deb  404  Not Found [IP: 91.189.88.149 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I ran apt-get update --fix-missing and that didn't make anything better.

Is there a solution to this?

Asm Goni
  • 137
  • 1
  • 2
  • 8
  • Don't know about all the technologies you are mentioning, but I do know Windows and ffmpeg, with those you have to set the Environmental Variables after installation to be able to access them at least from the Command Prompt, and I guess the same goes in Ubuntu and using ffmpeg from python. I am taking a wild guess. Here is a link to Environmental Variables in Ubuntu https://askubuntu.com/questions/730/how-do-i-set-environment-variables – Felipe Gutierrez Dec 08 '18 at 17:08

8 Answers8

10

FYI it is best to share a minimal notebook that reproduces the entire issue you see to clarify what exactly you're trying to do and how it's going wrong. In this case you might be looking for the following:

!apt-get install --no-install-recommends ffmpeg && pip install ffmpeg scikit-video

import skvideo.io
import skvideo.datasets
bbb = skvideo.datasets.bigbuckbunny()
print('bigbuckbunny is in: {}'.format(bbb))
v = skvideo.io.vread(filename)
print('shape is: {}'.format(v.shape))

(if you've already apt/pip-installed a lot of things, esp. if you've "forced" installation of various packages, you might want to "Reset all runtimes" in colab to get a clean VM to run the above in)

Ami F
  • 2,202
  • 11
  • 19
  • I found out that in some situations that doesn't work, in which case this worked for me: `apt-get update && apt-get install ffmpeg` – Asm Goni Dec 09 '18 at 06:57
  • Update should not be necessary, and suggests to me that apt has been misconfigured by earlier notebook code (in other words, I'd suggest you try to figure out what caused the "situation" you describe) – Ami F Dec 09 '18 at 17:22
3

For windows10 users

import skvideo
skvideo.setFFmpegPath('C:\ProgramData\Anaconda3\Lib\site-packages\skvideo\io')
Ezra
  • 41
  • 6
  • it's C:\Users\"user"\Anaconda3\Lib\site-packages\skvideo\io for me – Olli Sep 28 '21 at 09:52
  • I get `C:\Python27\lib\site-packages\skvideo\__init__.py:306: UserWarning: ffmpeg/ffprobe not found in path: C:\Python27\Lib\site-packages\skvideo\io` even though that directory contains ffmpeg.py, ffmpeg.pyc, ffprobe.py, ffprobe.pyc. What might be the problem? [Calling `setFFmpegPath` a second time](https://github.com/scikit-video/scikit-video/issues/38) doesn't yield the warning anymore, but I still get `Cannot find installation of real FFmpeg (which comes with ffprobe)` when calling `skvideo.io.vread`. – root Nov 20 '21 at 12:00
  • Solution to my problem: https://stackoverflow.com/a/65994349/5231110 (`import skvideo`, then `skvideo.setFFmpegPath('your_environment/bin/')`, then `import skvideo.io` in this order!) – root Nov 20 '21 at 12:08
3

Shortcut Way

ffmpeg link and unzip You can do this in your code. Make sure you put up to bin path of unzipped file

 import skvideo
 skvideo.setFFmpegPath("D:/ffmpeg-20170125-2080bc3-win64-static/ffmpeg- 
 20170125-2080bc3-win64-static/bin")

Permanent Way

One of the reasons might be that ffmpeg is not configured correctly,(its not always the case).

Step1:

Check ffmpeg is accessible from cmd, type ffmpeg in command line and see if it recognizes the command, if not download link and unzip and add it to the environment variable path Eg:

D:\ffmpeg-20170125-2080bc3-win64-static\ffmpeg-20170125-2080bc3-win64-static\bin

Step 2:

Use where ffmpeg in command line sometimes it could be pointing to wrong file, in my case imageMagick was installed, and system was referring to that

C:\Program Files\ImageMagick-7.0.8-Q16\ffmpeg.exe,

either delete imageMagick path or put it after

D:\ffmpeg-20170125-2080bc3-win64-static\ffmpeg-20170125-2080bc3-win64-static\bin in path environment variable

Step 3.

Close the terminal and reopen and check where ffmpeg, dont worry if it shows two path, but the first path should be of our installation

ffmpeg-20170125-2080bc3-win64-static\ffmpeg-20170125-2080bc3-win64-static\bin

if its okay, you are good to go

Saragada Ramesh
  • 191
  • 2
  • 5
Ajay Tom George
  • 1,890
  • 1
  • 14
  • 26
2

Do as follows:

  1. import skvideo

  2. skvideo.setFFmpegPath('your_environment/bin/')

  3. import skvideo.io

  4. videodata = skvideo.io.vread('your_video')

It is important to follow the sequence without mixing the steps.

0

Add this at the top of your script:

import skvideo
skvideo.setFFmpegPath('/usr/local/lib/python3.6/dist-packages/ffmpeg/')

You must set the FFmpeg path before you import skvideo.io, otherwise it will be ignored.

Todd
  • 1
0

For windows, you must specify the ffmpeg path. Download ffmpeg for windows from here: https://ffmpeg.zeranoe.com/builds/

Make sure to download the shared version

(if this link dies when you see this, just search "ffmpeg windows" and you will find a download)

Extract it anywhere (eg. C:\\ffmpeg) and then point to it to skvideo like so:

import skvideo
skvideo.setFFmpegPath("C:\\ffmpeg") # you need this before the import
import skvideo.io

vid_data = skvideo.io.vread("data/mp4/train.mp4") # example path
print(vid_data.shape)
Asad-ullah Khan
  • 1,573
  • 18
  • 22
0

For windows:

1.download ffmpeg-...-shared

https://ffmpeg.zeranoe.com/builds/

2.set path to /bin

import skvideo
skvideo.setFFmpegPath('D:\\ProgramData\\ffmpeg\\ffmpeg-20190814-8fcc5d9-win64-shared\\bin')
0

For windows user this command works

conda install ffmpeg -c mrinaljain17

Lakshman ram
  • 41
  • 1
  • 6