handbrakecli not recognizing GPU for nvenc usage

Discussion of the HandBrake command line interface (CLI)
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
mdallmer
New User
Posts: 1
Joined: Sun Mar 03, 2024 10:37 am

handbrakecli not recognizing GPU for nvenc usage

Post by mdallmer »

Description of problem or question:
Hi all,

in short, I've got a problem with handbrakecli not recognizing my CUDA capaple GPU whereas the Handbrake GUI is using that GPU just fine.
Handbrakecli is located in the same folder as the GUI install, and this is the command line I used:

Code: Select all

HandBrakeCLI --preset-import-gui --preset "Popcorn h264 nvenc" -i "D:\video\maxx.ts" -o "D:\video\maxx-cli.mp4"
The relevant (I think) error I get is:

Code: Select all

[h264_nvenc @ 0000021668afa9c0] dl_fn->cuda_dl->cuInit(0) failed -> CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
Steps to reproduce the problem (If Applicable):
Again, the same profile works just fine using the Handbrake GUI.

More, I have a similar setup on another machine, main difference being that there the OS is Windows 10 and the GPU is a Quadro P2000. On that machine, the same handbrakecli command works as expected.

I updated NVidia drivers to latest, just installed the NVIDIA CUDA environment (stabbing in the dark), but it made no difference. Checked Path variable against the working machine, they appear to be similar.

HandBrake version (e.g., 1.0.0):
1.7.3 (2024021000)

Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
Windows Server 2022

HandBrake Activity Log ***required*** (see How-to get an activity log)

This is the full handbrakecli output, I guess it's the right thing to post instead of the GUI activity log?!

Code: Select all

...\HandBrake>HandBrakeCLI --preset-import-gui --preset "Popcorn h264 nvenc" -i "D:\video\maxx.ts" -o "D:\video\maxx-cli.mp4"
[10:39:53] Compile-time hardening features are enabled
[10:39:53] nvenc: version 12.2 is available
[10:39:53] nvdec: is available
[10:39:53] vcn: not available on this system
[10:39:53] qsv: not available on this system
[10:39:53] hb_init: starting libhb thread
[10:39:53] thread 2 started ("libhb")
HandBrake 1.7.3 (2024021000) - MinGW x86_64 - https://handbrake.fr
16 CPUs detected
Opening D:\video\maxx.ts...
[10:39:53] CPU: AMD Ryzen 7 3700X 8-Core Processor
[10:39:53]  - logical processor count: 16
[10:39:53] Intel Quick Sync Video support: no
[10:39:53] hb_scan: path=D:\video\maxx.ts, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:333: failed opening UDF image D:\video\maxx.ts
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
[10:39:53] bd: not a bd - trying as a stream/file instead
libdvdread: Encrypted DVD support unavailable.
libdvdread: DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: vm: failed to read VIDEO_TS.IFO
[10:39:53] dvd: not a dvd - trying as a stream/file instead
[10:39:53] file is MPEG Transport Stream with 188 byte packets offset 0 bytes
[10:39:53] Found the following PIDS
[10:39:53]     Video PIDS :
[10:39:53]       0x5ff type MPEG2 (0x2) (PCR)
[10:39:53]     Audio PIDS :
[10:39:53]       0x600 type MPEG1 (0x3)
[10:39:53]     Subtitle PIDS :
[10:39:53]     Other PIDS :
[10:39:53] stream id 0x600 (type 0x3 substream 0x0) audio 0x600
[10:39:53] scan: decoding previews for title 1
[10:39:53] file is MPEG Transport Stream with 188 byte packets offset 0 bytes
[10:39:53] scan: audio 0x600: mp2, rate=48000Hz, bitrate=128000 Deutsch (MPEG, 2.0 ch, 128 kbps)
[10:39:53] stream: 14 good frames, 0 errors (0%)
[10:39:53] using bitstream PAR 64:45
[10:39:53] scan: 10 previews, 720x576, 25.000 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 64:45, color profile: 5-1-6, chroma location: left
Scanning title 1 of 1, preview 10, 100.00 %[10:39:53] libhb: scan thread found 1 valid title(s)
+ Using preset: Popcorn h264 nvenc
+ title 1:
  + stream: D:\video\maxx.ts
  + duration: 00:26:27
  + size: 720x576, pixel aspect: 64/45, display aspect: 1.78, 25.000 fps
  + autocrop: 0/0/0/0
  + chapters:
    + 1: duration 00:26:27
  + audio tracks:
    + 1, Deutsch (MPEG, 2.0 ch, 128 kbps) (iso639-2: deu)
  + subtitle tracks:
[10:39:53] Starting work at: Sun Mar 03 10:39:53 2024

