m-ab-s / media-autobuild_suite

This Windows Batchscript helps setup a Mingw-w64 compiler environment for building ffmpeg and other media tools under Windows.
GNU General Public License v3.0
1.52k stars 264 forks source link

Issues With CUDA And Compling ffmpeg? #2361

Open MogomraZero opened 1 year ago

MogomraZero commented 1 year ago

Good morning!

I am encountering a fatal error whenever I attempt to compile ffmpeg. Based on the error message, it seems like it may be an issue with CUDA. However, I have already installed CUDA on my system. Is there something else I need to install to make this work properly?

I am attaching Google Drive links to a picture of the error messages that I receive, as well as the logs.zip file that you have requested. Many thanks in advance for your assistance with this matter!!!

https://drive.google.com/file/d/1y6NKnSXq7h9ckDCTm4zWN5G-jb1-56mi/view?usp=sharing

https://drive.google.com/file/d/1MOROLnXkXWyEwVFbgF9hQWxmcxzgboxH/view?usp=sharing

maxiuca commented 1 year ago

Have you tried reinstalling CUDA SDK? Unless you removed the environment variable deliberately, the installation should have set the CUDA_PATH variable.

The error you're getting seems to be a Vulkan-related error. Do you specifically need to use the Vulkan transforms/filters? If you don't, try disabling Vulkan in the ffmpeg config (C:\media-autobuild_suite\build\mpeg_options.txt).

I had a Vulkan-related error a couple of days ago, but I've just disabled Vulkan (I don't use it anyway) and the compilations finished without errors. Today the builds also finished ok (though still without Vulkan).

MogomraZero commented 1 year ago

Have you tried reinstalling CUDA SDK? Unless you removed the environment variable deliberately, the installation should have set the CUDA_PATH variable.

The error you're getting seems to be a Vulkan-related error. Do you specifically need to use the Vulkan transforms/filters? If you don't, try disabling Vulkan in the ffmpeg config (C:\media-autobuild_suite\build\mpeg_options.txt).

I had a Vulkan-related error a couple of days ago, but I've just disabled Vulkan (I don't use it anyway) and the compilations finished without errors. Today the builds also finished ok (though still without Vulkan).

Good morning!

I verified that the CUDA_PATH variable was automatically set by the SDK (it was) and disabled Vulkan in the install. The install got much further then it had before in the past, but then stopped with a fresh error. I am linking to the relevant error messages and the new log files below:

https://drive.google.com/file/d/12yk-IESgOMyqCPB4yqa9je8OiK35JhMW/view?usp=sharing

https://drive.google.com/file/d/1GlmofzSAX1M-lhRLQs7NsrG_Qul_hYFz/view?usp=sharing

https://drive.google.com/file/d/1k_8ZqglUWEeaeWzv1QnJB9x_AwL9yRDx/view?usp=sharing

Once again, MANY thanks in advance for your assistance with this matter!

maxiuca commented 1 year ago

No problem, but I must warn you that I'm not really good at this. I can read code (c/c++ mostly) and I'm good at general troubleshooting and problem-solving, but that's it. So I only advise which features to switch off in order to skip over a problem.

Could please copy and paste the terminal output rather than paste links to screenshots? It makes it was easier to read.

I don't usually compile MPV, because I don't really use MPV and I in my experience the build was breaking too often.

It seems there is a problem mujs, which is a javascript interpreter, so if you don't specifically need to use javascript scripts in MPV, then just switch it off (edit media-autobuild_suite\build\mpv_options.txt and hash out the --enable-javascript option).

So please disable the javascript in mpv and run the compilation again to check if this helps. If it won't then I would start with disabling mpv, mplayer2 and vlc completely and then go slowly from there, so

And I also would advise against trying to compile mplayer2 (ever - unless you specifically need mplayer).

hotenov commented 1 year ago

@MogomraZero Hi! 🖖🏻

It seems this is not your first script run (you have compiled ffmpeg already, at least one time, where all vulkan options were enabled in build/ffmpeg_options.txt file, because I had the same error message the day before yesterday)

