Nvidia HEVC issue

The experimental "Use HEVC for transcoding" isn't working in the nvidia docker. I get the error:

2022/09/26 22:59:58.355555 [HLS] ffmpeg: file25-ip192.168.2.1: [hevc_nvenc @ 0x6c45c00] Cannot load libcuda.so.1
2022/09/26 22:59:58.355560 [HLS] ffmpeg: file25-ip192.168.2.1: Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

nvidia-smi shows fine and I have the latest drivers for my two Quadro P2200 cards. I have also tested transcoding with hardware using a test docker image jrottenberg/ffmpeg:4.1-nvidia and it works correctly. Any help would be appreciated.

1 Like

I’ve been playing around with tdarr on my setup and I get the same error when I try encoding with b-frames enabled. @tmm1 can you take a look at that?

I'm getting the same error when trying to transcode to HEVC with the Channels Nvidia docker and my GeForce GTX 1060 -- Cannot load libcuda.so.1. I double checked and the 1060 does support HEVC encoding. Docker is running on Ubuntu 22.04 LTS (server, headless) with Nvidia 515 drivers.

Whenever I start a transcode, my log gets flooded with the lines below. @tmm1 any idea what the issue is?

2022/10/25 16:15:13.690972 [HLS] Starting live stream for channel 1 from [ip address redacted]
2022/10/25 16:15:15.554387 [HLS] ffmpeg: ch1-dANY-ca3dbf69ae77-remux:  [h264 @ 0x87e2bc0] mmco: unref short failure
2022/10/25 16:15:15.586097 [HLS] Probed live stream in 1.894987339s: h264 1920x1080 tt 4958801bps
2022/10/25 16:15:17.126281 [ENC] Starting encoder for ch1 in /shares/DVR/Streaming/ch1-dANY-ca3dbf69ae77-468563809/encoder-1-1584442393 at 1 (1.028522) (encoder=hevc_nvenc, resolution=720, deinterlacer=linear, bitrate=2094, segment_size=0.01)
2022/10/25 16:15:17.150137 [HLS] ffmpeg: ch1-dANY-ca3dbf69ae77-1-hevc-aac-copy--2094-128-720-0-0--linear-false-false-0.01-0:  [h264 @ 0x8424800] mmco: unref short failure
2022/10/25 16:15:17.327781 [HLS] ffmpeg: ch1-dANY-ca3dbf69ae77-1-hevc-aac-copy--2094-128-720-0-0--linear-false-false-0.01-0:      Last message repeated 1 times
2022/10/25 16:15:17.327804 [HLS] ffmpeg: ch1-dANY-ca3dbf69ae77-1-hevc-aac-copy--2094-128-720-0-0--linear-false-false-0.01-0:  [h264 @ 0x84b34c0] mmco: unref short failure
2022/10/25 16:15:17.342533 [HLS] ffmpeg: ch1-dANY-ca3dbf69ae77-1-hevc-aac-copy--2094-128-720-0-0--linear-false-false-0.01-0:  [h264 @ 0x8451380] mmco: unref short failure
2022/10/25 16:15:17.358323 [HLS] ffmpeg: ch1-dANY-ca3dbf69ae77-1-hevc-aac-copy--2094-128-720-0-0--linear-false-false-0.01-0:  [hevc_nvenc @ 0x8455680] Cannot load libcuda.so.1
2022/10/25 16:15:17.358340 [HLS] ffmpeg: ch1-dANY-ca3dbf69ae77-1-hevc-aac-copy--2094-128-720-0-0--linear-false-false-0.01-0:  Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
2022/10/25 16:15:17.358636 [HLS] ffmpeg: ch1-dANY-ca3dbf69ae77-1-hevc-aac-copy--2094-128-720-0-0--linear-false-false-0.01-0:  [aac @ 0x8454740] 2 frames left in the queue on closing
2022/10/25 16:15:17.358650 [HLS] ffmpeg: ch1-dANY-ca3dbf69ae77-1-hevc-aac-copy--2094-128-720-0-0--linear-false-false-0.01-0:  [aac @ 0x8455140] 2 frames left in the queue on closing
2022/10/25 16:15:17.476591 [ENC] Encoder stopped for ch1 in /shares/DVR/Streaming/ch1-dANY-ca3dbf69ae77-468563809/encoder-1-1584442393 after starting from 1 without encoding any segments

I don't have an nvidia+Linux setup to investigate. If you can provide remote access I can probably figure it out.

Try this build:

1 Like

Is there a docker image I can try? If not, I’ll try the build. Thanks for your response!

Update as follows:

Great work!

Thanks @tmm1! Working for me now too.

I notice 1080i/p always gets transcoded to 720p. Is that by design and/or a limitation of hevc_nvenc?

At what bitrates? Starting at 4mbps we limit to 720p.

Ah that's it. I bumped it up to 6mbps and it went to 1080p. It threw me because I usually have remote streaming set to 4mbps and it's 1080p when using the normal H.264.

I would think it would be the opposite? Wouldn't HEVC be able to stream higher res/better quality at a lower bitrate?