Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 695210 - media-video/ffmpeg - add support for NVIDIA Performance Primitives (NPP, libnpp)
Summary: media-video/ffmpeg - add support for NVIDIA Performance Primitives (NPP, libnpp)
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 3 votes (vote)
Assignee: media-video herd
Depends on:
Reported: 2019-09-20 18:41 UTC by Soren Harward
Modified: 2020-10-12 23:05 UTC (History)
4 users (show)

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

ffmpeg-4.2.3-r1.ebuild (ffmpeg-4.2.3-r1.ebuild,18.01 KB, text/plain)
2020-06-25 16:36 UTC, Soren Harward

Note You need to log in before you can comment on or make changes to this bug.
Description Soren Harward 2019-09-20 18:41:24 UTC
ffmpeg includes support for Nvidia's libnpp, which enables various video transformations — particularly resizing — to be performed on the GPU.  This is necessary for efficiently processing video streams decoded/encoded/transcoded on Nvidia GPUs.

libnpp support is enabled using --enable-libnpp in ffmpeg's ./configure .  The Gentoo ffmpeg packages do not provide a way to enable this flag.

libnpp is provided by dev-util/nvidia-cuda-toolkit

Reproducible: Always

I can see three possible ways to implement this, in increasing order of preference:

#1: Add an "npp" USE flag to ffmpeg that adds a dependency on dev-util/nvidia-cuda-toolkit
#2: Add the "cuda" USE flag to ffmpeg, and have it do the same as #1
#3: Modify how the existing video_cards_nvidia USE flag operates in the ffmpeg packages to require dev-util/nvidia-cuda-toolkit, and to add --enable-libnpp to the ./configure command

IMO, #3 is the sanest option, because I can't imagine a circumstance when someone would want to add nvidia hardware decode/encode/transcode support to ffmpeg, but not want hardware-accelerated video transform filters.
Comment 1 Soren Harward 2020-06-25 16:36:38 UTC
Created attachment 646416 [details]

Ebuild that enables NPP support for 4.2.3.

The added include and linking directives at lines 470 and 471 seem kind of ugly to me, but I couldn't get the configuration script to complete without them.

The ffmpeg build process has to be able to find the NPP headers and libraries, which aren't installed by default in a location that GCC looks for them.  And of course CUDA doesn't use pkgconfig, and ffmpeg rolls its own configuration script instead of using autoconf.  There's probably a better, more ebuild-ish way of determining where the headers and libraries are, and passing the appropriate directives on to the ffmpeg configuration script, but I don't know what it is.

At any rate, ffmpeg compiles and runs with the NPP filters using this ebuild.
Comment 2 Gregory Beauregard 2020-10-12 23:04:15 UTC
What's the status on this? Are there things I can improve with the suggested ebuild changed to get the changes in the main repo?

We don't have the cuda scaler either; right now we need external ffmpeg to keep transcodes entirely in GPU on Gentoo.