Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of the ffmpeg dependency #859

Closed
superseed opened this issue Oct 16, 2018 · 1 comment
Closed

Handling of the ffmpeg dependency #859

superseed opened this issue Oct 16, 2018 · 1 comment
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.

Comments

@superseed
Copy link

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 in config_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 variable FFMPEG_BINARY is checked on import of editor.py and if unset or equal to ffmpeg-imageio, is downloaded through imageio's primitives.

I see three problems with this approach:

  • It checks the environment variable FFMPEG_BINARY instead of the global python variable defined in config_defaults.py, which is unwieldy anyway since it's a build-time conf (aka a 'sneaky edit in the lib/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.
  • It doesn't really check for ffmpeg by itself, which is the bigger pain point.
  • When it doesn't find it, it tries downloading it by itself.

There a few potential solutions:

  • Keep things this way and document the need to set the environment variable, maybe homogenize the behavior by using the environment var everywhere else
  • Check the variable set in config_defaults.py instead of the environment variable
  • Allow for a runtime configuration file somehow
  • Actually check for a valid ffmpeg binary. To me this is the better solution: it can be done easily -- check if it is available in the PATH with shutil.which('ffmpeg'), possibly subprocess.run() it to get the version number and check compatibility. If it's not found, two possibilities:
    • Download it to the homedir automatically (and get frowned upon by me 😄)
    • Error out with a warning and handy tips for the user. Possibly with a lot of user-friendliness, e.g. ship a little script with the MoviePy package linked to a console_scripts entry in setup.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! 🎉)

@keikoro keikoro added lib-misc Issues pertaining to misc. 3rd-party libraries. suggestion labels Dec 16, 2018
@tburrows13
Copy link
Collaborator

It is all rolled into imageio_ffmpeg now, so hopefully not an issue.

@keikoro keikoro added enhancement Positive change that does not change the API, i.e. improved performance, using less memory etc. lib-FFmpeg Issues pertaining to dependency FFmpeg. and removed suggestion labels Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants