Add media codec module(s) to Flatpak project

I’m trying to figure out why some videos don’t play (specifically some play with image and no sound, and some with sound and no image) in my project, but when I run my app out of Flatpak, every test file plays perfectly.

I tested a lot of combinations of the Flatpak finish-args in the manifest file, here is what I have right now:

{
    "app-id" : "org.yphil.matinee",
    "runtime" : "org.gnome.Platform",
    "runtime-version" : "43",
    "sdk" : "org.gnome.Sdk",
    "command" : "matinee",
    "finish-args" : [
        "--share=ipc",
        "--socket=fallback-x11",
     	"--socket=wayland",
	    "--device=dri",
        "--socket=pulseaudio",
	    "--share=network",
        "--device=all",
        "--filesystem=xdg-run/pipewire-0:ro",
        "--filesystem=xdg-videos",
        "--filesystem=xdg-run/gvfsd",
        "--talk-name=org.gtk.vfs.*",
        "--talk-name=org.gnome.Shell"
    ],
    "cleanup" : [
        "/include",
        "/lib/pkgconfig",
        "/man",
        "/share/doc",
        "/share/gtk-doc",
        "/share/man",
        "/share/pkgconfig",
        "*.la",
        "*.a"
    ],
    "modules" : [
        {
            "name" : "matinee",
            "builddir" : true,
            "buildsystem" : "meson",
            "sources" : [
                {
			"type" : "git",
			"url" : "file:///home/px/Projects/matinee",
			"branch" : "dev"
                }
            ]
        }
    ]
}

I noticed that the audio codec of the files that play without sound is liba52, and I found something about it in the manifest file of Clapper, another Gtk / Flatpak project. Some other of those “modules” seem like they’d be useful to me, too ; How can I install those dependencies?

After all, I did had to install some system packages for all the videos to play (even in Totem) and apparently Flatpak doesn’t know about all of them…
How can I properly add those media dependencies to my project?

For the sake of experiment, I cloned the Clapper repository (if only somewhere existed a Flatpak project using Gtk.Video) and replicated its chain of dependencies ; Read on, it’s fun:

I first tried to install liba52 alone, but it changed nothing. So I :

  • Copied the Clapper /lib directory - the files are pointers to git source code repositories, as well as patches (!) to apply.

  • Cloned the flathub/shared-modules git repo as a sub-module

  • Added all the refs in the modules section of my manifest file

  • Lauched the build

Meson downloaded, patched, built and install a LOT of packages, it took like 5 to 10 minutes but the project built and ran, and WOW I had sound and image in all of my video test files :slight_smile:

But

  • The image hue was all reddish
  • I got nasty X11 warnings (oh, and the app would not run anymore in Gnome Shell Wayland)
  • At the subsequent run, the whole clone, DL, build & install process started again (waiting 5 minutes between each edit / run, party like it’s 1992!)
  • Still, this was both fun and interesting

So now, I’m going to have to test all those dependencies one by one :rowing_man: to try and determine which one (or combination thereof) is it that my project actually needs.

In the meantime, if anybody knows a way to embark the codecs (specifically ATSC A/52 multichannel audio, and vah264dec) in my project’s flatpak package, please point me towards the light, this is the last obstacle preventing the first beta.

It seems that this flathub/shared-modules package is what I need, but what is the correct way to install it?

Even better: A search for flatpak remote-ls flathub | grep -i codec returns

Codecs  com.github.Eloston.UngoogledChromium.Codecs             stable
Codecs  org.audacityteam.Audacity.Codecs                stable
Codecs  org.blender.Blender.Codecs              stable
Codecs  org.chromium.Chromium.Codecs            stable
Codecs  org.gnome.Totem.Codecs          stable
Codecs  org.pitivi.Pitivi.Codecs                stable

See that org.gnome.Totem.Codecs? I’m pretty confident that this package would solve my problem (given that Totem does play my test files OK) but how can I actually use it?