imageio / imageio-ffmpeg

FFMPEG wrapper for Python
BSD 2-Clause "Simplified" License
225 stars 50 forks source link

Find ffmpeg in frozen applications #5

Closed almarklein closed 2 years ago

almarklein commented 5 years ago

When this lib is included in a frozen application, the ffmpeg executable must be shipped along too. We should:

While we don't have this, please copy the ffmpeg executable yourself, and use the IMAGEIO_FFMPEG_EXE environment variable to point to it.

almarklein commented 5 years ago

This relates to https://github.com/imageio/imageio/issues/271 cc @paulmueller

paulmueller commented 5 years ago

I think this is already implemented. Simply use the --package-dir option and the ffmpeg binary will be downloaded to the package directory / resources.

imageio_download_bin --package-dir ffmpeg

For PyInstaller, at least, the following built-in hook makes sure the binaries end up in the final distribution build: https://github.com/pyinstaller/pyinstaller/blob/develop/PyInstaller/hooks/hook-imageio.py

I experienced no problems with this approach.

reference: https://github.com/ZELLMECHANIK-DRESDEN/ShapeOut/blob/master/appveyor.yml#L82

[EDIT] I just realized that you intend to move the ffmpeg binary into the binary wheel. Still, the same applies. It should work if you migrate the original code from the imageio plugin. BTW: What about source tarballs on PyPI? Will they also contain the binary?

almarklein commented 5 years ago

Yeah the imageio_download_bin will no longer work for ffmpeg. So to summarize:

What about source tarballs on PyPI? Will they also contain the binary?

No, only the wheels. And there will still be a tarball on Pypi, so you can (surely pip has a flag for that?) install the lib without the binary, and supply one yourself.

paulmueller commented 5 years ago

I will create a PR for the hook and let you know how things work out. I believe that there will be no problem, if we use pgk_resources.

almarklein commented 5 years ago

That would be great!

marnunez commented 3 years ago

Just a reminder, mostly for my future self, for when I inevitably forget it: those who installed imageio-ffmpeg with conda have no ffmpeg binary under the "resources" folder. Modify the hook or use pip instead of conda.

paulmueller commented 2 years ago

Sorry for replying just now. I did a quick check and it looks like this is already implemented with pkg_resources. So it should work. Doesn't it?

almarklein commented 2 years ago

I guess so, but this has not yet been confirmed.

paulmueller commented 2 years ago

For me it works fine on Windows. Currently there is only https://github.com/imageio/imageio/issues/766 in the way.

paulmueller commented 2 years ago

It also works on linux. I think this one can be closed.

almarklein commented 2 years ago

Thanks for the confirmation, we can close!