FFNVEnc
NVEnc (FFmpeg) encodes H.264 and H.265 on the video encoder chip of NVIDIA graphics cards (NVENC), using the h264_nvenc and hevc_nvenc encoders of ffmpeg. It is the NVENC route for systems without NVEncC; on Windows Hybrid does not offer it and uses NVEncC instead, see NVEnc. Hybrid marks this encoder as experimental: ffmpeg cannot report which feature combinations a card supports, so the tab cannot lock what the card is unable to do.
Base → Video: NVEnc (FFmpeg), then the NVEnc (FFmpeg) tab
What it does
The encoding itself runs on the graphics card, which makes it many times faster than a software encoder at a low CPU load. At the same bit rate the result is usually less efficient than a slow x264 or x265 encode; hardware encoding is the choice when speed matters more than the last bit of compression.
The rate control modes are:
- 1-pass constant quantizer: the same quantizer for the whole video; size and quality follow the content.
- 1-pass constant quality: a quality target, the bit rate results from the content. The usual choice when no size has to be hit.
- 1-pass variable bitrate: aims at an average bit rate.
- 1-pass variable bitrate (2pass optimization): the same, but the card analyses each frame in a first pass before coding it, which distributes the bits better.
- 1-pass constant bitrate: holds the bit rate constant, for streaming and fixed channels.
There is no real two-pass mode over the whole file; target sizes are hit through the calculated bit rate and are therefore less precise than with a 2-pass software encoder.
Requirements
- An NVIDIA graphics card with NVENC and a current NVIDIA driver. What works depends on the card generation: H.265, 10 bit, 4:4:4, B-frames for H.265 and the temporal options are not available on every card.
- Linux, with an ffmpeg that was built with NVENC support. Hybrid only lists the encoder when its ffmpeg has the nvenc encoders and an NVIDIA card was found.
- Not offered on Windows (NVEncC is used there) and not available on macOS.
Settings
The option column shows the ffmpeg option a control ends up as. Controls for the codec that is not selected are hidden: Preset, Profile and Level switch between their H.264 and H.265 versions with Encoder.
Base
| Control | ffmpeg option | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Encoder | -vcodec | H.264, H.265 | H.265 | Video format: h264_nvenc or hevc_nvenc. H.265 needs less bit rate for the same quality, H.264 plays on more devices.
|
| Preset | -preset | slow hq 2pass, medium (hq 1pass), fast (hp 1pass), fastest (lowest quality), faster (lower quality), fast (low quality), medium (default), slow (good quality), slower (better quality), slowest (best quality) | medium (hq 1pass) | Speed against quality. The first three entries are ffmpeg's slow, medium and fast, the other seven are NVIDIA's presets p1 (fastest) to p7 (slowest). ffmpeg's own default is p4. There is one list for H.264 and one for H.265, with the same entries.
|
| Profile (H.264) | -profile:v | Baseline, Main, High, High 4:4:4 | High | H.264 profile, the set of coding tools a decoder must support. High fits every current player; High 4:4:4 is needed for 4:2:2/4:4:4 color sampling and 10 bit. |
| Profile (H.265) | -profile:v | Main, Main 10, Rext | Main | H.265 profile. Main is 8 bit, Main 10 allows 10 bit, Rext (range extensions) is for 4:2:2 and 4:4:4. |
| Level | -level | H.264: auto, 1.0 – 6.2; H.265: auto, 1 – 6.2 | auto | Upper limit for frame size, frame rate and bit rate that the stream declares. auto (-level 0) lets the encoder pick the level the video needs. Set a fixed level only when the playback device demands one.
|
| Tier | -tier | main, high | main | H.265 tier. high raises the bit rate limit of the level; not every decoder accepts it. Only available with H.265. |
| Color sampling | -pix_fmt | i420, i422, i444 | i420 | Chroma subsampling of the output. 4:2:0 is what every player takes. With H.264 the other two are only offered with the profile High 4:4:4; they also need a card that supports them. |
| Bit depth | -pix_fmt | 8-bit, 10-bit | 8-bit | Bit depth of the output. 10 bit is only offered with the H.265 profiles Main 10 and Rext or the H.264 profile High 4:4:4; with other profiles the control is locked at 8 bit. |
| Mode | -rc, -multipass, -cq, -qp | 1-pass constant quantizer, 1-pass variable bitrate, 1-pass constant bitrate, 1-pass variable bitrate (2pass optimization), 1-pass constant quality | 1-pass variable bitrate (2pass optimization) | Rate control mode, see above. The control below it changes with the mode: quantizer, quality or bit rate/target size. |
| Tune | -tune | High quality, Low Latency, Ultra low Latency, Lossless, Ultra high quality | High quality | What the encoder optimizes for. The two latency settings drop the tools that need to look ahead and only cost quality when encoding a file. Ultra high quality exists in ffmpeg for hevc_nvenc only and is offered for H.265 only.
|
| Quantization strength | -rc constqp -qp | 0 – 51 | 0 | Quantizer of the constant quantizer mode; lower is better and bigger. Only shown in that mode. |
| Quality | -cq, -b:v 0k | 0 – 51, step 0.01 | 0 | Quality target of the constant quality mode; lower is better and bigger. 0 means automatic, i.e. the encoder chooses. Only shown in that mode. |
| Bitrate (kbit/s) | -b:v | 16 – 245760 | on, 1500 | Target bit rate of the three bit rate modes. Select it to work with a bit rate instead of a target size. |
| Target size (MiB), Target mode | -b:v | 0.2 MiB and up; custom, 1/4 CD … 1 BD 50 | off; custom, 700 | Aim at a file size instead; Hybrid computes the video bit rate from the size, the length and the size of audio and other streams. Target mode offers common media sizes. |
The Configuration row at the bottom saves, loads and deletes named sets of these settings.
Frame
| Control | ffmpeg option | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Multiple References, Maximum number of reference frames | -refs | on/off; 0 – 8 | off, 3 | How many earlier frames a frame may refer to. With the group switched off the option is not written and the encoder decides. More references can help compression a little and need more decoder memory. |
| Maximum number of consecutive b-frames | -bf | 0 – 8 | 0 | Number of B-frames between two reference frames. B-frames improve compression; how many the card accepts (and whether it accepts them for H.265 at all) depends on its generation. With 0 the option is not written. |
| Non-Reference P-Frames | -nonref_p | on/off | on | Lets the encoder insert P-frames that no other frame refers to. They can be coded with fewer bits. |
| Strict GOP, (GOP size) | -strict_gop, -g | on/off; 0 – 1000 | on, 0 | Strict GOP asks the encoder to keep the bit rate even from GOP to GOP. The number next to it is the key frame distance in frames; it is only written with Strict GOP on and a value above 0, otherwise ffmpeg's default distance applies. |
| Scene cut | -no-scenecut (when off) | on/off | on | Lets the encoder place an I-frame at a scene change. This detection only works when the lookahead is active. |
| Rate control lookahead | -rc-lookahead | 0 – 1000 | 0 | Number of frames the rate control looks ahead; 0 switches it off. A lookahead improves the bit distribution and is the base for the scene cut detection, at the cost of memory on the card and some delay. Written for H.264 and H.265. |
Quantization
| Control | ffmpeg option | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Quantizer min/max | -qmin, -qmax | 0 – 51 each | 0 / 51 | Lowest and highest quantizer the rate control may use. Only in the bit rate modes; locked and not written in the constant quantizer and constant quality modes. |
| Adaptive quantization (spatial), (strength) | -spatial-aq, -aq-strength | on/off; 1 – 15 | off, 8 | Moves bits inside a frame from busy areas to flat ones, where blocking and banding show first. The strength goes from 1 (mild) to 15 (aggressive) and is only available with the option on. Locked in constant quantizer mode. |
| Adaptive quantization (temporal), (level) | -temporal-aq, -tf_level | on/off; -1, 0, 4 | off, -1 | Moves bits over time towards parts of the picture that stay on screen; helps on static content. The list next to it sets the strength of NVENC's temporal filter: -1 leaves it to the encoder and writes nothing, 0 and 4 are the levels ffmpeg knows. The list is only available with the option on and at least 4 B-frames. Locked in constant quantizer mode. |
Misc
HDR signaling
The group can only be switched on with H.265. Each row has a check box; only checked rows are written. These options only flag the stream, they do not convert the picture.
| Control | ffmpeg option | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Range | -color_range | tv, pc | off, tv | Signals limited (16 – 235) or full (0 – 255) range. |
| Primaries | -color_primaries | undef, bt709, bt470m, bt470bg, smpte170m, smpte240m, film, bt2020, smpte-st-4282 | off, undef | Color primaries of the video, e.g. bt2020 for HDR and UHD material. undef writes nothing. |
| Matrix | -colorspace | undef, bt709, fcc, bt470bg, smpte170m, smpte240m, GBR, YCgCo, bt2020nc, bt2020c | off, undef | Matrix that was used to derive YUV from RGB. undef writes nothing. |
| Transfer characteristics | -color_trc | undef, bt709, bt470m, bt470bg, smpte170m, smpte240m, linear, log100, log316, iec61966-2-4, bt1361e, iec61966-2-1, bt2020-10, bt2020-12, smpte-st-2084, smpte-st-428, arib-std-b67 | off, undef | Transfer curve: smpte-st-2084 is PQ (HDR10), arib-std-b67 is HLG. undef writes nothing. |
| Chroma sample location | -chroma_sample_location | 0 – 5 | off, 2 | Position of the chroma samples relative to luma: 0 left, 1 center, 2 top left, 3 top, 4 bottom left, 5 bottom. HDR10 material normally uses 2. |
Other controls
| Control | ffmpeg option | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Surfaces | -surfaces | 0 – 64 | 32 | Number of frame buffers the encoder keeps on the card. 0 is ffmpeg's default and lets it choose. More surfaces cost video memory. |
| Save as interlaced | -flags +ildct+ilme, -vf setfield | on/off | off | Flags the H.264 output as interlaced; the field order is taken from the video (top field first unless it is bottom field first). Only available with H.264. |
| BFF | -vf setfield=bff | on/off | off | Flags the output as bottom field first, whatever the video reports. Only available with Save as interlaced on. |
| Addition | – | text | empty | Text that is appended unchanged to the end of the encoder options, for ffmpeg options the tab does not offer (e.g. -b_ref_mode middle).
|
| Minimize command line | – | on/off | on | Leaves out options whose value is ffmpeg's default anyway. The result does not change, the call only gets shorter. |
Example
Typical call (composed from the settings, not measured): H.265, preset slow (good quality), profile Main, variable bit rate with 2pass optimization at 4000 kbit/s, spatial adaptive quantization, everything else at Hybrid's defaults, on a 640x352 source with 25 fps:
vspipe "encodingTempSynthSkript.vpy" - --outputindex 0 -c y4m --progress | ffmpeg -y -noautorotate -nostdin -threads 8 -f yuv4mpegpipe -i - -an -sn -color_primaries bt470bg -color_trc smpte170m -colorspace bt470bg -color_range tv -pix_fmt yuv420p -fps_mode auto -r 25/1 -vcodec hevc_nvenc -preset p5 -rc vbr -multipass fullres -qmin 0 -qmax 51 -b:v 4000k -spatial-aq 1 -aq-strength 8 -surfaces 32 -nonref_p 1 -strict_gop 1 -bsf:v hevc_mp4toannexb -metadata encoding_tool="Hybrid 2026.11.22.1" "test.265"
In constant quality mode the rate part becomes -cq <quality> -b:v 0k, in constant quantizer mode -rc constqp -qp <quantizer>.
How Hybrid calls it
- The filter script (Vapoursynth or AviSynth) is piped into ffmpeg; without a script ffmpeg reads the source itself.
- ffmpeg writes a raw
.264or.265stream (with the matchingmp4toannexbbitstream filter), which Hybrid muxes into the chosen container afterwards. - Color sampling and Bit depth become the pixel format (
-pix_fmt), e.g.yuv420poryuv420p10le. -preset,-profile:v,-level,-rc-lookahead,-surfacesand, for H.265,-tierare always part of the call; Minimize command line removes the values that equal ffmpeg's defaults (-preset p4,-tune 1,-level 0,-rc-lookahead 0,-surfaces 0,-profile:v highfor H.264,-profile:v 0and-tier mainfor H.265) and the switches that are off. The H.264 profile is written by name (baseline,main,high,high444p), the H.265 level as well (-level 5.1).- 1-pass variable bitrate (2pass optimization) is written as
-rc vbr -multipass fullres. Constant quality is written as-cqwith-b:v 0kand no-rc. - Color matrix, transfer, primaries and range of the video are passed to ffmpeg as
-colorspace,-color_trc,-color_primariesand-color_range; the HDR signaling group adds its own values for H.265. - The text from Addition is added after minimizing, so it always stays as typed.
- Only the encoding runs on the card. Filtering is done by the script on the CPU (or by the GPU filters chosen there).
Background
NVEnc (FFmpeg) or NVEncC
Both use the same hardware. NVEncC, which Hybrid uses on Windows and also supports on Linux, exposes far more of NVENC (AV1, more rate control and HDR options, per-card feature detection). The ffmpeg route needs nothing but an ffmpeg with NVENC support and is the fallback where NVEncC is not available.
Card limits
The tab cannot check the card. If a job fails right at the start with an error from the encoder (for example an invalid parameter or an unsupported profile), the usual causes are 10 bit or 4:4:4 on a card without it, B-frames for H.265 on an older card, or a combination of tune and codec that ffmpeg does not accept. Go back to H.264 High or H.265 Main, 8 bit, 4:2:0 and no B-frames, and add options from there.
Sources
- FFmpeg codecs documentation
- FFmpeg wiki: hardware acceleration introduction (NVENC)
- NVIDIA Video Codec SDK documentation
- the built-in help of ffmpeg (
ffmpeg -h encoder=h264_nvenc,ffmpeg -h encoder=hevc_nvenc) - Hybrid's tooltips