Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.66k stars 1.59k forks source link

Add Environment Variable to overwrite FFMPEG_BINARY #237

Closed dkarchmer closed 8 years ago

dkarchmer commented 8 years ago

It would be great if I didn't have to manually install the package (rather than just use pip install) if I want to use my own version of ffmpeg.

One solution could be to check if there is an Environment Variable, and if so, use that instead of the defaults (export FFMPEG_BINARY=ffmpeg)

If this is an acceptable change, I may be willing to make it. Maybe something as simple as:

import os
FFMPEG_BINARY = os.getenv('FFMPEG_BINARY', 'ffmpeg-imageio')
IMAGEMAGICK_BINARY = os.getenv('FFMPEG_BINARY', 'auto-detect')
Zulko commented 8 years ago

Use this:

from moviepy.conf import change_settings
change_settings({"FFMPEG_BINARY": "ffmpeg"})
dkarchmer commented 8 years ago

Yes, but I don't want to require that on every one of my users. I am creating a docker image with the latest ffmpeg and it is hard to use without been able to setup an environment variable. Are you against using environment variables for any reason? I have a change ready to go. It should be transparent to everybody else.

dkarchmer commented 8 years ago

See https://hub.docker.com/r/dkarchmervue/moviepy/~/dockerfile/ for what I am trying to do. I have a workaround (see end of file) by getting manually getting the source, changing the config_defaults.py and then running python setup.py install but I will like to avoid having to manually edit your code as part of the docker image.

I hope you agree it would not be best practices to hard code the binary location in all my scripts, as it is not really best practice to custom build any library.

Zulko commented 8 years ago

Ok for a commit then.

dkarchmer commented 8 years ago

Pull request tracked with #238 Closing this one