Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player not opening in MacOS #253

Open
Aniruddh-J opened this issue May 2, 2023 · 5 comments
Open

Player not opening in MacOS #253

Aniruddh-J opened this issue May 2, 2023 · 5 comments

Comments

@Aniruddh-J
Copy link

Hello,

I installed mpv using Homebrew and tested if it is working with the command mpv {filename} but it doesn't work using this Python library:

player.play(video_file)
player.wait_until_playing() // or player.wait_for_playerback()
@jaseg
Copy link
Owner

jaseg commented Jun 3, 2023

I cannot help you with that since I don't have an Apple device to test this on. Here's a few suggestions of what you could try:

  1. Double-check that the mpv version of your command-line mpv binary and of libmpv are the same. You can get the version of the command-line binary by running mpv --version (first line of output), and the version of libmpv by running import mpv; player = mpv.MPV(); print(player.mpv_version).
  2. Make python-mpv output debug log messages, and check for any errors. You can do that by setting log_level and registering a log handler like this:
def my_log(loglevel, component, message):
    print('[{}] {}: {}'.format(loglevel, component, message.strip()))
player = mpv.MPV(log_handler=my_log, loglevel='debug')
  1. Try changing the video output (--vo option in the command-line utility, vo parameter to mpv.MPV(...))
  2. Make sure you don't have to set some environment variable such as $DISPLAY on your shell to get libmpv to find your display output

@frankchau93
Copy link

I'm running into the same issue. The debug logs look like it's running but nothing shows. Just a python icon that pops up but no player.

@EngineersNeedArt
Copy link

EngineersNeedArt commented Oct 2, 2024

Also on MacOS (Apple Silicon). Wilder still, I hear the video playing back, do not see the window/image.

Both versions of mpv match.

From debug-level log:

[error] vo/gpu-next/vulkan: Failed to initialize macvk context, no NSApplication initialized.
[fatal] cplayer: Error opening/initializing the selected video_out (--vo) device.

@EngineersNeedArt
Copy link

EngineersNeedArt commented Oct 2, 2024

Since command-line on MacOS works, ran in verbose mode. I see:

[vo/gpu/libplacebo] Failed creating instance: VK_ERROR_EXTENSION_NOT_PRESENT
[vo/gpu/libplacebo] Failed initializing vulkan instance
[vo/gpu/vulkan] Initializing GPU context 'macvk'
[vo/gpu/libplacebo] Initialized libplacebo v7.349.0 (API v349)
[vo/gpu/libplacebo] Creating vulkan instance with extensions:

Compare this to logging from Python on same OS:

[v] vo/gpu/libplacebo: Failed creating instance: VK_ERROR_EXTENSION_NOT_PRESENT
[v] vo/gpu/libplacebo: Failed initializing vulkan instance
[v] vo/gpu/vulkan: Initializing GPU context 'macvk'
[error] vo/gpu/vulkan: Failed to initialize macvk context, no NSApplication initialized.
[v] vo/gpu-next: Probing for best GPU context.

Obviously they diverge in the last two logs.

Maybe there's a clue in the above as to how the C/L handles video playback more robustly on MacOS.

@hany
Copy link

hany commented Jan 13, 2025

I just ran into the same issue. mpv works on the command line, but not from mpv.py. The error I'm getting:

[error] vo/gpu-next/vulkan: Failed to initialize macvk context, no NSApplication initialized.
[error] vo/gpu-next: Failed initializing any suitable GPU context!
[fatal] cplayer: Error opening/initializing the selected video_out (--vo) device.
[info] cplayer: Video: no video

System: M4 MacBook Pro
mpv version: 0.39.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants