Skip to content

NVENC GPU selection (gpu=n) option ignored, always uses GPU 0 #7308

Closed

Description

@Jonas-Meyer97

Problem Description

Hi,
I’m trying to encode with NVENC and select which GPU to use. According to the HandBrake NVENC documentation
, the GPU can be specified with the gpu=n advanced encoder option.

I have two GPUs installed and both are detected by HandBrake and nvidia-smi:

PS C:\Users\Jonas> nvidia-smi
Fri Sep 26 19:28:06 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 576.88                 Driver Version: 576.88         CUDA Version: 12.9     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                  Driver-Model | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 3060 Ti   WDDM  |   00000000:23:00.0  On |                  N/A |
|  0%   49C    P8             15W /  220W |    2397MiB /   8192MiB |      1%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   1  NVIDIA GeForce RTX 5060 Ti   WDDM  |   00000000:2D:00.0 Off |                  N/A |
|  0%   34C    P8              5W /  180W |       0MiB /  16311MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------------------------------------------------------+

HandBrake also lists both GPUs in its activity log:

GPU Information:
  NVIDIA GeForce RTX 5060 Ti - 32.0.15.7688
  NVIDIA GeForce RTX 3060 Ti - 32.0.15.7688

I’ve tried setting gpu=0, gpu=1, and even gpu=2 / gpu=3 just in case.

"Video": {
    "Encoder": "nvenc_h265",
    "Options": "rc-lookahead=10:gpu=1",
    "Preset": "medium",
    "Profile": "auto",
    "Quality": 27
}

But no matter what I set, encoding always happens on GPU 0 (the RTX 3060 Ti). I can confirm this by monitoring GPU utilization in Windows Task Manager and nvidia-smi. GPU 1 (the RTX 5060 Ti) remains idle.

Expected behavior:
HandBrake should use the specified GPU (e.g. gpu=1 should run the encode on the RTX 5060 Ti).

Actual behavior:
Only GPU 0 is ever used for encoding.

Activity Log, Crash Log or any other details

HandBrake 1.10.2 (2025090600)
OS: Microsoft Windows NT 10.0.19045.0
CPU: AMD Ryzen 5 5600X 6-Core Processor             
Ram: 65457 MB, 
GPU Information:
  Virtual Desktop Monitor - 15.39.56.845
  NVIDIA GeForce RTX 5060 Ti - 32.0.15.7688
  NVIDIA GeForce RTX 3060 Ti - 32.0.15.7688
Screen: 1920x1200
Temp Dir: C:\Users\Jonas\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake\
Data Dir: C:\Users\Jonas\AppData\Roaming\HandBrake

-------------------------------------------

 # Starting Encode ...

[19:35:37] base preset: H.265 NVENC 1080p (Modified)
[19:35:37] Remote Process started with Process ID: 27368 using port: 8037. Max Allowed Instances: 2
[19:35:37] Worker: Starting HandBrake Engine ...
[19:35:37] Worker: Parent Process Id 43528
[19:35:37] Worker: Starting Web Server on port 8037 ...
[19:35:37] Worker: Starting Listener: 1
[19:35:37] Worker: Server Started
[19:35:37] Worker: Disconnected worker monitoring enabled!
[19:35:37] Compile-time hardening features are enabled
[19:35:37] nvenc: version 13.0 is available
[19:35:37] nvdec: is available
[19:35:38] CUDA Version: 8.6
[19:35:38] vcn: not available on this system
[19:35:38] qsv: not available on this system
[19:35:38] hb_init: starting libhb thread

[19:35:38] Starting work at: Fri Sep 26 19:35:38 2025
[19:35:38] 1 job(s) to process
[19:35:38] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": 160,
        "DRC": 0,
        "Encoder": "av_aac",
        "Gain": 0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Name": "Stereo",
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac"
    ],
    "FallbackEncoder": "none"
  },
  "Destination": {
    "ChapterList": [
      {
        "Name": "Chapter 1"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": false,
    "File": "E:\\HandbrakeOutput\\Test.mp4",
    "Options": {
      "IpodAtom": false,
      "Optimize": false
    },
    "Mux": "av_mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 20,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "1080",
          "width": "1080"
        }
      },
      {
        "ID": 11,
        "Settings": {
          "mode": "0"
        }
      }
    ]
  },
  "PAR": {
    "Num": 9,
    "Den": 16
  },
  "Metadata": {
    "CreationTime": "2025-06-28T03:09:59.000000Z"
  },
  "CoverArts": [],
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "F:\\test.mp4",
    "HWDecode": 4,
    "KeepDuplicateTitles": false
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "nvenc_h265",
    "Level": "auto",
    "MultiPass": false,
    "Turbo": false,
    "ColorRange": 1,
    "ColorMatrixCode": 0,
    "Options": "rc-lookahead=10:gpu=1",
    "Preset": "medium",
    "Profile": "auto",
    "Quality": 27,
    "HardwareDecode": 4
  }
}
[19:35:38] CPU: AMD Ryzen 5 5600X 6-Core Processor
[19:35:38]  - logical processor count: 12
[19:35:38] Intel Quick Sync Video support: no
[19:35:38] hb_scan: path=F:\test.mp4, title_index=1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'F:\test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: mp42iso2mp41
    creation_time   : 2025-06-28T03:09:59.000000Z
    encoder         : HandBrake 1.9.2 2025022300
  Duration: 00:14:18.70, start: 0.000000, bitrate: 3124 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 1080x1080 [SAR 9:16 DAR 9:16], 2954 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
      Metadata:
        creation_time   : 2025-06-28T03:09:59.000000Z
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 165 kb/s (default)
      Metadata:
        creation_time   : 2025-06-28T03:09:59.000000Z
        handler_name    : Stereo
        vendor_id       : [0][0][0][0]
        title           : Stereo
