python-vlc
python-vlc copied to clipboard
macosx vout display error: No drawable-nsobject nor vout_window_t found, passing over
While this issue was closed for this very particular use case and versions, it was not solved for other mac users using other python versions.
I am using the following code:
# importing time and vlc
import time
import vlc
# method to play video
def video(source):
# creating a vlc instance
vlc_instance = vlc.Instance()
# creating a media player
player = vlc_instance.media_player_new()
# creating a media
media = vlc_instance.media_new(source)
# setting media to the player
player.set_media(media)
# play the video
player.play()
# wait time
time.sleep(10)
# getting the duration of the video
duration = player.get_length()
# printing the duration of the video
print("Duration : " + str(duration))
# call the video method
video("../data/070_SHARP_Titles_Flower_Titles.mp4")
Here is the result on MacOs Big Sur:
[00007fc99ec994c0] videotoolbox decoder: Using Video Toolbox to decode 'h264'
[00007fc99ec994c0] videotoolbox decoder: vt cvpx chroma: 420v
[00007fc99ecde330] caopengllayer vout display error: No drawable-nsobject found!
[00007fc99ecde330] macosx vout display error: No drawable-nsobject nor vout_window_t found, passing over.
[00007fc99f8b7af0] main video output error: video output creation failed
[00007fc99ec994c0] main decoder error: failed to create video output
[00007fc99ec994c0] videotoolbox decoder error: decoder failure, Abort.
[00007fc99ece5340] caopengllayer vout display error: No drawable-nsobject found!
[00007fc99ece5340] macosx vout display error: No drawable-nsobject nor vout_window_t found, passing over.
[00007fc99f8c54f0] main video output error: video output creation failed
[00007fc99ec994c0] main decoder error: failed to create video output
[h264 @ 0x7fc99f871a00] get_buffer() failed
[h264 @ 0x7fc99f871a00] thread_get_buffer() failed
[h264 @ 0x7fc99f871a00] decode_slice_header error
[h264 @ 0x7fc99f871a00] no frame!
[00007fc99ef32db0] caopengllayer vout display error: No drawable-nsobject found!
[00007fc99ef32db0] macosx vout display error: No drawable-nsobject nor vout_window_t found, passing over.
[00007fc99f0a84f0] main video output error: video output creation failed
[00007fc99ec994c0] main decoder error: failed to create video output
[h264 @ 0x7fc99f8b9000] get_buffer() failed
[h264 @ 0x7fc99f8b9000] thread_get_buffer() failed
[h264 @ 0x7fc99f8b9000] decode_slice_header error
[h264 @ 0x7fc99f8b9000] no frame!
And so on for every frame of the video. Oddly, I can hear the audio, but no video window is created. I crawled over the previously closed issue, and could not work out a solution.
The video is not shown because there is no call to player.set_nsobject(obj)
or player.set_xwindow(obj)
to specify the window to display the video.
Take a look in the examples
folder. The examples cocoavlc.py
, pyobjvlc.py
, tkvlc.py
and wxvlc.py
all call player.set_nsobject(obj)
or player.set_xwindow(obj)
where obj
is a drawable object specific to the underlying windowing kit. Those examples all work on macOS Big Sur 11.6 (on Intel and Apple Silicon) with VLC 3.0.16, provided the required dependencies are installed.
Try using
python tkvlc.py ../data/070_SHARP_Titles_Flower_Titles.mp4
since that works with recent Python versions which include Tcl/Tk
.
I understand that it is failing because it doesn’t open a window. On other platforms except Mac the window opens fine. If you look at the previous issue, there was a segfault in opening a tkinter window because of missing libraries that was never solved.
-- Wes Modes A Secret History of American River People http://peoplesriverhistory.us Pronouns: they/them
Sent from my Apple ][e
On Oct 15, 2021, at 9:46 PM, mrJean1 @.***> wrote:
The video is not shown because there is no call to player.set_nsobject(obj) to specify the window to display the video.
Take a look in the examples folder. The examples cocoavlc.py, pyobjvlc.py, tkvlc.py and wxvlc.py all call player.set_nsobject(obj) where obj is a drawable object specific to the underlying windowing kit. Those examples all work on macOS Big Sur 11.6 (on Intel and Apple Silicon), provided the required dependencies are installed.
Try using
python tkvlc.py ../data/070_SHARP_Titles_Flower_Titles.mp4
since that works with recent Python versions which include Tcl/Tk.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
Correct, older versions of VLC on macOS (or MacOS) did open a window. However, recent VLC releases no longer do and make a call to player.set_nsobject(obj)
or player.set_xwindows(obj)
necessary. It is an issue in VLC, specificallly the libVLC
library.
I still get:
% python tkvlc.py
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
[00007fad0c4352b0] videotoolbox decoder: Using Video Toolbox to decode 'h264'
[00007fad0c4352b0] videotoolbox decoder: vt cvpx chroma: 420v
[00007fad0d945d80] caopengllayer vout display error: No drawable-nsobject found!
[00007fad0d945d80] macosx vout display error: No drawable-nsobject nor vout_window_t found, passing over.
[00007fad088cc6f0] main video output error: video output creation failed
[00007fad0c4352b0] main decoder error: failed to create video output
[00007fad0c4352b0] videotoolbox decoder error: decoder failure, Abort.
[00007fad0d93fd10] caopengllayer vout display error: No drawable-nsobject found!
[00007fad0d93fd10] macosx vout display error: No drawable-nsobject nor vout_window_t found, passing over.
[00007fad0894d4f0] main video output error: video output creation failed
[00007fad0c4352b0] main decoder error: failed to create video output
[h264 @ 0x7fad0a914600] get_buffer() failed
[h264 @ 0x7fad0a914600] thread_get_buffer() failed
[h264 @ 0x7fad0a914600] decode_slice_header error
[h264 @ 0x7fad0a914600] no frame!
[00007fad0d947bf0] caopengllayer vout display error: No drawable-nsobject found!
[00007fad0d947bf0] macosx vout display error: No drawable-nsobject nor vout_window_t found, passing over.
[00007fad079f52f0] main video output error: video output creation failed
[00007fad0c4352b0] main decoder error: failed to create video output
[h264 @ 0x7fad0a926200] get_buffer() failed
[h264 @ 0x7fad0a926200] thread_get_buffer() failed
[h264 @ 0x7fad0a926200] decode_slice_header error
[h264 @ 0x7fad0a926200] no frame!
[00007fad0d93ff40] caopengllayer vout display error: No drawable-nsobject found!
[00007fad0d93ff40] macosx vout display error: No drawable-nsobject nor vout_window_t found, passing over.
[00007fad0894d4f0] main video output error: video output creation failed
[00007fad0c4352b0] main decoder error: failed to create video output
[h264 @ 0x7fad0a903400] get_buffer() failed
[h264 @ 0x7fad0a903400] thread_get_buffer() failed
[h264 @ 0x7fad0a903400] decode_slice_header error
[h264 @ 0x7fad0a903400] no frame!
% python tkvlc.py -v
tkvlc.py: 20.05.04 (tkinter 8.5 N/A)
% python --version
Python 3.7.10
I'm developing for the raspian (which works fine), but would like to do my development on my Mac if possible.
What are the python-vlc, VLC and macOS versions? Try
python vlc.py -v
Can't duplicate any of those messages with Python 3.7.6, tkvlc.py
20.12.10, python-vlc
3.0.1218, VLC
3.0.16 on macOS 11.6 Big Sur (aka 10.16):
% python3.7 tkvlc.py
[00007f8ea26bfc90] videotoolbox decoder: Using Video Toolbox to decode 'h264'
[00007f8ea26bfc90] videotoolbox decoder: vt cvpx chroma: 420v
% python3.7 tkvlc.py -v
tkvlc.py: 20.12.10 (tkinter 8.6 /Library/Frameworks/Python.framework/Versions/3.7/lib/libtk8.6.dylib)
% python3.7 vlc.py -v
vlc.py: 3.0.12118 (Tue Apr 20 20:46:07 2021 3.0.12)
LibVLC version: 3.0.16 Vetinari (0x3001000)
LibVLC compiler: clang: warning: argument unused during compilation: '-mmacosx-version-min=10.7' [-Wunused-command-line-argument]
Plugin path: /Applications/VLC.app/Contents/MacOS/plugins
Python: 3.7.6 (64bit) macOS 10.16
Likewise for Python 3.8.10, 3.9.6 and 3.10.0 with same tkvlc.py
, python-vlc
and VLC
on the same macOS. All these Python builds are straight downloads from Python.org.
This issue is definitely occurring for me also. The tkvlc.py
example presents a window but video frames don't play and I see the same errors as @wmodes.
I'm using Python 3.10, but I'm on Monterey (macOS 12.0.1). I suspect it could be a Monterey issue?
The tkvlc.py 20.05.04 from the python-vlc/examples
folder works with Python 3.10.0
and 3.9.6
(both macOS 64-bit universal2) natively on amd64 Apple-Silicon
and with Python 3.8.10
and 3.7.6
(both macOS 64-bit Intel) in emulation on x86_64 Apple-Silicon
macOS 11.6.1 Big Sur, but tested only with the latest release of VLC 3.0.16 Universal Binary and only with python-vlc.py 3.0.12118 and 3.0.12119. All cases, tkvlc.py
uses the Tk/Tcl libraries (tkinter 8.6 /Library/Frameworks/Python.framework/Versions/3.{7,8,9,10}/lib/libtk8.6.dylib
) included in the Python release.
Support of and testing on macOS Monterey is pending. In the mean time, what version of python-vlc
and VLC
are you using? Type
python3 vlc.py -v
python3 tkvlc.py -v
in a terminal window. In addition, what is the result of this Python line
python3 -c 'import platform; print(platform.machine())'
Here's what I see:
vlc.py: 3.0.12118 (Tue Apr 20 20:46:07 2021 3.0.12)
LibVLC version: 3.0.16 Vetinari (0x3001000)
LibVLC compiler: clang: warning: argument unused during compilation: '-mmacosx-version-min=10.7' [-Wunused-command-line-argument]
Plugin path: /Applications/VLC.app/Contents/MacOS/plugins
Python: 3.10.0 (64bit) macOS 12.0.1
➜ python3 tkvlc.py -v
tkvlc.py: 20.05.04 (tkinter 8.6 N/A)
➜ python3 -c 'import platform; print(platform.machine())'
arm64
The line after
python3 tkvlc.py -v
should look something like
tkvlc.py: 20.05.04 (tkinter 8.6 /Library/Frameworks/Python.framework/Versions/3.10/lib/libtk8.6.dylib)
and not
tkvlc.py: 20.05.04 (tkinter 8.6 N/A)
meaning the Tcl/Tk libraries can't be found inside Python 3.10.
Make sure Python 3.10.0 is indeed the Universal one, since you're on Apple-Silicon natively.
Interesting. I'm able to use Tk even though that is returning N/A:
Also, I'm definitely on the Apple silicon version of Python:
➜ arch -x86_64 python3
arch: posix_spawnp: python3: Bad CPU type in executable
Try
python3 -c 'import tkinter; print(tkinter.__file__)'
Perhaps, Monterey comes with Python 3.10. Not sure, just a guess.
➜ python3 -c 'import tkinter; print(tkinter.__file__)'
/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/__init__.py
That is the issue. tkvlc.py
can't find the Tcl/Tk library in that Python installation. Please try
python3 -c 'import sys; print(sys.prefix)'
➜ python3 -c 'import sys; print(sys.prefix)'
/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.10
That looks good. One more
ls -l /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/libtk*
Interesting.
python-vlc/examples on master via 🐍 system
➜ ls -l /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/libtk*
zsh: no matches found: /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/libtk*
python-vlc/examples on master via 🐍 system
➜ ls -l /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/
total 0
lrwxr-xr-x 1 rob admin 9 5 Oct 03:55 libpython3.10.dylib -> ../Python
drwxr-xr-x 6 rob admin 192 3 Nov 09:16 pkgconfig
drwxr-xr-x 208 rob admin 6656 3 Nov 09:16 python3.10
python-vlc/examples on master via 🐍 system
➜ ls -l /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/python3.10/libtk*
zsh: no matches found: /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/python3.10/libtk*
Python builds from Python.org
include libtkX.Y.dylib
in that directory. In the Homebrew version, things are different. Perhaps Homebrew installs Tcl/Tk somewhere else and Homebrew's Python finds that one. But tkvlc.py
doesn't look there and may need to be enhanced to look in other places. Being able to get the libtk.X.Y.dylib
is critical for tkvlc.py
and vlc.py
to play a video in a macOS window.
Another difference with universal
Python 3.10 from Python.org
is this: both architectures work, as expected of a universal
build.
% arch -arm64 python3
Python 3.10.0 (v3.10.0:b494f5935c, Oct 4 2021, 14:59:19) [Clang 12.0.5 (clang-1205.0.22.11)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
% arch -x86_64 python3
Python 3.10.0 (v3.10.0:b494f5935c, Oct 4 2021, 14:59:20) [Clang 12.0.5 (clang-1205.0.22.11)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
One final request. What does this show
echo $LD_LIBRARY_PATH
echo $LIBRARY_PATH
python3 -c 'from ctypes.util import find_library; print(find_library("tk"))'
or maybe some Homebrew environment variable.
That's interesting about the homebrew version. Unfortunately, I have so many brew libraries that rely on the brew version of Python that I have to install it, and I've had major issues with pyenv
on M1. I've got the official Python installer for macOS, but that installs Python in yet another location - it might be universal, though. I will try reworking my $PATH
so I can try the official version.
Here's the output. I really appreciate your patience with this.
python-vlc/examples on master via 🐍 system
➜ echo $LD_LIBRARY_PATH
python-vlc/examples on master via 🐍 system
➜ echo $LIBRARY_PATH
python-vlc/examples on master via 🐍 system
➜ python3 -c 'from ctypes.util import find_library; print(find_library("tk"))'
/usr/lib/libtk.dylib
OK, I've tested now with the universal install from Python.org - and it works. So there's something screwy with the Homebrew Python config.
➜ python3 tkvlc.py -v
tkvlc.py: 20.05.04 (tkinter 8.6 /Library/Frameworks/Python.framework/Versions/3.10/lib/libtk8.6.dylib)
➜ which python3
/usr/local/bin/python3
➜ lipo -info /usr/local/bin/python3
Architectures in the fat file: /usr/local/bin/python3 are: x86_64 arm64
Unfortunately, that file name /usr/lib/libtk.dylib
is returned by find_library('tk')
but the file does not exist, at least on on my macOS:
python3 -c 'from ctypes.util import find_library; print(find_library("tk"))'
/usr/lib/libtk.dylib
sudo ls -l /usr/lib/libtk.dylib
Password:
ls: /usr/lib/libtk.dylib: No such file or directory
There must be a way to find out where Homebrew Python3 gets libtbX.Y.dylib
form during import tkinter
. Perhaps this
python3 -v -c 'import tkinter'
and then look the the lines after these
...
Python 3.10.0 (v3.10.0:b494f5935c, Oct 4 2021, 14:59:19) [Clang 12.0.5 (clang-1205.0.22.11)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
# /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/__pycache__/__init__.cpython-310.pyc matches /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/__init__.py
# code object from '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/__pycache__/__init__.cpython-310.pyc'
# /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/__pycache__/enum.cpython-310.pyc matches /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/enum.py
# code object from '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/__pycache__/enum.cpython-310.pyc'
# /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/__pycache__/types.cpython-310.pyc matches /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/types.py
# code object from '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/__pycache__/types.cpython-310.pyc'
import 'types' # <_frozen_importlib_external.SourceFileLoader object at 0x100f3a440>
import 'enum' # <_frozen_importlib_external.SourceFileLoader object at 0x100f39300>
# extension module '_tkinter' loaded from '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/_tkinter.cpython-310-darwin.so'
# extension module '_tkinter' executed from '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/_tkinter.cpython-310-darwin.so'
import '_tkinter' # <_frozen_importlib_external.ExtensionFileLoader object at 0x100f3ae00>
...
# extension module '_tkinter' loaded from '/opt/homebrew/opt/[email protected]/libexec/_tkinter.cpython-310-darwin.so'
# extension module '_tkinter' executed from '/opt/homebrew/opt/[email protected]/libexec/_tkinter.cpython-310-darwin.so'
import '_tkinter' # <_frozen_importlib_external.ExtensionFileLoader object at 0x10126bee0>
# /opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/__pycache__/constants.cpython-310.pyc matches /opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/constants.py
# code object from '/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/__pycache__/constants.cpython-310.pyc'
import 'tkinter.constants' # <_frozen_importlib_external.SourceFileLoader object at 0x1012f4160>
import 'tkinter' # <_frozen_importlib_external.SourceFileLoader object at 0x101268700>
Doesn't show the loading of the libtkX.Y.dylib
. And _tkinter
is loaded from a different place /opt/homebrew/opt/[email protected]/libexec/_tkinter.cpython_310_darwin.so
.
So, libtkX.Y.dylib
can be anywhere. Not sure what to do next.
No Tk
mentioned here, but the name is [email protected]
, perhaps the Tcl/Tk libraries are linked into the Homebrew Python executable.
I'm struggling with this as well. I'd love to use vlc to play a random list of movie at a time for a visual behaviour experiment so any sort of resolution would mean the world to me.
@candymountain, if you used Homebrew to install Python with tkvlc.py
, the path to the libtk.dylib
is still the unresolved issue.
Otherwise, what are your versions of python-vlc
, VLC, Python and macOS? Which python-vlc/examples
do not work?
The Homebrew site shows that python-tk
is a separate install, separate from Python and separate from Tcl/Tk and the former depends on both the latter. The question remains, where does python-tk
load the Tk library from?
@rkeniger please show the output of this command lines
ls -l /opt/homebrew/opt/[email protected]/libexec/
ls -l /opt/homebrew/opt/[email protected]/
ls -l /opt/homebrew/opt/tcl-tk/libexec/
ls -l /opt/homebrew/opt/tcl-tk/
The libtk8.6.dylib
needed for tkvlc.py
is likely somewhere among those. If not, please try this command line
find /opt/homebrew -name libtk8.6.dylib
~ via 🐍 system
➜ ls -l /opt/homebrew/opt/[email protected]/libexec/
total 248
-rwxr-xr-x 1 rob admin 125824 3 Nov 09:16 _tkinter.cpython-310-darwin.so
~ via 🐍 system
➜ ls -l /opt/homebrew/opt/[email protected]/
total 64
-rw-r--r-- 1 rob admin 1867 3 Nov 09:16 INSTALL_RECEIPT.json
-rw-r--r-- 1 rob admin 13925 5 Oct 03:55 LICENSE
-rw-r--r-- 1 rob admin 10138 5 Oct 03:55 README.rst
drwxr-xr-x 3 rob admin 96 3 Nov 09:16 libexec
~ via 🐍 system
➜ ls -l /opt/homebrew/opt/tcl-tk/libexec/
ls: /opt/homebrew/opt/tcl-tk/libexec/: No such file or directory
~ via 🐍 system
➜ ls -l /opt/homebrew/opt/tcl-tk/
total 1440
-rw-r--r-- 1 rob admin 337092 31 Dec 2020 ChangeLog
-rw-r--r-- 1 rob admin 1334 3 Nov 09:09 INSTALL_RECEIPT.json
-rw-r--r-- 1 rob admin 7321 31 Dec 2020 README.md
drwxr-xr-x 15 rob admin 480 2 Nov 09:44 bin
-rw-r--r-- 1 rob admin 377078 31 Dec 2020 changes
drwxr-xr-x 49 rob admin 1568 31 Dec 2020 include
drwxr-xr-x 26 rob admin 832 2 Nov 09:44 lib
-rw-r--r-- 1 rob admin 2255 31 Dec 2020 license.terms
drwxr-xr-x 3 rob admin 96 31 Dec 2020 share
~ via 🐍 system
➜ find /opt/homebrew -name libtk8.6.dylib
/opt/homebrew/Cellar/tcl-tk/8.6.11_1/lib/libtk8.6.dylib
Thank you. Attached is a tkvlc.py
version hacked for your @rkeniger Homebrew installation. Please try to run that with Homebrew's python
.
Any chance that this tkvlc.py
files could be tested, just to make sure that it does work.
hey so im having this issue too, read through the chat here and tried that tkvlcHomebrew.py, and it is not working for me.It is returning the following repeatedly. Audio still works.
[0000000127ca3120] caopengllayer vout display error: No drawable-nsobject found!
[0000000127ca3120] macosx vout display error: No drawable-nsobject nor vout_window_t found, passing over.
[0000000132e72ef0] main video output error: video output creation failed
[0000000132719cd0] main decoder error: failed to create video output
[h264 @ 0x132ddec00] get_buffer() failed
[h264 @ 0x132ddec00] thread_get_buffer() failed
[h264 @ 0x132ddec00] decode_slice_header error
[h264 @ 0x132ddec00] no frame!
I am using macOS 11.6 on m1.