How to List FFmpeg NVENC Presets and Rate Control
This guide provides a straightforward method for identifying the available NVIDIA NVENC hardware-accelerated video encoding presets and rate control modes in FFmpeg. By utilizing specific command-line help queries, you can quickly retrieve the exact options supported by your system’s GPU and FFmpeg installation.
Querying the NVENC Encoder Help
To find the list of supported presets and rate control modes, you
need to query FFmpeg’s help documentation for the specific NVENC encoder
you plan to use, such as H.264 (h264_nvenc), HEVC/H.265
(hevc_nvenc), or AV1 (av1_nvenc).
Run the following command in your terminal to output the full list of options for the H.264 NVENC encoder:
ffmpeg -h encoder=h264_nvencFor HEVC or AV1, replace h264_nvenc with
hevc_nvenc or av1_nvenc respectively.
Finding NVENC Presets
In the command output, locate the section labeled
-preset. This section lists all the quality and performance
presets available for your GPU. Modern NVENC encoders typically use the
p1 to p7 preset naming convention, alongside
traditional aliases:
- p1 to p3: Performance-focused presets (fastest, lowest quality).
- p4: Medium/default preset.
- p5 to p7: Quality-focused presets (slowest, highest quality).
- Aliases:
slow,medium,fast,lossless, andhp(high performance).
You can apply these in your encoding command using the
-preset flag:
ffmpeg -i input.mp4 -c:v h264_nvenc -preset p6 output.mp4Finding NVENC Rate Control Modes
Scroll further down the help output to find the -rc
option. This section details the available rate control modes, which
dictate how the encoder distributes bitrate across the video. The most
common NVENC rate control options include:
- constqp: Constant QP (Quality Parameter).
- vbr: Variable Bitrate.
- cbr: Constant Bitrate.
- cbr_ld_hq: Constant Bitrate, Low Delay, High Quality.
- vbr_hq: Variable Bitrate, High Quality.
To specify a rate control mode, use the -rc flag
followed by the desired mode name in your encoding command:
ffmpeg -i input.mp4 -c:v h264_nvenc -rc vbr_hq -b:v 5M output.mp4