[19:35:38] scan: decoding previews for title 1
[19:35:38] scan: audio 0x1: aac, rate=48000Hz, bitrate=165034 Unknown (AAC LC, 2.0 ch, 165 kbps)
[19:35:38] using bitstream PAR 9:16
[19:35:38] scan: 10 previews, 1080x1080, 23.976 fps, autocrop = 0/0/0/0, aspect 1:1.78, PAR 9:16, color profile: 1-1-1, chroma location: left
[19:35:38] scan: supported video decoders: avcodec hwaccel
[19:35:38] libhb: scan thread found 1 valid title(s)
[19:35:38] Starting Task: Encoding Pass
[19:35:38] work: skipping crop/scale filter
[19:35:38] work: track 1, dithering not supported by codec
[19:35:38] work: only 1 chapter, disabling chapter markers
[19:35:38] job configuration:
[19:35:38]  * source
[19:35:38]    + F:\test.mp4
[19:35:38]    + title 1, chapter(s) 1 to 1
[19:35:38]    + container: mov,mp4,m4a,3gp,3g2,mj2
[19:35:38]    + data rate: 3124 kbps
[19:35:38]  * destination
[19:35:38]    + E:\HandbrakeOutput\Test.mp4
[19:35:38]    + container: MPEG-4 (libavformat)
[19:35:38]  * video track
[19:35:38]    + decoder: nvdec hwaccel hevc 8-bit (nv12, cuda)
[19:35:38]      + bitrate 2954 kbps
[19:35:38]    + filter
[19:35:38]      + Framerate Shaper (mode=0)
[19:35:38]        + frame rate: same as source (around 23.976 fps)
[19:35:38]    + Output geometry
[19:35:38]      + storage dimensions: 1080 x 1080
[19:35:38]      + pixel aspect ratio: 9 : 16
[19:35:38]      + display dimensions: 607 x 1080
[19:35:38]    + encoder: H.265 (NVEnc)
[19:35:38]      + preset:  medium
[19:35:38]      + options: rc-lookahead=10:gpu=1
[19:35:38]      + profile: auto
[19:35:38]      + level:   auto
[19:35:38]      + quality: 27.00 (CQ)
[19:35:38]      + color profile: 1-1-1
[19:35:38]      + color range: tv
[19:35:38]      + chroma location: left
[19:35:38]  * audio track 1
[19:35:38]    + name: Stereo
[19:35:38]    + decoder: Unknown (AAC LC, 2.0 ch, 165 kbps) (track 1, id 0x1)
[19:35:38]      + bitrate: 165 kbps, samplerate: 48000 Hz
[19:35:38]    + mixdown: Stereo
[19:35:38]    + encoder: AAC (libavcodec)
[19:35:38]      + bitrate: 160 kbps, samplerate: 48000 Hz
[19:35:38] sync: expecting 20588 video frames
[19:35:38] encavcodecInit: H.265 (Nvidia NVENC)
[19:35:38] encavcodec: encoding at rc=vbr, 27.00
[19:35:38] encavcodec: encoding with stored aspect 9/16
[19:35:38] sync: first pts audio 0x1 is 0
[19:35:38] sync: first pts video is 1080
[19:35:38] sync: "Chapter 1" (1) at frame 1 time 1080

What Operating System are you running?

Windows 10 (19045)

What version of HandBrake are you running?

HandBrake 1.10.2 (2025090600)

Where did you download HandBrake from?

handbrake.fr

Activity

  1. sr55 commented on Sep 26, 2025

    @sr55
    Contributor

    We don't support Multi-GPU in the stack so I would just avoid this entirely. I'm not entirely sure you won't see random GPU selection across system reboots. If I recall, device indexes can sometimes change in Windows. I'm not sure if libavcodec is smart enough to route for AV1 or not but you may also find that doesn't (or intermittently doesn't) work.

    You could try turning off hardware decoding in preferences but that somewhat defeats the purpose.

    The documentation will need updated to remove this option now as it doesn't really make sense to develop this. Actually, in general the options list needs overhauled.

  2. Jonas-Meyer97 commented on Sep 26, 2025

    @Jonas-Meyer97
    Author

    Thanks a lot for the very quick reply and the clarification!
    I’ll leave this issue open in case it’s useful for updating the documentation, but feel free to close it if you’d prefer.

  3. sr55 commented on Sep 27, 2025

    @sr55
    Contributor

    Removed from the docs. Site should update in a few hours.

    I've ended up removing all the option lists as it's not practical to maintain these when they there are so many caveats and generational differences between cards.

    For anyone reading this, we basically support whatever libavcodec will allow for each hardware encoder, with the caveat that many options are conditional and some may be overridden in HandBrake itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions