Video playback using Qt in a Snap

Hello how are you?
I am starting with Ubuntu-Frame, using an app in Qt5.12 which I already have compiled. Basically what it does is show a video from a remote url.

The app in Ubuntu 20.4 works perfectly, but, when I install it as a snap on another Ubuntu-frame machine, it boots perfectly, but the video never plays. I don’t have a visible error either.

  • The Qt plugins were installed, otherwise it would not start (I made sure of that).
  • The codecs are installed.
  • The entire app works, except for the video.

Any idea or example for ubuntu Core with Wayland?

Thank you.

1 Like

Hi @cristianmontano,

From your description it isn’t clear where things are going wrong.

When you say your application works on Ubuntu 20.4 does that mean Ubuntu Desktop or Ubuntu Server?

Is that running natively? Or when confined as your snap?

Is that running as a Wayland client against Mutter? As an X11 client against Mutter? Or as a Wayland client against Ubuntu Frame?

It seems like you have everything working on the Ubuntu Frame side of things and that your problem is with video playback.

What are you running Ubuntu Core on? What graphics drivers are you packaging with your snap? For example, Mesa support for hardware video decoding is mostly for Intel graphics.

Could you check the logs of your application for errors? (And, if that isn’t informative, those of Ubuntu Frame.)


PS
We’ve split this post off into its own topic as it has nothing to do with the driver requirements for running mir-kiosk.

Thank you very much for your quick response Alan.

Development on an Ubuntu Desktop 20.04 with X11.
In this team, the app works correctly, since it is the development team.

Now, when I generate the snap, and install it on another computer, which runs Ubuntu-core 20.04 (I also tried ubuntu-server 20.04), within the confinement the video playback does not work, but the rest of the app, network, does. image upload, etc.
This team runs Ubuntu-frame with Wayland.
It is an Intel Celeron CPU 3965U with integrated graphics intel i915

Una parte del paquete snap:

apps:
  daemon:
    command-chain:
      - bin/run-daemon
      - bin/wayland-launch
    command: bin/pepino
    daemon: simple
    restart-condition: always

  pepino: #mir-kiosk-apps:
    command-chain:
      - bin/wayland-launch
    command: bin/pepino
    plugs:
      - opengl
      - wayland
      - home
      - network
      - pulseaudio
      - network-bind
      - x11-plug


plugs:
  network:
  network-bind:
  opengl:
  wayland:
  home:
  pulseaudio:
  audio-playback:
  alsa:
  mount-observe:
  removable-media:
  graphics-core20:
    interface: content
    target: $SNAP/graphics
    default-provider: mesa-core20

The mesa block in my snapcraft.yaml:

  mesa:
    plugin: nil
    stage-packages:
      - libgl1-mesa-dri
      - libwayland-egl1-mesa
      - libglu1-mesa
      - va-driver-all
      - i965-va-driver-shaders
        #- mesa-utils
        #stage-snaps: [mir-kiosk-x11]

The environment block in my snapcraft.yaml:

environment:
  # Qt Platform to Wayland
  QT_QPA_PLATFORM: wayland
  QTCHOOSER_NO_GLOBAL_DIR: 1
  QT_SELECT: snappy-qt5
  LD_LIBRARY_PATH: ${SNAP}/usr/lib/:${SNAP}/usr/lib/x86_64-linux-gnu/
  # Prep EGL
  __EGL_VENDOR_LIBRARY_DIRS: 
  $SNAP/etc/glvnd/egl_vendor.d:$SNAP/usr/share/glvnd/egl_vendor.d
  LIBGL_DRIVERS_PATH: ${SNAP}/usr/lib/x86_64-linux-gnu/dri
  LIBVA_DRIVERS_PATH: ${SNAP}/usr/lib/x86_64-linux-gnu/dri

