mmatyas / pegasus-frontend

A cross platform, customizable graphical frontend for launching emulators and managing your game collection.
http://pegasus-frontend.org
Other
1.18k stars 105 forks source link

Minimum required Gstreamer plugins to show videos? #40

Closed shantigilbert closed 6 years ago

shantigilbert commented 7 years ago

I tried to look for this on the wiki but I could not find it, right now when I compile QT+Pegasus it takes about (I think) 200mb in total, which is a bit too much for a FE on an embedded system, so I've been trying to reduce it to the bare minimum, I already skip a lot of QT modules that are not needed.

-skip qtxmlpatterns -skip qtx11extras -skip qtwinextras -skip qtspeech -skip qtdatavis3d -skip qtcharts -skip qtandroidextras -skip qt3d -skip qtlocation -skip qtmacextras -skip qtdoc -skip qtdatavis3d -skip qtpurchasing -skip qtnetworkauth -skip qtscript -skip qtwebengine -skip qtwebview"

The problem seems to be that I also need the gst-plugins-base, gst-libav and gst-plugins-good for Gstreamer to be able to show videos, so I assume that is what is taking most of the space, but how do I know which plugins to delete as to not affect Pegasus?

if I don't use the plugins Pegasus runs but it doesn't show videos (at least not the mp4 videos I have).

Another solution, which I am not sure if its possible with QT, would be to use FFMPEG (or VLC) to show the videos, like ES does it. FFMPEG is used a lot on my system so it would not require more space.

mmatyas commented 7 years ago

Yeah, I agree that the gstreamer packages are huge and have way too many dependencies. I'm not really comfortable installing them all either. The minimal required gstreamer plugins would depend on what kind of encoding your videos use (eg. H264, VC9, ...), but it seems you can't install them individually by default.

I've heard about an FFMPEG gstreamer plugin, which should do exactly what you described; using the system installed FFMPEG, while providing a light interface above it. I haven't tried it yet, but it would certainly worth looking into that.

Another alternative would be to write a Qt plugin that uses OMX or FFMPEG directly. There is a proof-of-concept project for that too, so we probably wouldn't need to start writing that from scratch.

shantigilbert commented 7 years ago

Well my idea was to delete the "extra" plugins after they are compiled and only copy the ones that are really needed, but so far my attempts have not been successful as it seems the dependencies are all over the place, I'll keep trying tho :)

If you can it would be great to try and use FFMPEG for videos (not sure about OMX since my system does not support it :( AFAIK is only for RPI? ) its not a matter of urgency as I am sure there other more important things to tackle first.

EDIT: that FFMPEG plugin looks promising, I will try and compile it and see if videos are shown!

mmatyas commented 7 years ago

Ah yes, OMX is for hardware accelerated video playback on the Raspberries.

It would also worth trying to build gstreamer and/or its plugins from source, in case some of the bugs have already been fixed.

shantigilbert commented 7 years ago

Yes, I build all the plugins from source, that is why I would be able to delete the ones not needed.

That FFMPEG Gstreamer plugin looks promising, I will try and compile it today see if videos play and the size is reduced!

mmatyas commented 7 years ago

Great, thanks!

shantigilbert commented 7 years ago

Unfortunately gst-ffmpeg is the same as gst-libav which I was already using :( and if you don't compile the plugins I get this error:

defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"

and no video is shown.

shantigilbert commented 7 years ago

I was able to reduce Pegasus-FE+QT-Everywhere+Gstreamer+GSTplugins-base,GST-plugins-good and GSTlibav to 30.6mb by removing a LOT of the QT unused modules.

so that works for me :)

in case you want to know which QT modules I skipped: https://github.com/shantigilbert/LibreELEC.tv/blob/Sx05RE/packages/sx05re/experimental/pegasus-frontend/qt-everywhere/package.mk

mmatyas commented 7 years ago

Nice! You can reduce it even more (~18mb, ~7-8mb zipped) if you build it statically, and disable some unused features in the Qt core too (see configure -list-features). These flags aren't that well supported (eg. may cause unexpected build problems or missing runtime features), but you can reduce several MBs with the right set. I'm currently experimenting with these flags on Raspbian, and they seem to be working correctly (I'm using them for the continuous build). There at least a hundred flags, so feel free to experiment :)

You might have turned off a bit too many though:

As for gstreamer, how big is your custom build? Does it work well in Pegasus without installing any gstreamer plugins and dependencies? Does gst-libav help?

Also for more debugging, export QT_LOGGING_RULES=qt.multimedia.*=true might help, and I think gstremer also has some debug env var too.

shantigilbert commented 7 years ago

Everything that I tried works perfectly fine, gamepad, video, images. Not sure about translations as I only have English right now. Could it be because LE has udev and libinput support already ?

I didn't modify gstreamer yet, it seems I have to do it on a trial and error basis and I haven't found a fast way to do it, but I still plan on doing it one way or the other.

I am going to try and build it statically and see if I can save more!

I haven't noticed I disabled strip, I usually do this at night and sometimes I am to sleepy :p I will fix that and check the typo ! Thanks for your help !

shantigilbert commented 7 years ago

when I compile QT as static I get this while building Pegasus

*** No rule to make target '/home/sg/sx05re/Kszaq/build.Sx05RE-S905.arm-1.6.5/qt-everywhere-5.9.1/.install_pkg/usr/local/qt5/lib/libQt5Gui.a', needed by 'libbackend.a'. Stop.

is there a flag that Pegasus needs to know its using static libs?

mmatyas commented 7 years ago

Hm, does libQt5Gui.a exist on the Qt install path? Pegasus itself won't need any other flags, though a clean build never hurts.

What you might need for static builds however, is creating two symlinks:

ln -s ../frontend src/app/qml-frontend;
ln -s ../themes/pegasus-grid src/app/qml-theme;

because sometimes Qt have troubles finding out the required QML modules.

For gstreamer, video playback works fine too? So you don't get garbled/corrupted output for certain video types?

shantigilbert commented 7 years ago

On the videos I use which are MP4 they work perfectly fine, don't know about other formats.

I can give you all the details of the video later.

The file does exists but for some reason it doesn't find it, I am going to try with the symlinks :), although I reduced the size so much not sure it is still worth investigating.

On Sun, Jul 2, 2017, 3:08 PM Mátyás Mustoha notifications@github.com wrote:

Hm, does libQt5Gui.a exist on the Qt install path? Pegasus itself won't need any other flags, though a clean build never hurts.

What you might need for static builds however, is creating two symlinks:

ln -s ../frontend src/app/qml-frontend; ln -s ../themes/pegasus-grid src/app/qml-theme;

because sometimes Qt have troubles finding out the required QML modules.

For gstreamer, video playback works fine too? So you don't get garbled/corrupted output for certain video types?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mmatyas/pegasus-frontend/issues/40#issuecomment-312514006, or mute the thread https://github.com/notifications/unsubscribe-auth/ARxYEqbvDAG2bUuZFSEK8PxxelxLmsd5ks5sJ_i-gaJpZM4OK4Sm .

mmatyas commented 6 years ago

As the original problem got resolved I guess this issue can be closed now. For archiving purposes, here's the current status of GStreamer support, copied from the forum:


I've played around with the GStreamer packages:

So it seems something's broken in the Qt Multimedia module's hardware acceleration support; I'll probably have to write a custom plugin or see if I can patch it. Until then, you can get the best results with the gstreamer1.0-alsa gstreamer1.0-libav gstreamer1.0-plugins-good packages.