Add gstreamer package
Description
Add gstreamer package
Fixes #3511
Checklist
- [x] Build rule
all-supportedcompleted successfully - [ ] New installation of package completed successfully
- [ ] Package upgrade completed successfully (Manually install the package again)
- [ ] Package functionality was tested
- [ ] Any needed documentation is updated/created
Type of change
- [ ] Bug fix
- [x] New Package
- [ ] Package update
- [ ] Includes small framework changes
- [ ] This change requires a documentation update (e.g. Wiki)
This would also fix #3511
~@th0ma7 please do not remove native/glib to prevent merge conflicts with #4337. native/glib is still required by cross/avahi in #4337 that I am working on.~
After reading:
# Require access to glib-mkenums Python script
ENV += PATH=$(STAGING_INSTALL_PREFIX)/bin:$$PATH
I will add this to cross/avahi too. Thank you for telling that glib-mkenums is a (arch independent) python script.
@hgy59 and fellow @SynoCommunity/developers I've been looking into ways of building gst-omx in order to achieve hardware acceleration on platforms that support it. If a solution turns out working I might even be able to enable --enable-omx on ffmpeg as well.
I finally found some hints from the VideoStation sources here https://sourceforge.net/projects/dsgpl/files/Packages/DSM%206.1%20Package%20Release/ where Synology create a template file pointing directly to the pre-built OMX library to build up the various tools:
$ head gst-omx-virtual-video-station/config/synology/gstomx.conf.template
[omxmpeg2videodec]
type-name=GstOMXMPEG2VideoDec
core-name=__LIB_PREFIX__/libOMX_Core.so
component-name=OMX.realtek.video.dec
rank=258
in-port-index=0
out-port-index=1
sink-template-caps=video/mpeg,mpegversion=(int)[1, 2],systemstream=(boolean)false
src-template-caps=video/x-raw,format = (string) { NV12 },width=(int)[ 16, 4096 ],height=(int)[ 16, 4096 ],framerate=(fraction)[ 0/1, 2147483647/1 ]
Where __LIB_PREFIX__ is:
sed "s,__LIB_PREFIX__,${LibPrefix},g" "${GST_OMX_CONF}.template" > "${GST_OMX_CONF}"
And LibPrefix is:
LibPrefix="/var/packages/$PackageName/target/lib/realtek"
And PackageName is VideoStation (probably now CodecPack since newer releases).
Long-story-short, I'm thinking of a way to download+extract the official Synology package matching the arch so I could then link to it. I might even import the library all together which may be even simpler. If this actually works, it may lead into enabling hardware decoding on many many platforms.
Two questions comes to mind:
- Where or how to set that up in spksrc? In a similar manner as we manager kernels/toolchain/toolkit? or using cross with install_resources and multi-file digests
- But first and most importantly, I just can't find how to extract Synology latest official spk such as https://archive.synology.com/download/Package/VideoStation/3.0.3-2084 or https://archive.synology.com/download/Package/CodecPack/2.0.0-1017
Your thoughts (and help on extracting spk) would be much appreciated :)
For item no. 2 (e.g. extracting files from an Synology spk package) I think I have found all the ingredients... Its now a matter of making a short & sweet recipe out of it.
General howto, well made: https://www.cyberciti.biz/faq/pgp-tarball-file-signature-keys-verification/
Actual path where Synology store their keys on the nas:
root@th0ma7-nas:/usr/syno/etc/codesign# pwd
/usr/syno/etc/codesign
root@th0ma7-nas:/usr/syno/etc/codesign# ll
total 28
drwxr-xr-x 3 root root 4096 Aug 15 2021 .
drwxr-xr-x 64 root root 4096 Jun 10 10:34 ..
drwx------ 2 root root 4096 Jun 10 14:45 .gnupg
-rw-r--r-- 1 root root 175 Aug 15 2021 keyinfo-sys
-rw-r--r-- 1 root root 224 Jun 10 14:45 keyinfo-user
-rw-r--r-- 1 root root 3299 Aug 15 2021 keyring
-rw-r--r-- 1 root root 1 Aug 15 2021 VERSION
Actual code that is/was used to validate the signed packages and extract them: https://pastebin.com/3vBYv662
And how to use codesign at page 25 of https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/6.0/enu/DSM_Developer_Guide_6_0.pdf
And finally Synology packages: https://archive.synology.com/download/Package
Optionally, this other pgp key might be useful: https://www.synology.com/en-global/support/security_pgp_key
Three libraries fail to load when calling gst-launch-1.0:
root@Kloudy:/var/packages/gstreamer/target/bin$ ./gst-launch-1.0 -s 1200 fakevideosink
(gst-plugin-scanner:30702): GStreamer-WARNING **: 16:32:36.941: Failed to load plugin '/var/packages/gstreamer/target/lib/gstreamer-1.0/libgstcairo.so': libcairo-gobject.so.2: cannot open shared object file: No such file or directory
(gst-plugin-scanner:30702): GStreamer-WARNING **: 16:32:37.000: Failed to load plugin '/var/packages/gstreamer/target/lib/gstreamer-1.0/libgsttaglib.so': /spksrc/spk/gstreamer/work-aarch64-7.0/install/var/packages/gstreamer/target/lib/libz.so: cannot open shared object file: No such file or directory
(gst-plugin-scanner:30702): GStreamer-WARNING **: 16:32:37.081: Failed to load plugin '/var/packages/gstreamer/target/lib/gstreamer-1.0/libgstpng.so': /spksrc/spk/gstreamer/work-aarch64-7.0/install/var/packages/gstreamer/target/lib/libz.so: cannot open shared object file: No such file or directory
Regarding point 1. Would this work as just another cross/ package? That way you don't need to modify the framework and this seems specific to just one package. Yea I think it belongs in cross or spk
@AlexPresso I was finally able to resume work on this PR. It isn't yet in a state I like but hardware acceleration on aarch64 using OMX "might" just work but there is no way for me to tell.
Just saying, I hadn't forgotten this... still on my pile :man_shrugging:
1.20.5 refuses to build on arch using a kernel <= 3.4 https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1765
@AlexPresso @ner00 package is now ready for prime testing. You can download the resulting zip files from auto-builds of github-action at https://github.com/SynoCommunity/spksrc/actions/runs/4097014300
Hi @th0ma7 thank you very much for your work ! I'm so happy to read that !
~~I tried to manually install the package on a DS218Play (DSM 7.1.1-42962 Update 2) but I get the following error~~
[Edit :] My bad, I'm not very used to ARM architectures, I just didn't picked the right one, installation worked like a charm :) I'll test the decode flow this weekend
@AlexPresso lol :) Is it an armv8 (i.e. aarch64) so you can test hardware acceleration (no clue if this works btw)?
BTW, gathering a bit of documentation here: https://github.com/SynoCommunity/spksrc/wiki/gstreamer
EDIT: was missing a key dependency being curl, now fixed with most recent github-action build.
The plugin installed successfully but it was not able to to transcode an HEVC file to H264 using omxh265dec it says it's missing:
[2023-02-09 11:58:20] [INFO] ========================================[start gst 11200]
[2023-02-09 11:58:20] [INFO] GST_ARGS: -f -s 0 filesrc location=/volume2/hevcDTSFile.mkv ! matroskademux name=demux ! queue ! omxh265dec width=1920 height=1072 ! omxh264enc bitrate=4500000 i-frame-interval=1 ! video/x-h264,profile=(string)high ! h264parse ! queue max-size-time=0 max-size-buffers=0 max-size-bytes=0 ! mpegtsmux name=mux ! queue ! fdsink fd=1 demux.audio_0 ! queue ! decodebin ! audioconvert ! audio/x-raw,channels=2 ! lamemp3enc target=bitrate cbr=true ! mpegaudioparse ! queue max-size-time=0 max-size-buffers=0 max-size-bytes=0 ! mux.
[2023-02-09 11:58:21] [WARNING] erroneous pipeline: no element "omxh265dec"
[2023-02-09 11:58:21] [INFO] ========================================[end gst 11200]