[Note: I’ve added pre-format marks “```” around your yaml, please remember that in future - alan_g]

snapcraft.yaml

In the interests of identifying the problem it seems a good idea to:

  1. Test the unsnapped application with Wayland on Ubuntu Desktop; and,
  2. Also to test the snapped application there.

If either, or both, of these exhibit the problems you’ve seen then check the logs from your application for errors.

Perfect, I’m going to build a pc for testing.

Thank you very much from the heart!!

Not sure why you need to build a PC for testing: you just need to sign into a Wayland session on the one you’ve been using Xorg on.

On my pc with ubuntu 20.04, I don’t have wayland enabled, I don’t have the option to start it, since I use nvidia drivers (I think this is the reason …). But it is not a problem to build another pc, it is even more comfortable for me than touching my development environment.

Well, I installed on Celeron machine with integrated Gpu intel i915, Ubuntu 20.04.03 Desktop. I did a minimal installation, no video codec, no extras, so that I have a 100% clean system.

Within a session using Wayland, I was testing the binary of my application, and according to the errors, I installed the necessary packages with apt-get install [pkg]. The ones necessary for the app to work are:

Blockquote
libqt5qml5
libqt5gui5
libqt5quick5
libqt5virtualkeyboard5
qml-module-qtquick-virtualkeyboard
libqt5multimedia5
libqt5multimediaquick5
qml-module-qtmultimedia
qml-module-qtquick2
qml-module-qtquick-layouts
libqt5quickcontrols2-5
libqt5quicktemplates2-5
qml-module-qtquick-controls2
qml-module-qtquick-templates2
qml-module-qtquick-window2
libqt5quickparticles5
qml-module-qtquick-particles2
qml-module-qtgraphicaleffects
libqt5hunspellinputmethod5
qtvirtualkeyboard-plugin
qml-module-qt-labs-folderlistmodel
libqt5multimedia5-plugins
libqt5multimediagsttools5
libqt5multimediawidgets5
libqt5opengl5
gstreamer1.0-plugins-bad
gstreamer1.0-libav
Blockquote

With these packages installed, the application runs smoothly, doing a ./myApplication in a console. This is ok.

SNAP:
Then package the app in a snap, using the same requirements mentioned above:

I installed it on the same machine, and when I run the Snap, the application starts without problems, and when playing video, the error is:

Blockquote
Using Wayland-EGL
Using the ‘xdg-shell’ shell integration
Warning: “No decoder available for type ‘video/x-msvideo’.”
Warning: “No decoder available for type ‘audio/x-wav’.”
Error: “Your GStreamer installation is missing a plug-in.”
Error: “Your GStreamer installation is missing a plug-in.”
Blockquote

Check the environment variables and I see them well set, and the video plugins are installed inside the confinement, I keep trying, but I can’t find what I’m missing.

This is clearly a problem with the GStreamer setup in your snap and nothing to do with Mir. (So you’re asking in the wrong place - the snapcraft forums are more likely to have people with the right knowledge.)

I don’t know where GStreamer looks for plugins, but I would guess you either need to set a GST_ environment variable to tell it to look in the $SNAP filesystem; or, if that doesn’t work, use a layout: entry to bind mount the files it needs to the location it is looking.

That .yaml looks very messy.

Here’s a simpler example using Qt (but doesn’t help with your GStreamer problem):

https://github.com/AlanGriffiths/iot-qt-example

Thanks, I will accommodate the snapcraft. It is my first “snap” and it has been a challenge to package an app from the unknown. But we are on our way. Thanks again.-

I’m going to try some things today based on these data and I find the solution, I post it here, and I close the issue. If at the end of the day I do not find the solution, I will also close the issue. Thanks Alan.

Well, I tried the new yaml and the situation is the same logical, although more propitious haha.

The problem is in the Snap, which for some reason cannot find the gstreamer libraries. It is not a problem in Qt, it is likely that it is from some environment variable, although I spent the whole week working with them and I could not advance, so they close the post.

Thank you very much Allan.

Your biggest problem is asking for help in the wrong place (initially a discussion of the drivers Mir works with).

For help with using the gstreamer libraries in a snap I suggest the likeliest place to find help is where people building snaps hang out:

[Update]

Searching for gstreamer there quickly leads to:

HTH