Opened 4 years ago

Closed 4 years ago

#9165 closed defect (fixed)

"Lossless encoding not supported" error occurs using NVIDIA Video Codec SDK 10.0

Reported by: bombur33 Owned by: Timo R.
Priority: normal Component: avcodec
Version: git-master Keywords: nvenc
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
When using h264 nvenc, a "Lossless encoding not supported" error occurs using NVIDIA Video Codec SDK 10.0 on certain NVIDIA cards despite using lossy settings. In this case, it's a GTX 960 (Maxwell), which doesn't have lossless capability. When lossy settings are used, it shouldn't matter that the card doesn't support lossless.

The problem seems to trace back from around line 361 of libavcodec/nvenc.c that checks ctx->preset >= PRESET_LOSSLESS_DEFAULT. The new SDK 10 presets (p1-p7) seem to evaluate greater than PRESET_LOSSLESS_DEFAULT despite the new -tune parameter not being set to lossless. In SDK 10, the -tune parameter controls lossless rather than the preset. See the preset migration guide:
https://docs.nvidia.com/video-technologies/video-codec-sdk/nvenc-preset-migration-guide/#h264-preset-migration-table
How to reproduce:

% ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input -c:v h264_nvenc -preset:v p1 -tune:v hq -rc:v vbr -c:a copy -y output.mp4
ffmpeg version
built on 2021-03-24

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

ffmpeg-20210327-232749.log (26.3 KB ) - added by bombur33 4 years ago.
run log

Download all attachments as: .zip

Change History (7)

by bombur33, 4 years ago

Attachment: ffmpeg-20210327-232749.log added

run log

comment:1 by bombur33, 4 years ago

I should mention, the problem occurs when using the new p1-p7 presets added in SDK 10 on GPUs that don't support lossless. I've run the same test successfully on a newer NVIDIA GPU that supports lossless.

Last edited 4 years ago by bombur33 (previous) (diff)

in reply to:  1 comment:2 by Balling, 4 years ago

Status: newopen

Replying to bombur33:

I should mention, the problem occurs when using the new p1-p7 presets added in SDK 10 on GPUs that don't support lossless. I've run the same test successfully on a newer NVIDIA GPU that supports lossless.

Well, obviously. So the patch is just to add < PRESET_P1 and maybe the same about ctx->tuning_info in #ifdef NVENC_HAVE_NEW_PARAMETERS.

But yeah, that is because ret will be < 0!

To oromit: I tested it on 2080 Ti it works great there because lossless is supported and we just do not return. So I checked with his command... It is not lossless... While -tune:v lossless will be lossless...

comment:3 by Carl Eugen Hoyos, 4 years ago

Component: undeterminedavcodec
Keywords: lossless h264 removed

comment:5 by Balling, 4 years ago

Owner: set to Timo R.

Can you fix this ASAP? I proposed a patch but not sure about whether we should limit/check ctx->tuning_info too.

comment:6 by Balling, 4 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.