Handling of the ffmpeg dependency #859
Labels
enhancement
Positive change that does not change the API, i.e. improved performance, using less memory etc.
lib-FFmpeg
Issues pertaining to dependency FFmpeg.
lib-misc
Issues pertaining to misc. 3rd-party libraries.
I just started using this package, trying out an example from a blog post that uses both Gizeh and MoviePy.
When I executed the first example, a download started for ffmpeg, followed by an error about the requests package missing from the env. This second problem seems to have been resolved with 006b376 however (though I would suggest to use urllib from the standard lib for this single HTTP request to avoid a new dependency, but that's not the point of the issue).
The thing is that I do have ffmpeg installed and up-to-date and getting a binary downloaded in my home dir without asking feels wrong to me. I would have preferred the application to error out on not finding the binary. I looked at the
README
in the repo and saw that I could set the binary location inconfig_defaults.py
, so I tried that but it didn't change anything (i.e. it kept downloading ffmpeg). I looked around the code to find that since b8fcf45, the environment variableFFMPEG_BINARY
is checked on import ofeditor.py
and if unset or equal toffmpeg-imageio
, is downloaded through imageio's primitives.I see three problems with this approach:
FFMPEG_BINARY
instead of the global python variable defined inconfig_defaults.py
, which is unwieldy anyway since it's a build-time conf (aka a 'sneaky edit in thelib/python*
directory' type of conf). However note that setting the environment variable to the binary's path before using the package does work! It's just kinda undocumented.There a few potential solutions:
config_defaults.py
instead of the environment variableshutil.which('ffmpeg')
, possiblysubprocess.run()
it to get the version number and check compatibility. If it's not found, two possibilities:console_scripts
entry insetup.py
to setup the needed dependencies.Does any of this sound reasonable? I could send a PR your way if you think it could be useful.
(This package and Gizeh are really good, by the way! 🎉)
The text was updated successfully, but these errors were encountered: