Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 638582 - media-plugins/gst-plugins-nvenc package request
Summary: media-plugins/gst-plugins-nvenc package request
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: GStreamer package maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-23 17:25 UTC by Fin Christensen
Modified: 2023-08-22 09:22 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
The tar contains the patch and the ebuild. (gst-plugins-bad-1.12.3-r1.tar,10.00 KB, application/x-tar)
2017-11-23 17:25 UTC, Fin Christensen
Details
This tar contains the patch and ebuild for gst-plugins-nvenc (gst-plugins-nvenc-1.12.3.tar,10.00 KB, application/x-tar)
2017-11-24 13:19 UTC, Fin Christensen
Details
Ebuild and patches for gst-plugins-nvenc with opengl use-flag (gst-plugins-nvenc.tar.xz,1.98 KB, application/x-xz)
2018-01-12 13:14 UTC, Fin Christensen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fin Christensen 2017-11-23 17:25:13 UTC
Created attachment 505906 [details]
The tar contains the patch and the ebuild.

Hi,

I figured out how to enable nvenc support for gst-plugins-bad under gentoo linux. I attached the patch and ebuild I used to successfully build gst-plugins-bad with nvenc support. I verified my setup with

    gst-inspect-1.0 nvh264enc

The patch fixes a compile error in gst-plugins-bad-1.12.3/gst-libs/gst/gl/gstglapi.h:24:10.

I have dev-util/nvidia-cuda-toolkit-8.0.61 and media-video/nvidia_video_sdk-6.0.1 installed as dependencies. The configure script of gst-plugins-bad shows that cuda >=6.5 is supported.

I checked the installed files of media-video/nvidia_video_sdk-6.0.1 and recognized that documentation and nvEncodeAPI.h is installed. This header is also provided by the package media-video/nvidia-video-codec which provides a more recent version of the header (under /opt/nvidia-video-codec/include/nvEncodeAPI.h).

ffmpeg and avidemux-core also have a nvenc use-flag but are depending on the outdated nvidia_video_sdk.

So there are several questions for implementing a nvenc use-flag in gst-plugins-bad:

    1. On which packages should gst-plugins-bad depend when nvenc is enabled?
    2. Should gst-plugins-bad always inherit autotools even when nvenc is disabled?
    3. Should gst-plugins-bad always eautoreconf the source tree even when nvenc is disabled?
    4. Should the attached patch always be applied even if nvenc is disabled?

