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

Gstreamer does not work with appimage-builder packaged app #163

Open
akontsevich opened this issue Oct 26, 2021 · 15 comments
Open

Gstreamer does not work with appimage-builder packaged app #163

akontsevich opened this issue Oct 26, 2021 · 15 comments

Comments

@akontsevich
Copy link

akontsevich commented Oct 26, 2021

Preamble

QGroundControl AppImage built with appimagetool works fine with gstreamer if development packages were installed in build environment before building it:

sudo apt-get install -y libgstreamer-plugins-base1.0-dev \
    libgstreamer1.0-0:amd64 libgstreamer1.0-dev

QGroundControl AppImage is being built under Ubuntu 18.04 docker environment and does not contain gstreamer libraries within. And it works fine in Ubuntu 20.04 just utilizing system installed gstreamer, and does not work on 18.04 also with system gstreamer for some reason.

Problem

Our application is a fork of QGroundControl as you may remember. Our AppImage is built with appimage-builder and does not work with gstreamer at all. If we do not include gstreamer in app bundle, it does not translate video in both 18.04 or 20.04, and in 20.04 it produces error:

 GStreamer-WARNING **: 00:05:19.025: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstlibav.so': /lib/x86_64-linux-gnu/libharfbuzz.so.0: undefined symbol: FT_Done_MM_Var

if we include gstreamer into the yaml like this:

    include:
      - libgstreamer1.0-0
      - libgstreamer-plugins-base1.0-0
      - libgstreamer-plugins-bad1.0-0
      - gstreamer1.0-libav

we get no video as well and bunch of gstreamer errors in the console like this:

VideoReceiverLog: gst_element_factory_make() for data source failed
VideoReceiverLog: _makeSource() failed
VideoReceiverLog: Failed

How to solve this issue? What you may suggest here? Could we fix this or need to switch to linuxdeploy with its gstreamer plugin?

@azubieta
Copy link
Contributor

azubieta commented Oct 27, 2021

We just added an example recipe for the Parole media player. This uses recipe bundles gstreamer and works. Also we added support for building the gstreamer plugins cache so it doesn't delay the application startup.

Regarding your recipe, not bundling gstreamer is not warranted to work (at least we cannot give that warranty) as there is not backward of forward compatibility of binaries between the embed libs and the plugins in the system. Therefore, you need to embed all the plugins you will need.

Another important note, you must ensure that the embed binaries are the same as the ones used for building otherwise unexpected things may happen (like missing symbols).

@akontsevich
Copy link
Author

We just added an example recipe for the Parole media player. This uses recipe bundles gstreamer and works. Also we added support for building the gstreamer plugins cache so it doesn't delay the application startup.

So I should use latest appimage-builder?
pip3 install git+https://github.com/AppImageCrafters/appimage-builder.git
in docker?

Ok, will try this now, however I already tried to include all the gstreamer libraries.

Regarding your recipe, not bundling gstreamer is not warranted to work (at least we cannot give that warranty) as there is not backward of forward compatibility of binaries between the embed libs and the plugins in the system. Therefore, you need to embed all the plugins you will need.

Ok, will try, for now my recipe looks like this:

    include:
      - ...
      - libgstreamer1.0-0
      - libgstreamer-plugins-base1.0-0
      - libgstreamer-plugins-bad1.0-0
      - gstreamer1.0-x
      - gstreamer1.0-alsa
      - gstreamer1.0-plugins-base
      - gstreamer1.0-plugins-good
      - gstreamer1.0-plugins-bad
      - gstreamer1.0-plugins-ugly
      - gstreamer1.0-pulseaudio
      - gstreamer1.0-libav
      - ...

Another important note, you must ensure that the embed binaries are the same as the ones used for building otherwise unexpected things may happen (like missing symbols).

Same - from Ubuntu 18.04 (focal):

  apt:
    arch: amd64
    sources:
      - sourceline: 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse'
        key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3b4fe6acc0b21f32'
      - sourceline: 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse'
      - sourceline: 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse'

@akontsevich
Copy link
Author

Result: no gstreamer error, however no video as well:

