Summary: | media-video/ffmpeg: add 'cuda' USE for NVIDIA CUDA-based hwaccel, decoding, etc. | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Coacher <itumaykin+gentoo> |
Component: | Current packages | Assignee: | Gentoo Media-video project <media-video> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | fhlfibh, koz.ross |
Priority: | Normal | Keywords: | PATCH |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Coacher
2016-09-28 20:18:46 UTC
Hi, FFMPEG 3.2.2 has '--enable-cuda' configure option, which is disabled by default, and there's no USE flag to enable it. Is it possible to add a USE or something for CUDA? Regards, Alex a tested patch would definitely help there (I dont have capable hw available I think atm), even better if this is a github pr for 3.2.x and 9999 I have gotten CUDA decoding to work with both ffmpeg and mpv locally via the following changes: 1. EXTRA_FFMPEG_CONF="--enable-cuda --enable-cuvid --enable-nonfree" in package.env 2. CFLAGS="${CFLAGS} -I/opt/cuda/include" for both mpv and ffmpeg Adding the former as use flags should be trivial, but the more concerning issue is the fact that dev-utils/nvidia-cuda-toolkit does not seem to add itself to the include path correctly. > Adding the former as use flags should be trivial, but the more concerning > issue is the fact that dev-utils/nvidia-cuda-toolkit does not seem to add > itself to the include path correctly. See bug 604178. Hi, I took a stab at it and got it working incl. support for hardened(pax). https://startux.de/git/quarks.git/blob/327e47e33028181c62e5ff58363dd59fcb1e8548:/media-video/ffmpeg/ffmpeg-3.2.2-r1.ebuild Diff to upstream 3.2.2 ebuild. --- /usr/portage/media-video/ffmpeg/ffmpeg-3.2.2.ebuild 2017-01-06 01:17:31.000000000 -0800 +++ ffmpeg/ffmpeg-3.2.2-r1.ebuild 2017-01-09 13:13:06.167430284 -0800 @@ -21,7 +21,7 @@ EGIT_REPO_URI="git://source.ffmpeg.org/ffmpeg.git" fi -inherit eutils flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM} +inherit eutils flag-o-matic multilib multilib-minimal pax-utils toolchain-funcs ${SCM} DESCRIPTION="Complete solution to record, convert and stream audio and video. Includes libavcodec" HOMEPAGE="http://ffmpeg.org/" @@ -65,7 +65,7 @@ FFMPEG_FLAG_MAP=( +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt gnutls gmp +gpl +hardcoded-tables +iconv lzma +network openssl +postproc - samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau X:xlib xcb:libxcb + samba:libsmbclient sdl:ffplay sdl:sdl2 cuda vaapi vdpau X:xlib xcb:libxcb xcb:libxcb-shm xcb:libxcb-xfixes +zlib # libavdevice options cdio:libcdio iec61883:libiec61883 ieee1394:libdc1394 libcaca openal @@ -162,6 +162,7 @@ cdio? ( >=dev-libs/libcdio-paranoia-0.90_p1-r1[${MULTILIB_USEDEP}] ) celt? ( >=media-libs/celt-0.11.1-r1[${MULTILIB_USEDEP}] ) chromaprint? ( >=media-libs/chromaprint-1.2-r1[${MULTILIB_USEDEP}] ) + cuda? ( dev-util/nvidia-cuda-sdk ) ebur128? ( >=media-libs/libebur128-1.1.0[${MULTILIB_USEDEP}] ) encode? ( amrenc? ( >=media-libs/vo-amrwbenc-0.1.2-r1[${MULTILIB_USEDEP}] ) @@ -304,6 +305,13 @@ use openssl && use gpl && myconf+=( --enable-nonfree ) use samba && myconf+=( --enable-version3 ) + # Cuda, headers are under /opt/cuda + if use cuda; then + myconf+=( --enable-nonfree ) + myconf+=( --enable-cuvid ) + myconf+=( --extra-cflags=-I/opt/cuda/include) + fi + # Encoders if use encode ; then ffuse+=( "${FFMPEG_ENCODER_FLAG_MAP[@]}" ) @@ -446,6 +454,11 @@ fi done fi + + # Required on Hardened due to binary nvidia libs + if use cuda; then + pax-mark -mr "${D}"usr/bin/${PN} + fi } multilib_src_install_all() { (In reply to Stefan Reimer from comment #5) > Hi, > I took a stab at it and got it working incl. support for hardened(pax). > https://startux.de/git/quarks.git/blob/ > 327e47e33028181c62e5ff58363dd59fcb1e8548:/media-video/ffmpeg/ffmpeg-3.2.2-r1. > ebuild > > Diff to upstream 3.2.2 ebuild. > > [...] > > + # Cuda, headers are under /opt/cuda > + if use cuda; then > + myconf+=( --enable-nonfree ) > + myconf+=( --enable-cuvid ) > + myconf+=( --extra-cflags=-I/opt/cuda/include) ^^^ This should really be myconf+=( --extra-cflags=-I"${EPREFIX}/opt/cuda/include" ) If someone could make a full patched 9999.ebuild -- I could test it with GTX 660 (and probably 1060 too). Regards, Alex The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=655e4810e32870dbcc50b2e11f300fdc49ea5d30 commit 655e4810e32870dbcc50b2e11f300fdc49ea5d30 Author: Alexis Ballier <aballier@gentoo.org> AuthorDate: 2019-08-19 14:51:19 +0000 Commit: Alexis Ballier <aballier@gentoo.org> CommitDate: 2019-08-19 16:40:59 +0000 media-video/ffmpeg: add cuda useflag. Based on a patch by Timo Rothenpieler. Closes: https://bugs.gentoo.org/595450 Package-Manager: Portage-2.3.71, Repoman-2.3.17 Signed-off-by: Alexis Ballier <aballier@gentoo.org> media-video/ffmpeg/ffmpeg-9999.ebuild | 6 ++++-- media-video/ffmpeg/metadata.xml | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) |