Install ffmpeg in to virtual environment

13,807

Solution 1

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:

Solution 2

This is possible. A conda recipe for ffmpeg is available via the menpo or conda-forge channels. Try using this command:

conda create -n newenv -c conda-forge ffmpeg
Share:
13,807
ldg
Author by

ldg

I am currently studying Robotics and Artificial Intelligence as Master degree.

Updated on June 04, 2022

Comments

  • ldg
    ldg almost 2 years

    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.

    • Joe T. Boka
      Joe T. Boka almost 6 years
      You said:"seems like that Anaconda for example needs a specific command to install this package into its environment". What is that specific command on Anaconda? In Anaconda, installing ffmpeg is a disaster. It doesn't work in my environments at all.
    • ldg
      ldg almost 6 years
      Yeah you can use pip to install it into you anaconda environment. /anaconda/envs/your_env_name/bin/pip install ffmpeg with the name of you environment as your_env_name.