GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Hardware decoding with libmpv · Issue #300 · jaseg/python-mpv

Hardware decoding with libmpv #300

New issue
Copy link
New issue
Copy link
Open
Open
Hardware decoding with libmpv#300
Copy link

Description

@shibotto
shibotto
opened on Jul 25, 2025
Issue body actions

I'm currently trying to use this inside a GTK+ 3 window on X11, but I chose the OpenGL approach because I want it to work on Wayland as well. This means that to embed it I need to use vo=libmpv, which works fine, although I'm having a hard time making vaapi work for hardware decoding. For reference, I'm doing a mix of your gist example and https://github.com/trin94/python-mpv-gtk4.

Digging around libmpv and OpenGL, I found https://www.ccoderun.ca/programming/doxygen/mpv/structmpv__opengl__init__params.html, which says it is fully supported, but needs to be set up. So I digged more and I found mpvqt (used by Haruna) and celluloid which seem to do this. The problem is that they are in C++ and C respectively and I'm not sure how to translate it to Python.

I kinda figured that I need to pass either "x11_display=" or "wl_display=" to MpvRenderContext() (mainly because it doesn't complain about them, to be honest), but then I'm not sure what the "display" argument should be. Trying to copy Celluloid for GTK, I arrived at something like

display = GdkDisplay.get_default()
x11_display = display.get_xdisplay()

but of course I can't just pass that and I'm not so versed in C to really understand what's going on (is it expecting a pointer?). Do you think you can help me out?

Activity

  1. shibotto commented on Jul 27, 2025

    @shibotto
    shibotto
    on Jul 27, 2025
    Author
    More actions

    One step at a time. I am able to use vaapi on GTK 4 with X11 adding the following:

    gi.require_version("Gdk", "4.0")
    from gi.repository import Gdk
    
    ...
    
            display = Gdk.Display.get_default()
            self._ctx = MpvRenderContext(
                ...
                x11_display=hash(display.get_xdisplay())
            )

    As far as I understood it's not possible on GTK+ 3 with X11, as it only uses GLX for OpenGL, while MPV's vaapi requires EGL.

    I have still no idea how to make it work on Wayland. I quickly tried in weston but Gdk.Display.get_default() returned None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.