26 #define OFFSET(x) offsetof(NvencContext, x)
27 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
34 {
"p1",
"fastest (lowest quality)", 0,
AV_OPT_TYPE_CONST, { .i64 = PRESET_P1 }, 0, 0,
VE, .unit =
"preset" },
35 {
"p2",
"faster (lower quality)", 0,
AV_OPT_TYPE_CONST, { .i64 = PRESET_P2 }, 0, 0,
VE, .unit =
"preset" },
36 {
"p3",
"fast (low quality)", 0,
AV_OPT_TYPE_CONST, { .i64 = PRESET_P3 }, 0, 0,
VE, .unit =
"preset" },
37 {
"p4",
"medium (default)", 0,
AV_OPT_TYPE_CONST, { .i64 = PRESET_P4 }, 0, 0,
VE, .unit =
"preset" },
38 {
"p5",
"slow (good quality)", 0,
AV_OPT_TYPE_CONST, { .i64 = PRESET_P5 }, 0, 0,
VE, .unit =
"preset" },
39 {
"p6",
"slower (better quality)", 0,
AV_OPT_TYPE_CONST, { .i64 = PRESET_P6 }, 0, 0,
VE, .unit =
"preset" },
40 {
"p7",
"slowest (best quality)", 0,
AV_OPT_TYPE_CONST, { .i64 = PRESET_P7 }, 0, 0,
VE, .unit =
"preset" },
41 {
"tune",
"Set the encoding tuning info",
OFFSET(tuning_info),
AV_OPT_TYPE_INT, { .i64 = NV_ENC_TUNING_INFO_HIGH_QUALITY }, NV_ENC_TUNING_INFO_HIGH_QUALITY, NV_ENC_TUNING_INFO_LOSSLESS,
VE, .unit =
"tune" },
42 {
"hq",
"High quality", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_HIGH_QUALITY }, 0, 0,
VE, .unit =
"tune" },
43 {
"ll",
"Low latency", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOW_LATENCY }, 0, 0,
VE, .unit =
"tune" },
44 {
"ull",
"Ultra low latency", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY }, 0, 0,
VE, .unit =
"tune" },
45 {
"lossless",
"Lossless", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOSSLESS }, 0, 0,
VE, .unit =
"tune" },
46 {
"level",
"Set the encoding level restriction",
OFFSET(
level),
AV_OPT_TYPE_INT, { .i64 = NV_ENC_LEVEL_AV1_AUTOSELECT }, NV_ENC_LEVEL_AV1_2, NV_ENC_LEVEL_AV1_AUTOSELECT,
VE, .unit =
"level" },
47 {
"auto",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_AUTOSELECT }, 0, 0,
VE, .unit =
"level" },
48 {
"2",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_2 }, 0, 0,
VE, .unit =
"level" },
49 {
"2.0",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_2 }, 0, 0,
VE, .unit =
"level" },
50 {
"2.1",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_21 }, 0, 0,
VE, .unit =
"level" },
51 {
"2.2",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_22 }, 0, 0,
VE, .unit =
"level" },
52 {
"2.3",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_23 }, 0, 0,
VE, .unit =
"level" },
53 {
"3",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_3 }, 0, 0,
VE, .unit =
"level" },
54 {
"3.0",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_3 }, 0, 0,
VE, .unit =
"level" },
55 {
"3.1",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_31 }, 0, 0,
VE, .unit =
"level" },
56 {
"3.2",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_32 }, 0, 0,
VE, .unit =
"level" },
57 {
"3.3",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_33 }, 0, 0,
VE, .unit =
"level" },
58 {
"4",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_4 }, 0, 0,
VE, .unit =
"level" },
59 {
"4.0",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_4 }, 0, 0,
VE, .unit =
"level" },
60 {
"4.1",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_41 }, 0, 0,
VE, .unit =
"level" },
61 {
"4.2",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_42 }, 0, 0,
VE, .unit =
"level" },
62 {
"4.3",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_43 }, 0, 0,
VE, .unit =
"level" },
63 {
"5",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_5 }, 0, 0,
VE, .unit =
"level" },
64 {
"5.0",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_5 }, 0, 0,
VE, .unit =
"level" },
65 {
"5.1",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_51 }, 0, 0,
VE, .unit =
"level" },
66 {
"5.2",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_52 }, 0, 0,
VE, .unit =
"level" },
67 {
"5.3",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_53 }, 0, 0,
VE, .unit =
"level" },
68 {
"6",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_6 }, 0, 0,
VE, .unit =
"level" },
69 {
"6.0",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_6 }, 0, 0,
VE, .unit =
"level" },
70 {
"6.1",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_61 }, 0, 0,
VE, .unit =
"level" },
71 {
"6.2",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_62 }, 0, 0,
VE, .unit =
"level" },
72 {
"6.3",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_63 }, 0, 0,
VE, .unit =
"level" },
73 {
"7",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_7 }, 0, 0,
VE, .unit =
"level" },
74 {
"7.0",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_7 }, 0, 0,
VE, .unit =
"level" },
75 {
"7.1",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_71 }, 0, 0,
VE, .unit =
"level" },
76 {
"7.2",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_72 }, 0, 0,
VE, .unit =
"level" },
77 {
"7.3",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AV1_73 }, 0, 0,
VE, .unit =
"level" },
78 {
"tier",
"Set the encoding tier",
OFFSET(
tier),
AV_OPT_TYPE_INT, { .i64 = NV_ENC_TIER_AV1_0 }, NV_ENC_TIER_AV1_0, NV_ENC_TIER_AV1_1,
VE, .unit =
"tier"},
81 {
"rc",
"Override the preset rate-control",
OFFSET(rc),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX,
VE, .unit =
"rc" },
82 {
"constqp",
"Constant QP mode", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CONSTQP }, 0, 0,
VE, .unit =
"rc" },
83 {
"vbr",
"Variable bitrate mode", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR }, 0, 0,
VE, .unit =
"rc" },
84 {
"cbr",
"Constant bitrate mode", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CBR }, 0, 0,
VE, .unit =
"rc" },
85 {
"multipass",
"Set the multipass encoding",
OFFSET(multipass),
AV_OPT_TYPE_INT, { .i64 = NV_ENC_MULTI_PASS_DISABLED }, NV_ENC_MULTI_PASS_DISABLED, NV_ENC_TWO_PASS_FULL_RESOLUTION,
VE, .unit =
"multipass" },
86 {
"disabled",
"Single Pass", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_MULTI_PASS_DISABLED }, 0, 0,
VE, .unit =
"multipass" },
87 {
"qres",
"Two Pass encoding is enabled where first Pass is quarter resolution",
88 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TWO_PASS_QUARTER_RESOLUTION }, 0, 0,
VE, .unit =
"multipass" },
89 {
"fullres",
"Two Pass encoding is enabled where first Pass is full resolution",
90 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TWO_PASS_FULL_RESOLUTION }, 0, 0,
VE, .unit =
"multipass" },
91 {
"highbitdepth",
"Enable 10 bit encode for 8 bit input",
OFFSET(highbitdepth),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
VE },
95 {
"gpu",
"Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.",
99 {
"rgb_mode",
"Configure how nvenc handles packed RGB input.",
103 {
"disabled",
"Disables support, throws an error.", 0,
AV_OPT_TYPE_CONST, { .i64 =
NVENC_RGB_MODE_DISABLED }, 0, 0,
VE, .unit =
"rgb_mode" },
104 {
"delay",
"Delay frame output by the given amount of frames",
106 {
"rc-lookahead",
"Number of frames to look ahead for rate-control",
108 {
"cq",
"Set target quality level (0 to 63, 0 means automatic) for constant quality mode in VBR rate control",
110 {
"init_qpP",
"Initial QP value for P frame",
OFFSET(init_qp_p),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255,
VE },
111 {
"init_qpB",
"Initial QP value for B frame",
OFFSET(init_qp_b),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255,
VE },
112 {
"init_qpI",
"Initial QP value for I frame",
OFFSET(init_qp_i),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255,
VE },
113 {
"qp",
"Constant quantization parameter rate control method",
115 {
"qp_cb_offset",
"Quantization parameter offset for cb channel",
117 {
"qp_cr_offset",
"Quantization parameter offset for cr channel",
119 {
"no-scenecut",
"When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts",
121 {
"forced-idr",
"If forcing keyframes, force them as IDR frames.",
123 {
"b_adapt",
"When lookahead is enabled, set this to 0 to disable adaptive B-frame decision",
127 {
"zerolatency",
"Set 1 to indicate zero latency operation (no reordering delay)",
129 {
"nonref_p",
"Set this to 1 to enable automatic insertion of non-reference P-frames",
131 {
"strict_gop",
"Set 1 to minimize GOP-to-GOP rate fluctuations",
133 {
"aq-strength",
"When Spatial AQ is enabled, this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive)",
136 {
"b_ref_mode",
"Use B frames as references",
OFFSET(b_ref_mode),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, NV_ENC_BFRAME_REF_MODE_MIDDLE,
VE, .unit =
"b_ref_mode" },
137 {
"disabled",
"B frames will not be used for reference", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, 0, 0,
VE, .unit =
"b_ref_mode" },
138 {
"each",
"Each B frame will be used for reference", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_EACH }, 0, 0,
VE, .unit =
"b_ref_mode" },
139 {
"middle",
"Only (number of B frames)/2 will be used for reference", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_MIDDLE }, 0, 0,
VE, .unit =
"b_ref_mode" },
140 {
"dpb_size",
"Specifies the DPB size used for encoding (0 means automatic)",
142 {
"ldkfs",
"Low delay key frame scale; Specifies the Scene Change frame size increase allowed in case of single frame VBV and CBR",
144 {
"intra-refresh",
"Use Periodic Intra Refresh instead of IDR frames",
146 {
"timing-info",
"Include timing info in sequence/frame headers",
148 {
"extra_sei",
"Pass on extra SEI data (e.g. a53 cc) to be included in the bitstream",
152 #ifdef NVENC_HAVE_LOOKAHEAD_LEVEL
153 {
"lookahead_level",
"Specifies the lookahead level. Higher level may improve quality at the expense of performance.",
154 OFFSET(lookahead_level),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, NV_ENC_LOOKAHEAD_LEVEL_AUTOSELECT,
VE, .unit =
"lookahead_level" },
155 {
"auto",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_AUTOSELECT }, 0, 0,
VE, .unit =
"lookahead_level" },
156 {
"0",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_0 }, 0, 0,
VE, .unit =
"lookahead_level" },
157 {
"1",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_1 }, 0, 0,
VE, .unit =
"lookahead_level" },
158 {
"2",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_2 }, 0, 0,
VE, .unit =
"lookahead_level" },
159 {
"3",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_3 }, 0, 0,
VE, .unit =
"lookahead_level" },
161 #ifdef NVENC_HAVE_SPLIT_FRAME_ENCODING
162 {
"split_encode_mode",
"Specifies the split encoding mode",
OFFSET(split_encode_mode),
AV_OPT_TYPE_INT, { .i64 = NV_ENC_SPLIT_AUTO_MODE }, 0, NV_ENC_SPLIT_DISABLE_MODE,
VE, .unit =
"split_encode_mode" },
163 {
"disabled",
"Disabled for all configurations", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_DISABLE_MODE }, 0, 0,
VE, .unit =
"split_encode_mode" },
164 {
"auto",
"Enabled or disabled depending on the preset and tuning info", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_AUTO_MODE }, 0, 0,
VE, .unit =
"split_encode_mode" },
165 {
"forced",
"Enabled with number of horizontal strips selected by the driver", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_AUTO_FORCED_MODE }, 0, 0,
VE, .unit =
"split_encode_mode" },
166 {
"2",
"Enabled with number of horizontal strips forced to 2 when number of NVENCs > 1", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_TWO_FORCED_MODE }, 0, 0,
VE, .unit =
"split_encode_mode" },
167 {
"3",
"Enabled with number of horizontal strips forced to 3 when number of NVENCs > 2", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_THREE_FORCED_MODE }, 0, 0,
VE, .unit =
"split_encode_mode" },
193 .
p.
name =
"av1_nvenc",
211 .p.wrapper_name =
"nvenc",