26 #define OFFSET(x) offsetof(NvencContext, x)
27 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
47 {
"level",
"Set the encoding level restriction",
OFFSET(
level),
AV_OPT_TYPE_INT, { .i64 = NV_ENC_LEVEL_AUTOSELECT }, NV_ENC_LEVEL_AUTOSELECT, NV_ENC_LEVEL_H264_51,
VE,
"level" },
48 {
"auto",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AUTOSELECT }, 0, 0,
VE,
"level" },
71 {
"rc",
"Override the preset rate-control",
OFFSET(rc),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX,
VE,
"rc" },
72 {
"constqp",
"Constant QP mode", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CONSTQP }, 0, 0,
VE,
"rc" },
73 {
"vbr",
"Variable bitrate mode", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR }, 0, 0,
VE,
"rc" },
74 {
"cbr",
"Constant bitrate mode", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CBR }, 0, 0,
VE,
"rc" },
75 {
"vbr_minqp",
"Variable bitrate mode with MinQP (deprecated)", 0,
AV_OPT_TYPE_CONST, { .i64 =
RCD(NV_ENC_PARAMS_RC_VBR_MINQP) }, 0, 0,
VE,
"rc" },
76 {
"ll_2pass_quality",
"Multi-pass optimized for image quality (deprecated)",
78 {
"ll_2pass_size",
"Multi-pass optimized for constant frame size (deprecated)",
80 {
"vbr_2pass",
"Multi-pass variable bitrate mode (deprecated)", 0,
AV_OPT_TYPE_CONST, { .i64 =
RCD(NV_ENC_PARAMS_RC_2_PASS_VBR) }, 0, 0,
VE,
"rc" },
81 {
"cbr_ld_hq",
"Constant bitrate low delay high quality mode", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ }, 0, 0,
VE,
"rc" },
82 {
"cbr_hq",
"Constant bitrate high quality mode", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CBR_HQ }, 0, 0,
VE,
"rc" },
83 {
"vbr_hq",
"Variable bitrate high quality mode", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR_HQ }, 0, 0,
VE,
"rc" },
84 {
"rc-lookahead",
"Number of frames to look ahead for rate-control",
89 {
"gpu",
"Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.",
93 {
"delay",
"Delay frame output by the given amount of frames",
95 {
"no-scenecut",
"When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts",
97 {
"forced-idr",
"If forcing keyframes, force them as IDR frames.",
99 {
"b_adapt",
"When lookahead is enabled, set this to 0 to disable adaptive B-frame decision",
103 {
"zerolatency",
"Set 1 to indicate zero latency operation (no reordering delay)",
105 {
"nonref_p",
"Set this to 1 to enable automatic insertion of non-reference P-frames",
107 {
"strict_gop",
"Set 1 to minimize GOP-to-GOP rate fluctuations",
109 {
"aq-strength",
"When Spatial AQ is enabled, this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive)",
111 {
"cq",
"Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control",
114 {
"bluray-compat",
"Bluray compatibility workarounds",
OFFSET(bluray_compat),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
VE },
118 {
"qp",
"Constant quantization parameter rate control method",
120 {
"weighted_pred",
"Set 1 to enable weighted prediction",
124 {
"auto",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_AUTOSELECT }, 0, 0,
VE,
"coder" },
125 {
"cabac",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CABAC }, 0, 0,
VE,
"coder" },
126 {
"cavlc",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC }, 0, 0,
VE,
"coder" },
127 {
"ac",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CABAC }, 0, 0,
VE,
"coder" },
128 {
"vlc",
"", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC }, 0, 0,
VE,
"coder" },
129 #ifdef NVENC_HAVE_BFRAME_REF_MODE
130 {
"b_ref_mode",
"Use B frames as references",
OFFSET(b_ref_mode),
AV_OPT_TYPE_INT, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, NV_ENC_BFRAME_REF_MODE_DISABLED, NV_ENC_BFRAME_REF_MODE_MIDDLE,
VE,
"b_ref_mode" },
131 {
"disabled",
"B frames will not be used for reference", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, 0, 0,
VE,
"b_ref_mode" },
132 {
"each",
"Each B frame will be used for reference", 0,
AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_EACH }, 0, 0,
VE,
"b_ref_mode" },
133 {
"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,
"b_ref_mode" },
135 {
"b_ref_mode",
"(not supported)",
OFFSET(b_ref_mode),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX,
VE,
"b_ref_mode" },
157 #if FF_API_NVENC_OLD_NAME
165 #if CONFIG_NVENC_ENCODER
166 static const AVClass nvenc_class = {
184 .priv_class = &nvenc_class,
189 .wrapper_name =
"nvenc",
194 #if CONFIG_NVENC_H264_ENCODER
195 static const AVClass nvenc_h264_class = {
203 .
name =
"nvenc_h264",
213 .priv_class = &nvenc_h264_class,
218 .wrapper_name =
"nvenc",
232 .
name =
"h264_nvenc",
247 .wrapper_name =
"nvenc",