Unable to find required libraries to run embedded mpv player in PyQt5

Hi. I developed a PyQt5 application that has an embedded MPV player. I am using the python-mpv (https://github.com/jaseg/python-mpv) module. I snapped the application, but every time I install and run the snap, the MPV player shows a white screen instead of the video. The reason I think I am missing some libs or configurations is that when I run the only binaries (without snapping), the app works fine and MPV plays every video perfectly.

I think I am missing something in /snap/cluemaster-mediadisplay/usr/lib that exists in my pc’s /usr/lib.

Here is my snapcraft.yaml:

name: cluemaster-mediadisplay # you probably want to 'snapcraft register <name>'
base: core20 # the base snap is the execution environment for this snap
version: '0.4.11' # just for humans, typically '1.2+git' or '1.3.2'
summary: Clumaster.io Media Display for Escape Rooms # 79 char long summary
description: |
  ClueMaster Media Display is a Dynamic TV Display software for escape rooms.
  It shows escape room countdown timers, visual text messages, video, audio,
  and photo clues.
   
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots


plugs:
  personal-files:
    interface: personal-files
    read: 
      - $HOME/.config/cluemaster_mediadisplay
    write:
      - $HOME/.config/cluemaster_mediadisplay

apps:
  cluemaster-mediadisplay:
    command: bin/desktop-launch $SNAP/cluemaster_display
    plugs:
      - home
      - desktop-legacy
      - desktop
      - wayland
      - x11
      - unity7
      - network
      - opengl
      - gsettings
      - pulseaudio
      - network-bind
      - screen-inhibit-control
      - audio-playback
      - personal-files
      - locale-control
      - process-control
      -  network-control
      - mount-observe
     
    environment:
      LD_LIBRARY_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio/:$SNAP/usr/lib/xorg/
      LIBGL_DRIVERS_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
      LIBVA_DRIVERS_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri

parts:
  cluemaster-mediadisplay:
    plugin: dump
    source: cluemaster_display/
    stage-packages:
      - libcanberra-gtk3-module
      - libdrm2
      - mesa-vdpau-drivers
      - libmpv-dev
      - libmpv1
      - freeglut3
      - libglu1-mesa
      - vdpau-driver-all
      - libdrm-amdgpu1
      - va-driver-all
      - autoconf
      - libtool
      - libdrm-dev
      - xorg
      - xorg-dev
      - openbox
      - libx11-dev
      - libgl1-mesa-glx
      - mesa-va-drivers
      - intel-media-va-driver
      - libva2
      - libvdpau1
      - libegl1-mesa
      - libwayland-client0 
      - libwayland-cursor0
      - libwayland-egl1-mesa
      - libpulse0
      - libva-glx2
      - libvdpau-va-gl1
      - ffmpeg
      - mpv
      - libdouble-conversion3
      - libegl1
      - libfontconfig1
      - libfreetype6
      - libgbm1
      - libgl1
      - libglvnd0
      - libglx0
      - libgraphite2-3
      - libharfbuzz0b
      - libice6
      - libjpeg-turbo8
      - libpng16-16
      - libsm6
      - libwayland-server0
      - libx11-6
      - libx11-xcb1
      - libxau6
      - libxcb-glx0
      - libxcb-xkb1
      - libxcb1
      - libxdmcp6
      - libxkbcommon-x11-0
      - libxkbcommon0
      - libxrender1

    after: [desktop-qt5]

  desktop-qt5:
    source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
    source-subdir: qt
    plugin: make
    make-parameters: ["FLAVOR=qt5"]
    build-packages:
      - build-essential
      - qtbase5-dev
      - dpkg-dev
    stage-packages:
      - libxkbcommon0
      - ttf-ubuntu-font-family
      - dmz-cursor-theme
      - light-themes
      - adwaita-icon-theme
      - gnome-themes-standard
      - shared-mime-info
      - libqt5gui5
      - libgdk-pixbuf2.0-0
      - libqt5svg5 # for loading icon themes which are svg
      - try: [appmenu-qt5] # not available on core18
      - locales-all
      - xdg-user-dirs
      - fcitx-frontend-qt5

I have also tried to debug the snap using snappy-debug and here is the log : https://pastebin.com/UTnPhZji

Thanks in advance.

Just an update: Today I again tried the snapped version of the app. It played the video first time and then when It proceeded to play the second video, the player showed the WHITE screen instead of the video.

“I am using multiple instances of MPV for playing the videos for different windows”-

The trick that worked for me, if anyone came across this thread was I changed the way I called the QWidgets that contained the mpv instances and it worked.

1 Like