pythonarcade / pyglet-ffmpeg Goto Github PK
View Code? Open in Web Editor NEWProvide binary wheels for using ffmpeg with pyglet on certain platforms
License: BSD 3-Clause "New" or "Revised" License
Provide binary wheels for using ffmpeg with pyglet on certain platforms
License: BSD 3-Clause "New" or "Revised" License
Using Arcade, Python3, and Ubuntu, this library is looking for ffmpeg .so files in the wrong location.
Instead of it being found at
~/.local/lib64/python3.7/dist-packages/pyglet_ffmpeg2/linux_x86_64/libavcodec.so.58.*
it was found at
~/.local/lib/python3.7/dist-packages/pyglet_ffmpeg/linux_x86_64/libavcodec.so.58.*
This is the code;
import pyglet_ffmpeg2
print("asd")
and the traceback gives me this:
Start
Traceback (most recent call last):
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet_init_.py", line 353, in getattr
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'have_ffmpeg'During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Pintér Péter/Documents/GitHub/python/Arcade/test.py", line 1, in
import pyglet_ffmpeg2
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet_ffmpeg2_init_.py", line 5, in
load_ffmpeg()
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet_ffmpeg2\loader.py", line 18, in load_ffmpeg
if pyglet.media.have_ffmpeg():
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet_init_.py", line 359, in getattr
import(import_name)
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media_init_.py", line 146, in
add_default_media_codecs()
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs_init_.py", line 164, in add_default_media_codecs
Unexpected error loading library avutil-56: Could not find module 'avutil-56'. Try using the full path with constructor syntax.
if have_ffmpeg():
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs_init_.py", line 180, in have_ffmpeg
from . import ffmpeg_lib
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib_init_.py", line 36, in
from .libavcodec import *
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib\libavcodec.py", line 45, in
from . import libavutil
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib\libavutil.py", line 46, in
avutil = pyglet.lib.load_library(
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\lib.py", line 148, in load_library
lib = ctypes.cdll.LoadLibrary(name)
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\ctypes_init_.py", line 447, in LoadLibrary
return self.dlltype(name)
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\ctypes_init.py", line 369, in init
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'avutil-56'. Try using the full path with constructor syntax.
Error in atexit.run_exitfuncs:
Unexpected error loading library avutil-56: Could not find module 'avutil-56'. Try using the full path with constructor syntax.
Traceback (most recent call last):
File "", line 991, in find_and_load
File "", line 975, in find_and_load_unlocked
File "", line 671, in load_unlocked
File "", line 783, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media_init.py", line 146, in
add_default_media_codecs()
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs_init.py", line 164, in add_default_media_codecs
if have_ffmpeg():
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs_init.py", line 180, in have_ffmpeg
from . import ffmpeg_lib
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib_init.py", line 36, in
from .libavcodec import *
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib\libavcodec.py", line 45, in
from . import libavutil
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib\libavutil.py", line 46, in
avutil = pyglet.lib.load_library(
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\lib.py", line 148, in load_library
lib = ctypes.cdll.LoadLibrary(name)
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\ctypes_init.py", line 447, in LoadLibrary
return self.dlltype(name)
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\ctypes_init.py", line 369, in init
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'avutil-56'. Try using the full path with constructor syntax.
See the traceback:
>>> import pyglet_ffmpeg2
Start
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/pyglet_ffmpeg2/__init__.py", line 5, in <module>
load_ffmpeg()
File "/usr/lib/python3.7/site-packages/pyglet_ffmpeg2/loader.py", line 17, in load_ffmpeg
_locate_binaries()
File "/usr/lib/python3.7/site-packages/pyglet_ffmpeg2/loader.py", line 56, in _locate_binaries
_ensure_linux_symlinks(path)
File "/usr/lib/python3.7/site-packages/pyglet_ffmpeg2/loader.py", line 93, in _ensure_linux_symlinks
os.path.join(bin_folder, symlink)
PermissionError: [Errno 13] Permission denied: '/usr/lib64/python3.7/site-packages/pyglet_ffmpeg2/linux_x86_64/libavcodec.so.58.21.104' -> '/usr/lib64/python3.7/site-packages/pyglet_ffmpeg2/linux_x86_64/libavcodec.so.58'
Problem:
on Windows 10, when calling -
pyglet.media.load(io.Bytes(media_data_as_byte_array), streaming=False, decoder=pyglet.media.codecs.ffmpeg.FFmpegDecoder)
I get the following error: pyglet.media.codecs.ffmpeg.FFmpegException: avformat_open_input in ffmpeg_open_filename returned an error opening file C:\Users\user\AppData\Local\Temp\tmppgpnk36v Error code: -13
Debugging the problem:
When FFmpegSource is constructed in ffmpeg.py it creates a named tempfile which the media_data is written to. However the tempfile is 0 bytes, and cannot be opened by ffmpeg because python still has it open. Reading the docs about NamedTemporaryFile, it mentions that on Windows the tempfile cannot be opened by a second process unless the file is first closed by Python (which would remove the tempfile).
If I change the constructor to not delete the tempfile, write the data and then close the tempfile before ffmpeg loads the data then it works. But leaves the tempfile on disk.
if file:
file.seek(0)
self._tempfile = tempfile.NamedTemporaryFile(delete=False)
self._tempfile.write(file.read())
self._tempfile.close()
filename = self._tempfile.name
Since this is so fiddly, we need an easy thing to tell people to do as a diagnosis. As an example, if you tell them to do this:
$ python3 -m pyglet_ffmpeg.selftest
...it could play a bundled sound file for each supported format, then dump some information about the location of the binaries, etc.
Trying to use bumpversion, I ran in the following issue TypeError: environment can only contain strings
.
I found the following issue in their issue tracker: peritus/bumpversion#67
According to the last message, the development is rather inactive but there is another fork from this project bump2version.
Any chance to investigate if this could replace the actual bumpversion?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.