(AirBossMissionPlanner:4182650): GLib-GObject-CRITICAL **: 23:49:08.440: g_object_set: assertion 'G_IS_OBJECT (object)' failed
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
(AirBossMissionPlanner:4182650): GLib-GObject-CRITICAL **: 23:49:08.440: g_object_set: assertion 'G_IS_OBJECT (object)' failed
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
VideoReceiverLog: Unable to find sink pad of video sink "udp://0.0.0.0:5600"
Adding target QHostAddress("127.0.0.1") 18570
Adding target QHostAddress("127.0.0.1") 14530

Do You think some plugin is still missed, @azubieta?

@azubieta
Copy link
Contributor

@akontsevich could you share the resulting bundle for inspection ?

You could use the information here to debug gstreamer: https://gstreamer.freedesktop.org/documentation/gstreamer/running.html?gi-language=c#running-and-debugging-gstreamer-applications

@akontsevich
Copy link
Author

@akontsevich could you share the resulting bundle for inspection ?

Unfortunately, no.

You could use the information here to debug gstreamer: https://gstreamer.freedesktop.org/documentation/gstreamer/running.html?gi-language=c#running-and-debugging-gstreamer-applications

Thanks, will try this.

@azubieta
Copy link
Contributor

Unfortunately, no.

No worries, if the problem persist you could try making a minimal app to test this feature. Or we could use QGroundControl.

@akontsevich
Copy link
Author

akontsevich commented Oct 27, 2021

Unfortunately, no.

No worries, if the problem persist you could try making a minimal app to test this feature. Or we could use QGroundControl.

Yes, we can use QGroundControl - as it has exactly the same problem. Let me give You our recipe renamed to QGroundControl:

QGroundControl.appimage-builder.yaml.txt

@akontsevich
Copy link
Author

You could use the information here to debug gstreamer: https://gstreamer.freedesktop.org/documentation/gstreamer/running.html?gi-language=c#running-and-debugging-gstreamer-applications

That works but prints too many info. Could You suggest some debug filters?

@akontsevich
Copy link
Author

akontsevich commented Oct 27, 2021

I run our app with GST_DEBUG=*:WARNING,*video*:LOG:

  1. From Qt Creator (video and system Gstreamer work fine)
  2. From AppImage (built in GStreamer)

Both logs are attached to compare. I think I know what is missed: according to the log need ti install libx264-... and probably libx265-....

qtc_log.txt

appimage_log.txt

@akontsevich
Copy link
Author

akontsevich commented Oct 27, 2021

I've added

      - libx264-152
      - libx265-146

to include section however still getting gstreamer error:

ERROR x264enc gstx264enc.c:163:load_x264: 
Failed to load '/usr/lib/x86_64-linux-gnu/x264-10bit/libx264.so.152'

what is missed there? Why it wants to load x264-10bit?! While it has 2 .so files there:

/usr/lib/x86_64-linux-gnu/libx264.so.152
/usr/lib/x86_64-linux-gnu/x264-10bit/libx264.so.152

@akontsevich
Copy link
Author

@azubieta any chance to fix this or need to switch to linuxdeploy?

@azubieta
Copy link
Contributor

azubieta commented Nov 11, 2021

@akontsevich I have checked it but my knowledge on GStreamer seems to not be enough to spot a fix.

You could give a try to linuxdeploy if you want but I'm cannot warrant that it would work there.

@akontsevich
Copy link
Author

akontsevich commented Nov 11, 2021

@akontsevich I have checked it but my knowledge on GStreamer seems to not be enough to spot a fix.

@azubieta but could You at least check it reads Gstreamer plugins from the right place - AppImage temp folder, not system folders?

@akontsevich
Copy link
Author

Hi @azubieta read this message please: linuxdeploy/linuxdeploy-plugin-gstreamer#8 (comment). I extracted AppImage build with linuxdeploy and see it has only 1 libx264.so.152 in the /usr/libdir. Do not have appimage built with appimage-builder, however I think appimage-builder could have same problem: x264 plugin directory structure should be preserved like in the original package:

/usr/lib/x86_64-linux-gnu/libx264.so.152
/usr/lib/x86_64-linux-gnu/x264-10bit/libx264.so.152

And that could be the problem. What do you think?

@akontsevich
Copy link
Author

No, You do preserve.

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

2 participants