0

I'm working on Windows 10, using python3.8. I wanted to install the ffpyplayer module, and did so using the command:

python3 -m pip install --upgrade ffpyplayer

There seemed to be no issues. Using python in PowerShell and stating import ffpyplayer doesn't return anything, however, when I try and run `from ffpyplayer.player import MediaPlayer. It returns the following error

from ffpyplayer.player import MediaPlayer
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File 
"C:\Users\g\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\ffpyplayer\player\__init__.py", line 10, in <module>
from ffpyplayer.player.player import MediaPlayer
ImportError: DLL load failed while importing player: The specified module could not be found.

Why is it able to import in one instance and not the next? What is causing the import error in the second example?

gmiles
  • 76
  • 5
  • Have you installed the prerequesites as per https://matham.github.io/ffpyplayer/installation.html? My suspicion is that directly importing MediaPlayer is triggering some code to execute which tries to load the DLL. The DLL not existing throws the error. My suspicion is specifically that you don't have ffmpeg binaries installed on your system. – XtrmJosh Feb 18 '21 at 12:56
  • @XtrmJosh thank you for such a quick reply. Can I ask if the pip install ffpyplayer command is supposed to install those ffmpeg binaries? I thought the "compiling" section on the website was only if you didn't want to install it via the pip install command. Honestly, any clarification regarding this would be really, really helpful. – gmiles Feb 18 '21 at 13:10

2 Answers2

0

ffpyplayer builds ffmpeg include path as follows: _ffmpeg = join(sys.prefix, 'share', 'ffpyplayer', 'ffmpeg', 'bin')

sys.prefix resolves to Python installation directory, e.g. C:\Program Files\Python.

If ffpyplayer is installed using PIP not in CMD administrator mode, the package is installed into user local %AppData%\Python directory. This is the reason ffmpeg does not get resolved as expected.

Solution:

  • pip uninstall ffpyplayer
  • CMD (Administrator mode)
  • pip install ffpyplayer
0

I answered a similar question, but basically import ffpyplayer in your specfile and add ffpyplayer.dep_bins to your tree like so:

*[Tree(p) for p in (source1 + source2 + ffpyplayer.dep_bins)]

https://stackoverflow.com/a/70392062/16355112

  • there is more you need to do. in the other answer i posted the full thing but you need to add all the ffpyplayer dependencies in your specfile: `datas = ['ffpyplayer', 'ffpyplayer.pic','ffpyplayer.threading', 'ffpyplayer.tools', 'ffpyplayer.writer','ffpyplayer.player', 'ffpyplayer.player.clock', 'ffpyplayer.player.core', 'ffpyplayer.player.decoder', 'ffpyplayer.player.frame_queue', 'ffpyplayer.player.player', 'ffpyplayer.player.queue']` then uninstall gstreamer with `python -m pip uninstall kivy.deps.gstreamer` and once you compile ffpyplayer should work – reallyprettycolors Dec 19 '21 at 01:01