I'm not that familiar with handling of use-flags in gentoo ebuilds. Comments and suggestions appreciated.
Comment 1 Mart Raudsepp gentoo-dev 2017-11-23 18:49:01 UTC
Unless the configure flag changes anything in the helper libraries (gstgl?), this should be a separate package instead. Something similar to gst-plugins-dvb package.
I could add such a version for you and blind bump with the rest of gstreamer after it's in, while you serve as co-maintainer for actual runtime testing and bug handling. I don't have any nvenc capable nvidia hardware (or any in use whatsoever)
Comment 2 Fin Christensen 2017-11-23 20:24:32 UTC
I can definitely do the testing and bug handling. I don't think that I can build a gst-plugins-nvenc package on my own. It would be great if you could create a blind bump :)
Comment 3 Mart Raudsepp gentoo-dev 2017-11-23 21:33:15 UTC
I need some initial thing that is known to work at runtime for starters. I meant bumps once an initial version exists (so like when I bump the whole set from 1.2.3 to 1.2.4 when it's released).
I gave gst-plugins-dvb as an example of a sys/ plugin in a separate split package. You should be able to base it on that; just need to get the dependencies right, possibly have some gstreamer_system_link calls if needed (pretty sure you won't need the mpegts one found in dvb), etc.
Comment 4 Fin Christensen 2017-11-24 13:19:50 UTC
Created attachment 506264 [details]
This tar contains the patch and ebuild for gst-plugins-nvenc

Ok, I created an ebuild for gst-plugins-nvenc. It works perfectly on my system. I hope I got the dependencies right.

Should I attach or put my test anywhere? I have a bash script that creates a gstreamer pipeline with gst-launch that uses nvh264enc.

Also I noticed that the current master of gst-plugins-bad contains a plugin for nvdec. Is it possible to create a -9999 ebuild that builds from git master for e.g. gst-plugins-nvdec? Nvdec is currently not included in any gst-plugins-bad release.
Comment 5 Fin Christensen 2017-12-10 16:46:51 UTC
Any news?
Comment 6 Mart Raudsepp gentoo-dev 2017-12-10 17:14:05 UTC
No, but I should be back in action within a day or two with my main tree push things (though busy with work too). Hopefully I remember to do it right after gstreamer 1.12.4 bumps. Feel free to remind me again after you see gstreamer 1.12.4 added, but no gst-plugins-nvenc soon after.
Comment 7 Mart Raudsepp gentoo-dev 2017-12-10 17:42:57 UTC
(In reply to Fin Christensen from comment #4)
> Also I noticed that the current master of gst-plugins-bad contains a plugin
> for nvdec. Is it possible to create a -9999 ebuild that builds from git
> master for e.g. gst-plugins-nvdec? Nvdec is currently not included in any
> gst-plugins-bad release.

You could do so I guess, but I'm not looking to add any live gstreamer ebuilds to main tree at this time. I believe upstream 1.14 release is planned late December or January, so should become available in a release soon enough, unless it's too experimental to build by default or something. Then you can request another package for that.
Comment 8 Fin Christensen 2018-01-07 12:09:21 UTC
Today I ran into an issue building gst-plugins-nvenc

    make: *** No rule to make target '../../gst-libs/gst/gl/libgstgl-1.0.la', needed by 'libgstnvenc.la'.  Stop.

This rule is defined in gst-libs/gst/gl. How can I get the gstreamer eclass to build the libgstgl in gst-libs/gst/gl? When compiling gst-plugins-nvenc manually as a normal user I get it to work by doing `make` inside gst-libs/gst/gl.

Thanks for your help :)
Comment 9 Mart Raudsepp gentoo-dev 2018-01-07 17:22:38 UTC
In 1.12 the gl helper libraries are built from the same tarball, so if they need to link to them, they aren't built in the same package as the build system expects. We have gstreamer_system_link helper from the eclass for this. It will also need the appropriate depends (especially USE flag needs for GL stuff as appropriate) on gst-plugins-bad as well then in the separate package. So hopefully something like this suffices (plus the depend):

        gstreamer_system_link \
                gst-libs/gst/gl:gstreamer-gl

e.g media-plugins/gst-plugins-dvb has an example how to apply that.

If that doesn't help, I'll need to take a closer look.

To my knowledge the opengl stuff will move from gst-plugins-bad to gst-plugins-bad in 1.14, and it's unlikely nvenc will move to base (probably stays in bad, but even once full quality it'd be more something for -good), thus this need will go away, as it'll link to the system library anyways without a need to this gstreamer_system_link call. Though there we might be looking at using meson instead of autotools finally too.
Comment 10 Fin Christensen 2018-01-12 13:14:49 UTC
Created attachment 514480 [details]
Ebuild and patches for gst-plugins-nvenc with opengl use-flag

Add opengl use-flag to ebuild.
Comment 11 Mart Raudsepp gentoo-dev 2018-02-16 03:45:27 UTC
I've got 1.12.4 done now and should get to this addition over the weekend. What you have attached here is functionally working good for you so far?
Also after I get something in and have the bot auto-close this, please feel free to still test the version and ebuild I added (in future) to main tree and report back here if it's working good (as I have no way to actually test it)
Comment 12 Mart Raudsepp gentoo-dev 2018-06-22 11:44:47 UTC
I tried to add gst-plugins-nvdec and gst-plugins-nvenc finally now, but I can't even fit nvidia-cuda-toolkit installed on my system. So this isn't going to happen from me still for the time being.
If 1.14.1 is updated to, runtime tested and ready for blind reviews, then we can work something out still, though.
Comment 13 Maxim P. Dementiev 2023-08-21 13:48:00 UTC
Is there any news?
I would like to see these elements on my Gentoo hosts.
Thanks!
Comment 14 Maxim P. Dementiev 2023-08-22 09:22:46 UTC
I was able to build nvcodec plugin from sources from tag 1.20.6 (to be compatible with my current version of GStreamer installed).

It works.
$ ldd /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/libgstnvcodec.so 
	linux-vdso.so.1 (0x00007ffcef341000)
	libgstbase-1.0.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../../gstreamer/libs/gst/base/libgstbase-1.0.so.0 (0x00007f106d54c000)
	libgstreamer-1.0.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../../gstreamer/gst/libgstreamer-1.0.so.0 (0x00007f106d3fa000)
	libgstvideo-1.0.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../../gst-plugins-base/gst-libs/gst/video/libgstvideo-1.0.so.0 (0x00007f106d331000)
	libgstpbutils-1.0.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../../gst-plugins-base/gst-libs/gst/pbutils/libgstpbutils-1.0.so.0 (0x00007f106d2ef000)
	libgstgl-1.0.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../../gst-plugins-base/gst-libs/gst/gl/libgstgl-1.0.so.0 (0x00007f106d268000)
	libgstcodecs-1.0.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../gst-libs/gst/codecs/libgstcodecs-1.0.so.0 (0x00007f106d238000)
	libgstcodecparsers-1.0.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../gst-libs/gst/codecparsers/libgstcodecparsers-1.0.so.0 (0x00007f106d1c3000)
	libglib-2.0.so.0 => /usr/lib64/libglib-2.0.so.0 (0x00007f106d059000)
	libgobject-2.0.so.0 => /usr/lib64/libgobject-2.0.so.0 (0x00007f106cff8000)
	libgmodule-2.0.so.0 => /usr/lib64/libgmodule-2.0.so.0 (0x00007f106cff1000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f106ce1e000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f106cd44000)
	libunwind.so.8 => /usr/lib64/libunwind.so.8 (0x00007f106cd28000)
	libdw.so.1 => /usr/lib64/libdw.so.1 (0x00007f106cc87000)
	liborc-0.4.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../../gst-plugins-base/gst-libs/gst/video/../../../../orc/orc/liborc-0.4.so.0 (0x00007f106cbed000)
	libgstaudio-1.0.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../../gst-plugins-base/gst-libs/gst/pbutils/../audio/libgstaudio-1.0.so.0 (0x00007f106cb69000)
	libgsttag-1.0.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../../gst-plugins-base/gst-libs/gst/pbutils/../tag/libgsttag-1.0.so.0 (0x00007f106cb28000)
	libgstallocators-1.0.so.0 => /home/maxatka/sources/gstreamer-build/subprojects/gst-plugins-bad/sys/nvcodec/../../../gst-plugins-base/gst-libs/gst/gl/../allocators/libgstallocators-1.0.so.0 (0x00007f106cb21000)
	libEGL.so.1 => /usr/lib64/libEGL.so.1 (0x00007f106cb09000)
	libGLX.so.0 => /usr/lib64/libGLX.so.0 (0x00007f106cad5000)
	libwayland-client.so.0 => /usr/lib64/libwayland-client.so.0 (0x00007f106cac3000)
	libwayland-cursor.so.0 => /usr/lib64/libwayland-cursor.so.0 (0x00007f106cab9000)
	libwayland-egl.so.1 => /usr/lib64/libwayland-egl.so.1 (0x00007f106cab4000)
	libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f106c972000)
	libX11-xcb.so.1 => /usr/lib64/libX11-xcb.so.1 (0x00007f106c96b000)
	libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f106c941000)
	libgudev-1.0.so.0 => /usr/lib64/libgudev-1.0.so.0 (0x00007f106c934000)
	libdrm.so.2 => /usr/lib64/libdrm.so.2 (0x00007f106c91e000)
	libgbm.so.1 => /usr/lib64/libgbm.so.1 (0x00007f106c90d000)
	libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f106c871000)
	libffi.so.8 => /usr/lib64/libffi.so.8 (0x00007f106c865000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f106d62b000)
	libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/13/libgcc_s.so.1 (0x00007f106c841000)
	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f106c813000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f106c7f9000)
	libelf.so.1 => /usr/lib64/libelf.so.1 (0x00007f106c7db000)
	libzstd.so.1 => /lib64/libzstd.so.1 (0x00007f106c728000)
	libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f106c715000)
	libGLdispatch.so.0 => /usr/lib64/libGLdispatch.so.0 (0x00007f106c65c000)
	libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f106c657000)
	libXdmcp.so.6 => /usr/lib64/libXdmcp.so.6 (0x00007f106c64d000)
	libudev.so.1 => /lib64/libudev.so.1 (0x00007f106c60f000)
	libwayland-server.so.0 => /usr/lib64/libwayland-server.so.0 (0x00007f106c5f9000)
	libexpat.so.1 => /usr/lib64/libexpat.so.1 (0x00007f106c5ce000)
	libxcb-randr.so.0 => /usr/lib64/libxcb-randr.so.0 (0x00007f106c5bd000)
	libcap.so.2 => /lib64/libcap.so.2 (0x00007f106c5af000)