imageio-ffmpeg icon indicating copy to clipboard operation
imageio-ffmpeg copied to clipboard

After pyinstaller packages the program and copies the program to other devices, it prompts that the ffmepeg file cannot be found.

Open jiongjiongJOJO opened this issue 1 year ago • 5 comments

Image

  File "imageio/core/format.py", line 590, in append_data
  File "imageio/plugins/ffmpeg.py", line 587, in _append_data
  File "imageio/plugins/ffmpeg.py", line 648, in _initialize
  File "imageio_ffmpeg/_io.py", line 508, in write_frames
  File "imageio_ffmpeg/_io.py", line 124, in get_first_available_h264_encoder
  File "imageio_ffmpeg/_io.py", line 58, in get_compiled_h264_encoders
  File "imageio_ffmpeg/_utils.py", line 33, in get_ffmpeg_exe
RuntimeError: No ffmpeg exe could be found. Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.

After investigation, the reason was not that ffmpeg could not be found. There was this file in the packaged directory. The reason was that after the program transferred the device, ffmpeg did not have permission and could not be called.

It is recommended to add code that grants writable permissions in the get_ffmpeg_exe function.

pyinstaller packaging instructions:

pyinstaller -D --contents-directory dist --collect-data imageio-ffmpeg -n "main" "main.py"

jiongjiongJOJO avatar Jan 21 '25 10:01 jiongjiongJOJO

Yeah, this library does not have proper support for pyinstaller. If this is a problem, consider using pyav.

almarklein avatar Jan 21 '25 13:01 almarklein

Yeah, this library does not have proper support for pyinstaller. If this is a problem, consider using pyav.

I still hope to be able to use imageio-ffmpeg and look forward to early optimization~

jiongjiongJOJO avatar Jan 22 '25 02:01 jiongjiongJOJO

pyinstaller packaging instructions: pyinstaller -D --contents-directory dist --collect-data imageio-ffmpeg -n "main" "main.py"

I'm not exactly sure what your request is. Do you mean that with the above, the permissions issue is resolved?

almarklein avatar Jan 22 '25 14:01 almarklein

pyinstaller packaging instructions: pyinstaller -D --contents-directory dist --collect-data imageio-ffmpeg -n "main" "main.py"

I'm not exactly sure what your request is. Do you mean that with the above, the permissions issue is resolved?

I mean, when you get the ffmpeg executable file, you can avoid this problem by adding executable rights to this file first.

jiongjiongJOJO avatar Jan 22 '25 14:01 jiongjiongJOJO

pyinstaller packaging instructions: pyinstaller -D --contents-directory dist --collect-data imageio-ffmpeg -n "main" "main.py"

I'm not exactly sure what your request is. Do you mean that with the above, the permissions issue is resolved?

I mean, when you get the ffmpeg executable file, you can avoid this problem by adding executable rights to this file first.

Try to set the executable permission. If it cannot be set, throw an exception. If it can be set, set it before proceeding.

jiongjiongJOJO avatar Aug 18 '25 02:08 jiongjiongJOJO