Hardware decoding failure due to invalid parameter

Trying to get this to work. Have a Quadro P1000 card, all the cuda checks pass but in execution, it fails and defaults to software. Log file attached, here’s the error I’m finding:

[mpeg2video @ 0000026adf73eb00] decoder->cvdl->cuvidCreateDecoder(&decoder->decoder, params) failed -> CUDA_ERROR_INVALID_VALUE: invalid argument

Thanks in advance.Frontline_WHRODT_2019_05_14_21_59_00.wtv-Frontline-2019-05-15T07-06-32.9029270-04-00.log.zip (106.0 KB)

Actually the error returned by the graphics drivers is related to decoding and not encoding. It’s still using the hardware encoder:

2019-05-15T07:11:59 MCEBuddy.AppWrapper.FFmpeg → Stream #0:0: Video: hevc (hevc_nvenc) (Main) (hev1 / 0x31766568), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1–1, 2000 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
2019-05-15T07:11:59 MCEBuddy.AppWrapper.FFmpeg → Metadata:
2019-05-15T07:11:59 MCEBuddy.AppWrapper.FFmpeg → encoder : Lavc58.42.100 hevc_nvenc

The hardware decoder request from ffmpeg is being rejected by the graphics card so it’s failing. There could be a few reasons, maybe it didn’t identify the video stream correctly to use the right codec or maybe it doesn’t support mpeg2 video decoding for that specific stream configuration.

You may not see much performance improvement since your original video is mpeg2 and mpeg2 decoding is pretty efficient in software, it may just take more time for it to copy all the video data over to the graphics memory, decode it and pass it back to ffmpeg and then pass it back to the video card for encoding. Usually h.264 and h.265 will see the biggest boost in hardware decoding.

If you would still like to try it, you can try to add this to your profile ffmpeg-general line, it forces the card to use a specific hardware decoder,

-c:v mpeg2_cuvid

This should be the last parameter on the ffmpeg-general line

Thanks for taking a look at it Goose. I’ll just leave it alone then since it actually seems to be operating correctly.

Independent Lens_WHRODT_2020_03_30_21_59_00.wtv-Independent Lens-2020-03-30T23-43-56.7z.zip (142.0 KB) Goose, seeing another issue. When the program starts, it goes like crazy using handbrake, but errors out and then reverts to ffmpeg which is much slower.

I’ve attached two conversion logs highlighting the issue. Any help is appreciated.eNASCAR iRacing Pro Invitational Series_FS1HD_2020_03_29_12_59_00.wtv-NASCAR-2020-03-29T16-49-48.log (2.2 MB)

Either the source video has corrupted data or your video driver has a bug and isn’t able to handle it:

2020-03-30T23:52:19 MCEBuddy.AppWrapper.Handbrake → Encoding: task 1 of 1, 16.18 % (386.94 fps, avg 353.10 fps, ETA 00h06m30s)
2020-03-30T23:52:20 MCEBuddy.AppWrapper.Handbrake → [23:52:20] 1048.345459s: Film → Video
2020-03-30T23:52:20 MCEBuddy.AppWrapper.Handbrake → [23:52:20] 1048.879272s: Video → Film
2020-03-30T23:52:20 MCEBuddy.AppWrapper.Handbrake → [h264_nvenc @ 00000000050d4dc0] Failed unlocking input buffer!: generic error (20)
2020-03-30T23:52:20 MCEBuddy.AppWrapper.Handbrake → [23:52:20] encavcodec: avcodec_send_frame failed
2020-03-30T23:52:20 MCEBuddy.AppWrapper.Handbrake → [h264_nvenc @ 00000000050d4dc0] Failed unlocking input buffer!: generic error (20)
2020-03-30T23:52:20 MCEBuddy.AppWrapper.Handbrake → [23:52:20] encavcodec: avcodec_send_frame failed
2020-03-30T23:52:20 MCEBuddy.AppWrapper.Handbrake → [23:52:20] encavcodec: avcodec_send_frame failed

Thanks for taking a look. So, I recently had to rebuild my server and when I reinstalled and rebuilt my MCE profiles, I unchecked “select best audio” and checked “multichannel audio”.

I can’t explain it, but I haven’t had the issue since.

I offer that in case anyone else is having a similar issue.

Or I could have just had a corrupted driver or something and when I rebuilt the server, it fixed it.

Hello!

I’m getting similar error messages when using this command:

ffmpeg -re -hwaccel cuvid -hwaccel_output_format cuda -extra_hw_frames 10 -i rtmp://xxxxxxxxx -map 0 -c:v h264_nvenc -b:v 2M -maxrate 2M -qmin 34 -qmax 51 -g 60 -bf 3 -b_ref_mode middle -bufsize 1M -c:a aac -ar 44100 -ac 1 -flush_packets 0 -f mpegts “udp:xxx.xxx.xxx.xxxx:xxxx”

[h264 @ 0x5641628791c0] decoder->cvdl->cuvidCreateDecoder(&decoder->decoder, params) failed → CUDA_ERROR_INVALID_VALUE: invalid argument
[h264 @ 0x5641628791c0] Using more than 32 (37) decode surfaces might cause nvdec to fail.
[h264 @ 0x5641628791c0] Try lowering the amount of threads. Using 16 right now.
[h264 @ 0x5641628791c0] Failed setup for format cuda: hwaccel initialisation returned error.

Please, give me some advice

Cheers!

Why are you using hwaccel for decoding. Most likely it’ll just slow down your conversion due to bus and memory transfer overhead.

Hi Goose.

I got 30 live channels running at the same time, server has 2 Quadro P5000 GPUs, I’m using hwaccel for decoding to avoid overload the CPUs.

Cheers!

You’ll likely slow it down and consume more CPU by enabling decoding for the reasons mentioned above when using other software features (like audio encoding, filters etc). Try not using it.