Search code examples
pythonffmpegvirtualenv

Install ffmpeg in to virtual environment


I am trying to install ffmpeg in order to use it on OpenAI to record videos. I have installed it using brew install ffmpeg but somehow when I compile my code I get the same error, it is like the package is not recognized by my virtualenv where I am working.

Error on Python console:

raise error.DependencyNotInstalled("""Found neither the ffmpeg nor avconv executables. On OS X, you can install ffmpeg via `brew install ffmpeg`. On most Ubuntu variants, `sudo apt-get install ffmpeg` should do it. On Ubuntu 14.04, however, you'll need to install avconv with `sudo apt-get install libav-tools`.""")

However, when I execute which ffmpeg I got the following path /usr/local/bin/ffmpeg.

It seems like that Anaconda for example needs a specific command to install this package into its environment, it is the same for virtualenv?

Thanks in advance.


Solution

  • This is not possible. FFmpeg is a separate application. If you need to use ffmpeg in python, you either need to pip install a wrapper for python (e.g. ffmpeg-python, ffmpy, etc). But those wrappers does not use the full power of FFmpeg.

    Instead what I suggest is to execute command line FFmpeg command in python using subprocess.

    Ref: