Shotcut fails to autodetect Nvidia nvenc on system

Hi,

I know this is a recurring issue for people, but I’ve tried the various threads and I can’t make this work (it was previously working in an earlier version of shotcut).

In Shotcut 19.10.20 (on a Linux Mint 19.1 system, completely up to date, using the nvidia 430.50 drivers), Hardware Encoder autodetection fails to find any hardware accelarated encoders.

This is surprising, since I have an nvidia 1660Ti, and I’ve tested that hardware acceleration works with:
ffmpeg -i somevideo.mp4 -preset slow -profile:v high -vcodec h264_nvenc -qmin:v 19 -qmax:v 20 -c:a copy -pix_fmt yuv420p test.mp4

where, the log clearly shows:

Output #0, mp4, to ‘test.mp4’:
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomhvc1
encoder : Lavf57.83.100
Stream #0:0(eng): Video: h264 (h264_nvenc) (High) (avc1 / 0x31637661), yuv420p, 1920x1080, q=19-20, 2000 kb/s, 50 fps, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 2019-11-09T14:28:52.000000Z
handler_name : VideoHandler
encoder : Lavc57.107.100 h264_nvenc

So… how do I make Shotcut able to see the same thing that the system ffmpeg can - that I do, in fact, have perfectly functional nvenc extensions on my GPU?

Edited to add: At some point in the past, I managed to get this to work, with an earlier build of Shotcut (probably 19.08.x?, given when I last used it) since starting it up had the correct Hardware Encoder settings available in Configure… [but this new release of Shotcut wouldn’t use them - presumably because it is no longer capable of locating them]. So, whatever it is has broken since August this year, although I remember it being a big struggle to get that release of Shotcut to autodetect my card too…

Edited a second time to note: I tried to post logs, but the forum thinks all the double colon separated items are URLs and won’t let me post log extracts.
To summarize, though: the logs show that the bundled ffmpeg is incapable of providing the hardware accelerated extensions. Is there a way to force shotcut to use the actually working ffmpeg installed on the system, rather than the broken version it bundles?

hardware encoding is very difficult to support on Linux with portable binary builds due to unstable API and driver changes over versions.
auto-configure is a different process than encoding in Shotcut. Did you try manually enabling nvenc in the configure dialog and exporting with it turned on?
When you turn off all options in the configure dialog, click the checkbox to enable hardware encoder and let auto-configure run, look at the end of View > Application Log for relevant messages. The ffmpeg executable you are running might be different than what Shotcut runs. You did not specify what build of Shotcut you are running.

So:

In order:

Yes, I tried manually enabling nvenc in the configure dialog and exporting with it turned on. This did not work (shotcut fell back to using x264 in software).

I did the process with the checkboxes you describe already (which is why I know something changed between the last time it worked and now). The logs show that the ffmpeg that Shotcut was using reported not having h264_nvenc (or the other things it checks for with ffmpeg) available as a codec.

I am very aware that the ffmpeg that I am using (the system ffmpeg ) is not the Shotcut version, which is why I am asking how I can tell Shotcut to use my, working, version, and not the version packaged in it :wink:

I am using the Flatpak distribution of Shotcut, which is currently invoked on my system as:
/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=shotcut --file-forwarding org.shotcut.Shotcut @@ %F @@

I am aware that there can be problems supporting hardware encoding on linux: but given that the system ffmpeg has been able to stably support nvenc for several releases, and with multiple changes of nVidia driver under it, for at least a year, it seems that packaging your own ffmpeg is really causing the issue here… especially with no way to override it.

I do not make the Flatpak version and not in a position to support your combination of hardware and OS right now. This is open source and you are a Linux, so you are encouraged to help debug it yourself. Here is the flatpak github project where you can view the flatpak recipe and file an issue:

You can see that it includes nv-codec-headers, which is necessary dependency for ffmpeg to use NVENC. Maybe there is a problem using NVENC through the flatpak container. I do not know. I did a quick google search on “flatpak nvenc” and found this for OBS.

On my system with AMD graphics and Ubuntu 18.04, hardware encoding in the flatpak is working through VAAPI. Maybe you can try the AppImage or portable archive build to see if it works any better. I used to use NVIDIA on Linux a year and half ago when I was developing out support for hardware encoding, but that card died. Getting NVENC to work was much easier than VAAPI, but I did not test through flatpak at the time.

So, the portable tar build does seem to correctly be able to identify nvenc extensions on my graphics card.

Given that the issue is clearly with the Flatpak packaging, might I suggest that you remove the link to it from the Shotcut download page, which implicitly provides an endorsement to it by existing? As you note, you’re not in a position to support it, and there’s obviously problems with it which don’t exist in the portable tar (which you do have control over).

No

Well, it’s your choice, but given that Flakpak apparently has a poorly understood bug which breaks a feature in Shotcut (and other packages) which a lot of people like using…