[10:39:53] 1 job(s) to process
[10:39:53] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 160,
                "CompressionLevel": 0.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "av_aac",
                "Gain": 0.0,
                "Mixdown": "stereo",
                "NormalizeMixLevel": false,
                "PresetEncoder": "av_aac",
                "Quality": -3.0,
                "Samplerate": 0,
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:aac",
            "copy:ac3",
            "copy:dtshd",
            "copy:dts",
            "copy:mp3",
            "copy:truehd",
            "copy:flac",
            "copy:eac3"
        ],
        "FallbackEncoder": "ac3"
    },
    "Destination": {
        "AlignAVStart": true,
        "ChapterList": [
            {
                "Duration": {
                    "Hours": 0,
                    "Minutes": 26,
                    "Seconds": 27,
                    "Ticks": 142862227
                },
                "Name": "Chapter 1"
            }
        ],
        "ChapterMarkers": false,
        "File": "D:\\video\\maxx-cli.mp4",
        "InlineParameterSets": false,
        "Mux": "m4v",
        "Options": {
            "IpodAtom": false,
            "Optimize": false
        }
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 10,
                "Settings": {
                    "mode": 1
                }
            },
            {
                "ID": 19,
                "Settings": {
                    "crop-bottom": 0,
                    "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 0,
                    "height": 576,
                    "width": 720
                }
            }
        ]
    },
    "Metadata": {},
    "PAR": {
        "Den": 45,
        "Num": 64
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "HWDecode": 0,
        "Path": "D:\\video\\maxx.ts",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "ChromaLocation": 1,
        "ColorInputFormat": 0,
        "ColorMatrix": 6,
        "ColorOutputFormat": 0,
        "ColorPrimaries": 5,
        "ColorRange": 1,
        "ColorTransfer": 1,
        "Encoder": "nvenc_h264",
        "HardwareDecode": 0,
        "Level": "4.1",
        "MultiPass": false,
        "Options": "",
        "Preset": "slow",
        "Profile": "high",
        "QSV": {
            "AdapterIndex": 0,
            "AsyncDepth": 0,
            "Decode": false
        },
        "Quality": 21.0,
        "Tune": "",
        "Turbo": false
    }
}
[10:39:53] Starting Task: Encoding Pass
[10:39:53] work: skipping crop/scale filter
[10:39:53] work: track 1, compression level not supported by codec
[10:39:53] job configuration:
[10:39:53]  * source
[10:39:53]    + D:\video\maxx.ts
[10:39:53]    + title 1, chapter(s) 1 to 1
[10:39:53]  * destination
[10:39:53]    + D:\video\maxx-cli.mp4
[10:39:53]    + container: MPEG-4 (libavformat)
[10:39:53]      + align initial A/V stream timestamps
[10:39:53]  * video track
[10:39:53]    + decoder: mpeg2video 8-bit (yuv420p)
[10:39:53]      + bitrate 200 kbps
[10:39:53]    + filter
[10:39:53]      + Framerate Shaper (mode=1)
[10:39:53]        + frame rate: 25.000 fps -> constant 25.000 fps
[10:39:53]    + Output geometry
[10:39:53]      + storage dimensions: 720 x 576
[10:39:53]      + pixel aspect ratio: 64 : 45
[10:39:53]      + display dimensions: 1024 x 576
[10:39:53]    + encoder: H.264 (NVEnc)
[10:39:53]      + preset:  slow
[10:39:53]      + profile: high
[10:39:53]      + level:   4.1
[10:39:53]      + quality: 21.00 (CQ)
[10:39:53]      + color profile: 5-1-6
[10:39:53]      + chroma location: left
[10:39:53]  * audio track 1
[10:39:53]    + decoder: Deutsch (MPEG, 2.0 ch, 128 kbps) (track 1, id 0x600)
[10:39:53]      + bitrate: 128 kbps, samplerate: 48000 Hz
[10:39:53]    + mixdown: Stereo
[10:39:53]    + encoder: AAC (libavcodec)
[10:39:53]      + bitrate: 160 kbps, samplerate: 48000 Hz
tEhn c1o8d8i nbgy:t et apsakc k1e tosf  o1f,f s0e.t0 00  %bytes
[10:39:53] sync: expecting 39683 video frames
[10:39:53] encavcodecInit: H.264 (Nvidia NVENC)
[10:39:53] encavcodec: encoding at rc=vbr, 21.00
[10:39:53] encavcodec: encoding with stored aspect 64/45
[h264_nvenc @ 0000021668afa9c0] dl_fn->cuda_dl->cuInit(0) failed -> CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
[10:39:53] encavcodecInit: avcodec_open failed
ERROR: Failure to initialise thread 'FFMPEG encoder (libavcodec)'
[10:39:53] vfr: 0 frames output, 0 dropped and 0 duped for CFR/PFR
[10:39:53] vfr: lost time: 0 (0 frames)
[10:39:53] vfr: gained time: 0 (0 frames) (0 not accounted for)
[10:39:53] mp2-decoder done: 0 frames, 0 decoder errors
[10:39:53] mpeg2video-decoder done: 0 frames, 0 decoder errors
[10:39:53] sync: got 0 frames, 39683 expected
Encoding: task 1 of 1, 0.00 %[aac @ 000002166841a340] Ignoring attempt to flush encoder that doesn't support it
[aac @ 000002166841a340] Qavg: nan
[10:39:54] Finished work at: Sun Mar 03 10:39:54 2024

[10:39:54] libhb: work result = 3

Encode failed (error 3).

HandBrake has exited.
Thanks for any input on this!
Post Reply