Building -current ffmpeg with CUDA 12.5 support
by rinza from LinuxQuestions.org on (#6N58J)
Hi, I'm trying to build ffmpeg with CUDA support. I have always used the same method, adding correspondent flags to ./configure in the SlackBuild script,
Code: --enable-cuda-nvcc \
--enable-cuvid \
--enable-libnpp \
--extra-cflags="-I/usr/local/cuda-12.5/include/" \
--extra-ldflags="-L/usr/local/cuda-12.5/lib64/" \
--enable-nvenc \and when there was a incompatibility with GCC version I added a nvcc flag to ignore unsupported compiler, and I never had a problem doing it like this
Code:export NVCC_APPEND_FLAGS="-allow-unsupported-compiler "Prior to the last ffmpeg upgrade, I was using this method with CUDA 12.4 successfully, now I'm trying to compile the newest ffmpeg, with CUDA-12.5, but it is failing with the following error:
Code:CC libavcodec/nvenc.o
libavcodec/nvenc.c: In function invenc_setup_hevc_configi:
libavcodec/nvenc.c:1441:9: error: iNV_ENC_CONFIG_HEVCi has no member named ipixelBitDepthMinus8i
1441 | hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0;
| ^~
libavcodec/nvenc.c: In function invenc_setup_av1_configi:
libavcodec/nvenc.c:1550:8: error: iNV_ENC_CONFIG_AV1i has no member named iinputPixelBitDepthMinus8i
1550 | av1->inputPixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0;
| ^~
libavcodec/nvenc.c:1551:8: error: iNV_ENC_CONFIG_AV1i has no member named ipixelBitDepthMinus8i
1551 | av1->pixelBitDepthMinus8 = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? 2 : 0;
| ^~
make: *** [ffbuild/common.mak:81: libavcodec/nvenc.o] Error 1Checking Arch repositories I found a pkgbuild of ffmpeg for OBS Studio, it applies several patches but two seems relevant to this, and appears to be based on equivalent environment in Slackware-current (nv-encoder-headers-12.2.72, ffmpeg-16.1.1)
https://aur.archlinux.org/cgit/aur.g...D?h=ffmpeg-obs
Code: ## avcodec/nvenc: stop using long deprecated format specifiers
git cherry-pick -n 3481f8d99fc44f5516957e774b7f2da74c33beb8
## avcodec/nvenc: support SDK 12.2 bit depth API
git cherry-pick -n 38346298973e3869d895e0ad3ca3b19dc598c5c8Grabbing those commits from ffmpeg's github and applying them seems to require disabling the shipped patch 0004-support-nv-codec-headers-12.2.patch.gz. I've tried that and got the same error. I also tried to merge those patches with the one shipped with Slackware, maybe it was too complex and I messed up but I couldn't produce a functional patch.
Searching around I couldn't find any other suggestion on how to deal with this. Here, at the forum, there is a reply that seems to deal with the same error, the patch produced apparently is 0004-support-nv-codec-headers-12.2.patch.gz, now shipped with Slack.
https://www.linuxquestions.org/quest...ml#post6493753
Any ideas?
Code: --enable-cuda-nvcc \
--enable-cuvid \
--enable-libnpp \
--extra-cflags="-I/usr/local/cuda-12.5/include/" \
--extra-ldflags="-L/usr/local/cuda-12.5/lib64/" \
--enable-nvenc \and when there was a incompatibility with GCC version I added a nvcc flag to ignore unsupported compiler, and I never had a problem doing it like this
Code:export NVCC_APPEND_FLAGS="-allow-unsupported-compiler "Prior to the last ffmpeg upgrade, I was using this method with CUDA 12.4 successfully, now I'm trying to compile the newest ffmpeg, with CUDA-12.5, but it is failing with the following error:
Code:CC libavcodec/nvenc.o
libavcodec/nvenc.c: In function invenc_setup_hevc_configi:
libavcodec/nvenc.c:1441:9: error: iNV_ENC_CONFIG_HEVCi has no member named ipixelBitDepthMinus8i
1441 | hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0;
| ^~
libavcodec/nvenc.c: In function invenc_setup_av1_configi:
libavcodec/nvenc.c:1550:8: error: iNV_ENC_CONFIG_AV1i has no member named iinputPixelBitDepthMinus8i
1550 | av1->inputPixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0;
| ^~
libavcodec/nvenc.c:1551:8: error: iNV_ENC_CONFIG_AV1i has no member named ipixelBitDepthMinus8i
1551 | av1->pixelBitDepthMinus8 = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? 2 : 0;
| ^~
make: *** [ffbuild/common.mak:81: libavcodec/nvenc.o] Error 1Checking Arch repositories I found a pkgbuild of ffmpeg for OBS Studio, it applies several patches but two seems relevant to this, and appears to be based on equivalent environment in Slackware-current (nv-encoder-headers-12.2.72, ffmpeg-16.1.1)
https://aur.archlinux.org/cgit/aur.g...D?h=ffmpeg-obs
Code: ## avcodec/nvenc: stop using long deprecated format specifiers
git cherry-pick -n 3481f8d99fc44f5516957e774b7f2da74c33beb8
## avcodec/nvenc: support SDK 12.2 bit depth API
git cherry-pick -n 38346298973e3869d895e0ad3ca3b19dc598c5c8Grabbing those commits from ffmpeg's github and applying them seems to require disabling the shipped patch 0004-support-nv-codec-headers-12.2.patch.gz. I've tried that and got the same error. I also tried to merge those patches with the one shipped with Slackware, maybe it was too complex and I messed up but I couldn't produce a functional patch.
Searching around I couldn't find any other suggestion on how to deal with this. Here, at the forum, there is a reply that seems to deal with the same error, the patch produced apparently is 0004-support-nv-codec-headers-12.2.patch.gz, now shipped with Slack.
https://www.linuxquestions.org/quest...ml#post6493753
Any ideas?