Click to expand ⬇ (error with vulkan) ```bash 12:51:24 ├ Running make... Likely error (tail of the failed operation logfile): CC libavutil/hwcontext_vulkan.o D:/mabs/build/ffmpeg-git/libavutil/hwcontext_vulkan.c:363:7: error: 'VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME' undeclared here (not in a function); did you mean 'VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME'? 363 | { VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME, FF_VK_EXT_NO_FLAG }, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME D:/mabs/build/ffmpeg-git/libavutil/hwcontext_vulkan.c:364:7: error: 'VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME' undeclared here (not in a function); did you mean 'VK_EXT_VIDEO_ENCODE_H265_EXTENSION_NAME'? 364 | { VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME, FF_VK_EXT_NO_FLAG }, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | VK_EXT_VIDEO_ENCODE_H265_EXTENSION_NAME make: *** [/build/ffmpeg-git/ffbuild/common.mak:78: libavutil/hwcontext_vulkan.o] Error 1 make failed. Check D:/mabs/build/ffmpeg-git/build-static-64bit/ab-suite.make.log This is required for other packages, so this script will exit. 13:18:23 Creating diagnostics file... ```

As for the first error (vulkan)

You have to do "clean install" of all environment (msys2) and all enabled ffmpeg packages.

How to do "clean install"? There is a paragraph in README "Delete '/msys64', '/local32' and '/local64' if they exist. /build is usually safe to keep and saves time;" As said before, you can leave /build folder with all your ffmpeg options and downloaded git repos, INI file with setting after first run (to save time and nerves)

After (or before) deleting these folders, I (and script maintainers) DO recommend you to update media-autobuild_suite itself:

  1. Open mintty terminal using shortcut in the repo root.
  2. Drag & drop the file update_suite.sh (also in the root) into mintty terminal window (terminal prints path to it)
  3. Press Enter key and wait

Script self update is also safe for your files in build directory, except changes in *.sh scripts.
NOTE: .sh files in build sub folder will be overwritten! (with preserving your changes in a new file, e.g. for me user-changes-2023-04-27-07.50.09.diff
In my case, I made changes only in media-suite_deps.sh file to specify a certain branch for ffnvcodec repo, because my old video card (GeForce GT 710) supports only NVIDIA Video Codec SDK API v11.1.x. (I call it CUDA API sometimes). Where master branch has API v12.x. If you also have a video card that does not support a modern NV API v12 you should change it in media-suite_deps.sh after self update, but BEFORE you ran script next time, for example:
SOURCE_REPO_FFNVCODEC=https://github.com/FFmpeg/nv-codec-headers.git#branch=sdk/11.1

If you are interesting why you have to do "clean install"? There is the answer "The problem is because the update process doesn't remove new files" quoted from Custom Patches wiki page.
Of course you can try to write your own ffmpeg_extra.sh script (as mentioned on this page) and delete files manually (if you know where to find them 😃 ) But sometimes to turn over a new leaf is the best choice.
There is one more of the pros of cleaning your environment: You might have installed other unnecessary things (like I have) besides of vulkan package, for example you could see this error (it's due to installed vpx [VP8/VP9 encoder]):

Click to expand error message ⬇ ```bash 14:02:57 ├ Running make... Likely error (tail of the failed operation logfile): | ^~~~~~~ D:/mabs/build/ffmpeg-git/libavcodec/libsvt_vp9.c:530:18: warning: unused variable 'ref' [-Wunused-variable] 530 | AVBufferRef *ref; | ^~~ D:/mabs/build/ffmpeg-git/libavcodec/libsvt_vp9.c: At top level: D:/mabs/build/ffmpeg-git/libavcodec/libsvt_vp9.c:693:25: error: 'FF_CODEC_CAP_NOT_INIT_THREADSAFE' undeclared here (not in a function); did you mean 'FF_CODEC_CAP_INIT_THREADSAFE'? 693 | .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | FF_CODEC_CAP_INIT_THREADSAFE make: *** [/build/ffmpeg-git/ffbuild/common.mak:81: libavcodec/libsvt_vp9.o] Error 1 make failed. Check D:/mabs/build/ffmpeg-git/build-static-64bit/ab-suite.make.log This is required for other packages, so this script will exit. 14:23:42 Creating diagnostics file... ```

As for mpv and other errors

I also support the idea to NOT install mpv, because it enables vulkan and other crap things (look at /build/mpv_options.txt file and you'll see).
If we (maxiuca and I) have convinced you to do that - just set mpv=2 (2 - means 'No' in this case) in /build/media-autobuild_suite.ini. I also recommend you to disable (not install) other things, but it's up to you 😉

I hope this will help you!
P.S. Use the power of Markdown. You can paste images directly to GitHub comments, but, as maxiuca said, error messages are better to insert as plain text (or Markdown code block). It lets future readers (googlers, chatGPT-ers) to find this issue as I did when I was trying to fix it.