mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-28 18:41:14 +00:00
encoders/handlers/nvenc: Improve UI/UX for NVENC
* "Quality" Minimum/Maximum is actually QP Minimum/Maximum * Bitrate Limits is now just Limits * Buffer Size and Quality Target have been moved into "Limits".
This commit is contained in:
parent
9a969a0b61
commit
c9e8b889b0
7 changed files with 142 additions and 112 deletions
|
@ -442,20 +442,18 @@ FFmpegEncoder.NVENC.RateControl.AdaptiveI="Adaptive I-Frames"
|
|||
FFmpegEncoder.NVENC.RateControl.AdaptiveI.Description="Enables adaptive I-Frame insertion.\nOnly has an effect when look ahead is set to a value other than 0."
|
||||
FFmpegEncoder.NVENC.RateControl.AdaptiveB="Adaptive B-Frames"
|
||||
FFmpegEncoder.NVENC.RateControl.AdaptiveB.Description="Enables adaptive B-Frame insertion.\nOnly has an effect when look ahead is set to a value other than 0."
|
||||
FFmpegEncoder.NVENC.RateControl.BufferSize="Buffer Size"
|
||||
FFmpegEncoder.NVENC.RateControl.BufferSize.Description="Specifies the buffer size used for bitrate constrained modes.\nIdeally set to (KeyFrame Interval In Seconds * Bitrate Target), so at 2 seconds and 6000 kbit it should be 12000."
|
||||
FFmpegEncoder.NVENC.RateControl.Bitrate="Bitrate Limits"
|
||||
FFmpegEncoder.NVENC.RateControl.Bitrate.Target="Target Bitrate"
|
||||
FFmpegEncoder.NVENC.RateControl.Bitrate.Minimum="Minimum Bitrate"
|
||||
FFmpegEncoder.NVENC.RateControl.Bitrate.Maximum="Maximum Bitrate"
|
||||
FFmpegEncoder.NVENC.RateControl.Quality="Quality Limits"
|
||||
FFmpegEncoder.NVENC.RateControl.Quality.Target="Target Quality"
|
||||
FFmpegEncoder.NVENC.RateControl.Quality.Target.Description="Target quality to achieve, with values closer to 0 being better quality.\nSet to 0 to disable the target quality restriction."
|
||||
FFmpegEncoder.NVENC.RateControl.Quality.Minimum="Minimum Quality"
|
||||
FFmpegEncoder.NVENC.RateControl.Quality.Minimum.Description="Minimum quality to achieve, with values closer to 0 being better quality.\nSet to -1 to disable the maximum restriction."
|
||||
FFmpegEncoder.NVENC.RateControl.Quality.Maximum="Maximum Quality"
|
||||
FFmpegEncoder.NVENC.RateControl.Quality.Maximum.Description="Maximum quality to achieve, with values closer to 0 being better quality.\nSet to -1 to disable the maximum restriction."
|
||||
FFmpegEncoder.NVENC.RateControl.Limits="Limits"
|
||||
FFmpegEncoder.NVENC.RateControl.Limits.BufferSize="Buffer Size"
|
||||
FFmpegEncoder.NVENC.RateControl.Limits.BufferSize.Description="Specifies the buffer size used for bitrate constrained modes.\nIdeally set to (KeyFrame Interval In Seconds * Bitrate Target), so at 2 seconds and 6000 kbit it should be 12000."
|
||||
FFmpegEncoder.NVENC.RateControl.Limits.Quality="Target Quality"
|
||||
FFmpegEncoder.NVENC.RateControl.Limits.Quality.Description="Target quality to achieve, with values closer to 0 being better quality.\nSet to 0 to disable the target quality restriction."
|
||||
FFmpegEncoder.NVENC.RateControl.Limits.Bitrate.Target="Target Bitrate"
|
||||
FFmpegEncoder.NVENC.RateControl.Limits.Bitrate.Maximum="Maximum Bitrate"
|
||||
FFmpegEncoder.NVENC.RateControl.QP="Quantization Parameters"
|
||||
FFmpegEncoder.NVENC.RateControl.QP.Minimum="Minimum QP"
|
||||
FFmpegEncoder.NVENC.RateControl.QP.Minimum.Description="Minimum QP to achieve, with values closer to 0 being better quality.\nSet to -1 to disable the maximum restriction."
|
||||
FFmpegEncoder.NVENC.RateControl.QP.Maximum="Maximum QP"
|
||||
FFmpegEncoder.NVENC.RateControl.QP.Maximum.Description="Maximum QP to achieve, with values closer to 0 being better quality.\nSet to -1 to disable the maximum restriction."
|
||||
FFmpegEncoder.NVENC.RateControl.QP.I="I-Frame QP"
|
||||
FFmpegEncoder.NVENC.RateControl.QP.I.Description="Quantization parameter for I-Frames.\nSmaller values mean better quality in exchange for higher bitrate, while higher values mean less bitrate in exchange for less quality."
|
||||
FFmpegEncoder.NVENC.RateControl.QP.P="P-Frame QP"
|
||||
|
|
|
@ -188,3 +188,9 @@ void nvenc_h264_handler::get_runtime_properties(obs_properties_t* props, const A
|
|||
{
|
||||
nvenc::get_runtime_properties(props, codec, context);
|
||||
}
|
||||
|
||||
void streamfx::encoder::ffmpeg::handler::nvenc_h264_handler::migrate(obs_data_t* settings, std::uint64_t version,
|
||||
const AVCodec* codec, AVCodecContext* context)
|
||||
{
|
||||
nvenc::migrate(settings, version, codec, context);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,9 @@ namespace streamfx::encoder::ffmpeg::handler {
|
|||
virtual void get_properties(obs_properties_t* props, const AVCodec* codec, AVCodecContext* context,
|
||||
bool hw_encode);
|
||||
|
||||
virtual void migrate(obs_data_t* settings, std::uint64_t version, const AVCodec* codec,
|
||||
AVCodecContext* context);
|
||||
|
||||
virtual void update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context);
|
||||
|
||||
virtual void override_update(ffmpeg_instance* instance, obs_data_t* settings);
|
||||
|
|
|
@ -211,3 +211,9 @@ void nvenc_hevc_handler::get_runtime_properties(obs_properties_t* props, const A
|
|||
{
|
||||
nvenc::get_runtime_properties(props, codec, context);
|
||||
}
|
||||
|
||||
void streamfx::encoder::ffmpeg::handler::nvenc_hevc_handler::migrate(obs_data_t* settings, std::uint64_t version,
|
||||
const AVCodec* codec, AVCodecContext* context)
|
||||
{
|
||||
nvenc::migrate(settings, version, codec, context);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,9 @@ namespace streamfx::encoder::ffmpeg::handler {
|
|||
virtual void get_properties(obs_properties_t* props, const AVCodec* codec, AVCodecContext* context,
|
||||
bool hw_encode);
|
||||
|
||||
virtual void migrate(obs_data_t* settings, std::uint64_t version, const AVCodec* codec,
|
||||
AVCodecContext* context);
|
||||
|
||||
virtual void update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context);
|
||||
|
||||
virtual void override_update(ffmpeg_instance* instance, obs_data_t* settings);
|
||||
|
|
|
@ -45,16 +45,15 @@ extern "C" {
|
|||
#define ST_RATECONTROL_LOOKAHEAD ST_RATECONTROL ".LookAhead"
|
||||
#define ST_RATECONTROL_ADAPTIVEI ST_RATECONTROL ".AdaptiveI"
|
||||
#define ST_RATECONTROL_ADAPTIVEB ST_RATECONTROL ".AdaptiveB"
|
||||
#define ST_RATECONTROL_BITRATE ST_RATECONTROL ".Bitrate"
|
||||
#define ST_RATECONTROL_BITRATE_TARGET ST_RATECONTROL_BITRATE ".Target"
|
||||
#define ST_RATECONTROL_BITRATE_MINIMUM ST_RATECONTROL_BITRATE ".Minimum"
|
||||
#define ST_RATECONTROL_BITRATE_MAXIMUM ST_RATECONTROL_BITRATE ".Maximum"
|
||||
#define ST_RATECONTROL_BUFFERSIZE ST_RATECONTROL ".BufferSize"
|
||||
#define ST_RATECONTROL_QUALITY ST_RATECONTROL ".Quality"
|
||||
#define ST_RATECONTROL_QUALITY_MINIMUM ST_RATECONTROL_QUALITY ".Minimum"
|
||||
#define ST_RATECONTROL_QUALITY_MAXIMUM ST_RATECONTROL_QUALITY ".Maximum"
|
||||
#define ST_RATECONTROL_QUALITY_TARGET ST_RATECONTROL_QUALITY ".Target"
|
||||
#define ST_RATECONTROL_LIMITS ST_RATECONTROL ".Limits"
|
||||
#define ST_RATECONTROL_LIMITS_BUFFERSIZE ST_RATECONTROL_LIMITS ".BufferSize"
|
||||
#define ST_RATECONTROL_LIMITS_QUALITY ST_RATECONTROL_LIMITS ".Quality"
|
||||
#define ST_RATECONTROL_LIMITS_BITRATE ST_RATECONTROL_LIMITS ".Bitrate"
|
||||
#define ST_RATECONTROL_LIMITS_BITRATE_TARGET ST_RATECONTROL_LIMITS_BITRATE ".Target"
|
||||
#define ST_RATECONTROL_LIMITS_BITRATE_MAXIMUM ST_RATECONTROL_LIMITS_BITRATE ".Maximum"
|
||||
#define ST_RATECONTROL_QP ST_RATECONTROL ".QP"
|
||||
#define ST_RATECONTROL_QP_MINIMUM ST_RATECONTROL_QP ".Minimum"
|
||||
#define ST_RATECONTROL_QP_MAXIMUM ST_RATECONTROL_QP ".Maximum"
|
||||
#define ST_RATECONTROL_QP_I ST_RATECONTROL_QP ".I"
|
||||
#define ST_RATECONTROL_QP_P ST_RATECONTROL_QP ".P"
|
||||
#define ST_RATECONTROL_QP_B ST_RATECONTROL_QP ".B"
|
||||
|
@ -77,12 +76,12 @@ extern "C" {
|
|||
#define KEY_RATECONTROL_LOOKAHEAD "RateControl.LookAhead"
|
||||
#define KEY_RATECONTROL_ADAPTIVEI "RateControl.AdaptiveI"
|
||||
#define KEY_RATECONTROL_ADAPTIVEB "RateControl.AdaptiveB"
|
||||
#define KEY_RATECONTROL_BITRATE_TARGET "RateControl.Bitrate.Target"
|
||||
#define KEY_RATECONTROL_BITRATE_MAXIMUM "RateControl.Bitrate.Maximum"
|
||||
#define KEY_RATECONTROL_BUFFERSIZE "RateControl.BufferSize"
|
||||
#define KEY_RATECONTROL_QUALITY_TARGET "RateControl.Quality.Target"
|
||||
#define KEY_RATECONTROL_QUALITY_MINIMUM "RateControl.Quality.Minimum"
|
||||
#define KEY_RATECONTROL_QUALITY_MAXIMUM "RateControl.Quality.Maximum"
|
||||
#define KEY_RATECONTROL_LIMITS_BUFFERSIZE "RateControl.Limits.BufferSize"
|
||||
#define KEY_RATECONTROL_LIMITS_QUALITY "RateControl.Limits.Quality"
|
||||
#define KEY_RATECONTROL_LIMITS_BITRATE_TARGET "RateControl.Limits.Bitrate.Target"
|
||||
#define KEY_RATECONTROL_LIMITS_BITRATE_MAXIMUM "RateControl.Limits.Bitrate.Maximum"
|
||||
#define KEY_RATECONTROL_QP_MINIMUM "RateControl.Quality.Minimum"
|
||||
#define KEY_RATECONTROL_QP_MAXIMUM "RateControl.Quality.Maximum"
|
||||
#define KEY_RATECONTROL_QP_I "RateControl.QP.I"
|
||||
#define KEY_RATECONTROL_QP_P "RateControl.QP.P"
|
||||
#define KEY_RATECONTROL_QP_B "RateControl.QP.B"
|
||||
|
@ -197,17 +196,16 @@ void nvenc::get_defaults(obs_data_t* settings, const AVCodec*, AVCodecContext*)
|
|||
obs_data_set_default_int(settings, KEY_RATECONTROL_ADAPTIVEI, -1);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_ADAPTIVEB, -1);
|
||||
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_BITRATE_TARGET, 6000);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_BITRATE_MAXIMUM, 0);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_BUFFERSIZE, 12000);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_LIMITS_BITRATE_TARGET, 6000);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_LIMITS_BITRATE_MAXIMUM, 0);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_LIMITS_BUFFERSIZE, 12000);
|
||||
obs_data_set_default_double(settings, KEY_RATECONTROL_LIMITS_QUALITY, 0);
|
||||
|
||||
obs_data_set_default_double(settings, KEY_RATECONTROL_QUALITY_TARGET, 0);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_QUALITY_MINIMUM, -1);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_QUALITY_MAXIMUM, -1);
|
||||
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_QP_I, 21);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_QP_P, 21);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_QP_B, 21);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_QP_MINIMUM, -1);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_QP_MAXIMUM, -1);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_QP_I, -1);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_QP_P, -1);
|
||||
obs_data_set_default_int(settings, KEY_RATECONTROL_QP_B, -1);
|
||||
|
||||
obs_data_set_default_int(settings, KEY_AQ_SPATIAL, -1);
|
||||
obs_data_set_default_int(settings, KEY_AQ_STRENGTH, -1);
|
||||
|
@ -252,17 +250,15 @@ static bool modified_ratecontrol(obs_properties_t* props, obs_property_t*, obs_d
|
|||
break;
|
||||
}
|
||||
|
||||
obs_property_set_visible(obs_properties_get(props, ST_RATECONTROL_BITRATE), have_bitrate || have_bitrate_range);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_BITRATE_TARGET), have_bitrate);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_BITRATE_MAXIMUM), have_bitrate_range);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_BUFFERSIZE), have_bitrate || have_bitrate_range);
|
||||
obs_property_set_visible(obs_properties_get(props, ST_RATECONTROL_LIMITS), have_bitrate || have_quality);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_LIMITS_BUFFERSIZE), have_bitrate);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_LIMITS_QUALITY), have_quality);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_LIMITS_BITRATE_TARGET), have_bitrate);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_LIMITS_BITRATE_MAXIMUM), have_bitrate_range);
|
||||
|
||||
obs_property_set_visible(obs_properties_get(props, ST_RATECONTROL_QUALITY), have_quality);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_QUALITY_MINIMUM), have_quality);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_QUALITY_MAXIMUM), have_quality);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_QUALITY_TARGET), have_quality);
|
||||
|
||||
obs_property_set_visible(obs_properties_get(props, ST_RATECONTROL_QP), have_qp);
|
||||
obs_property_set_visible(obs_properties_get(props, ST_RATECONTROL_QP), have_qp || have_bitrate_range);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_QP_MINIMUM), have_bitrate_range);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_QP_MAXIMUM), have_bitrate_range);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_QP_I), have_qp);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_QP_P), have_qp);
|
||||
obs_property_set_visible(obs_properties_get(props, KEY_RATECONTROL_QP_B), have_qp);
|
||||
|
@ -331,63 +327,45 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec)
|
|||
D_TRANSLATE(ST_RATECONTROL_ADAPTIVEB));
|
||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_ADAPTIVEB)));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
obs_properties_t* grp = props;
|
||||
if (!util::are_property_groups_broken()) {
|
||||
grp = obs_properties_create();
|
||||
obs_properties_add_group(props, ST_RATECONTROL_LIMITS, D_TRANSLATE(ST_RATECONTROL_LIMITS), OBS_GROUP_NORMAL,
|
||||
grp);
|
||||
}
|
||||
|
||||
{
|
||||
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_BUFFERSIZE, D_TRANSLATE(ST_RATECONTROL_BUFFERSIZE), 0,
|
||||
auto p = obs_properties_add_float_slider(grp, KEY_RATECONTROL_LIMITS_QUALITY,
|
||||
D_TRANSLATE(ST_RATECONTROL_LIMITS_QUALITY), 0, 100, 0.01);
|
||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_LIMITS_QUALITY)));
|
||||
}
|
||||
|
||||
{
|
||||
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_LIMITS_BITRATE_TARGET,
|
||||
D_TRANSLATE(ST_RATECONTROL_LIMITS_BITRATE_TARGET), -1,
|
||||
std::numeric_limits<std::int32_t>::max(), 1);
|
||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_BUFFERSIZE)));
|
||||
obs_property_int_set_suffix(p, " kbit/s");
|
||||
}
|
||||
|
||||
{
|
||||
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_LIMITS_BITRATE_MAXIMUM,
|
||||
D_TRANSLATE(ST_RATECONTROL_LIMITS_BITRATE_MAXIMUM), -1,
|
||||
std::numeric_limits<std::int32_t>::max(), 1);
|
||||
obs_property_int_set_suffix(p, " kbit/s");
|
||||
}
|
||||
|
||||
{
|
||||
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_LIMITS_BUFFERSIZE,
|
||||
D_TRANSLATE(ST_RATECONTROL_LIMITS_BUFFERSIZE), 0,
|
||||
std::numeric_limits<std::int32_t>::max(), 1);
|
||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_LIMITS_BUFFERSIZE)));
|
||||
obs_property_int_set_suffix(p, " kbit");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
obs_properties_t* grp = props;
|
||||
if (!util::are_property_groups_broken()) {
|
||||
grp = obs_properties_create();
|
||||
obs_properties_add_group(props, ST_RATECONTROL_BITRATE, D_TRANSLATE(ST_RATECONTROL_BITRATE),
|
||||
OBS_GROUP_NORMAL, grp);
|
||||
}
|
||||
|
||||
{
|
||||
auto p =
|
||||
obs_properties_add_int(grp, KEY_RATECONTROL_BITRATE_TARGET, D_TRANSLATE(ST_RATECONTROL_BITRATE_TARGET),
|
||||
-1, std::numeric_limits<std::int32_t>::max(), 1);
|
||||
obs_property_int_set_suffix(p, " kbit/s");
|
||||
}
|
||||
{
|
||||
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_BITRATE_MAXIMUM,
|
||||
D_TRANSLATE(ST_RATECONTROL_BITRATE_MAXIMUM), -1,
|
||||
std::numeric_limits<std::int32_t>::max(), 1);
|
||||
obs_property_int_set_suffix(p, " kbit/s");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
obs_properties_t* grp = props;
|
||||
if (!util::are_property_groups_broken()) {
|
||||
grp = obs_properties_create();
|
||||
obs_properties_add_group(props, ST_RATECONTROL_QUALITY, D_TRANSLATE(ST_RATECONTROL_QUALITY),
|
||||
OBS_GROUP_NORMAL, grp);
|
||||
}
|
||||
|
||||
{
|
||||
auto p = obs_properties_add_float_slider(grp, KEY_RATECONTROL_QUALITY_TARGET,
|
||||
D_TRANSLATE(ST_RATECONTROL_QUALITY_TARGET), 0, 100, 0.01);
|
||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_QUALITY_TARGET)));
|
||||
}
|
||||
|
||||
{
|
||||
auto p = obs_properties_add_int_slider(grp, KEY_RATECONTROL_QUALITY_MINIMUM,
|
||||
D_TRANSLATE(ST_RATECONTROL_QUALITY_MINIMUM), -1, 51, 1);
|
||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_QUALITY_MINIMUM)));
|
||||
}
|
||||
{
|
||||
auto p = obs_properties_add_int_slider(grp, KEY_RATECONTROL_QUALITY_MAXIMUM,
|
||||
D_TRANSLATE(ST_RATECONTROL_QUALITY_MAXIMUM), -1, 51, 1);
|
||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_QUALITY_MAXIMUM)));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
obs_properties_t* grp = props;
|
||||
if (!util::are_property_groups_broken()) {
|
||||
|
@ -395,6 +373,17 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec)
|
|||
obs_properties_add_group(props, ST_RATECONTROL_QP, D_TRANSLATE(ST_RATECONTROL_QP), OBS_GROUP_NORMAL, grp);
|
||||
}
|
||||
|
||||
{
|
||||
auto p = obs_properties_add_int_slider(grp, KEY_RATECONTROL_QP_MINIMUM,
|
||||
D_TRANSLATE(ST_RATECONTROL_QP_MINIMUM), -1, 51, 1);
|
||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_QP_MINIMUM)));
|
||||
}
|
||||
{
|
||||
auto p = obs_properties_add_int_slider(grp, KEY_RATECONTROL_QP_MAXIMUM,
|
||||
D_TRANSLATE(ST_RATECONTROL_QP_MAXIMUM), -1, 51, 1);
|
||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_QP_MAXIMUM)));
|
||||
}
|
||||
|
||||
{
|
||||
auto p =
|
||||
obs_properties_add_int_slider(grp, KEY_RATECONTROL_QP_I, D_TRANSLATE(ST_RATECONTROL_QP_I), -1, 51, 1);
|
||||
|
@ -497,15 +486,14 @@ void nvenc::get_runtime_properties(obs_properties_t* props, const AVCodec*, AVCo
|
|||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_LOOKAHEAD), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_ADAPTIVEI), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_ADAPTIVEB), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_BUFFERSIZE), true);
|
||||
obs_property_set_enabled(obs_properties_get(props, ST_RATECONTROL_BITRATE), true);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_BITRATE_TARGET), true);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_BITRATE_MAXIMUM), true);
|
||||
obs_property_set_enabled(obs_properties_get(props, ST_RATECONTROL_QUALITY), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_QUALITY_MINIMUM), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_QUALITY_MAXIMUM), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_QUALITY_TARGET), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, ST_RATECONTROL_LIMITS), true);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_LIMITS_BUFFERSIZE), true);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_LIMITS_BITRATE_TARGET), true);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_LIMITS_BITRATE_MAXIMUM), true);
|
||||
obs_property_set_enabled(obs_properties_get(props, ST_RATECONTROL_LIMITS_QUALITY), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, ST_RATECONTROL_QP), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_QP_MINIMUM), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_QP_MAXIMUM), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_QP_I), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_QP_P), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, KEY_RATECONTROL_QP_B), false);
|
||||
|
@ -601,7 +589,7 @@ void nvenc::update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* c
|
|||
}
|
||||
|
||||
if (have_bitrate) {
|
||||
int64_t v = obs_data_get_int(settings, KEY_RATECONTROL_BITRATE_TARGET);
|
||||
int64_t v = obs_data_get_int(settings, KEY_RATECONTROL_LIMITS_BITRATE_TARGET);
|
||||
if (v > -1)
|
||||
context->bit_rate = static_cast<int>(v * 1000);
|
||||
|
||||
|
@ -611,7 +599,7 @@ void nvenc::update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* c
|
|||
context->bit_rate = 0;
|
||||
}
|
||||
if (have_bitrate_range) {
|
||||
if (int64_t max = obs_data_get_int(settings, KEY_RATECONTROL_BITRATE_MAXIMUM); max > -1)
|
||||
if (int64_t max = obs_data_get_int(settings, KEY_RATECONTROL_LIMITS_BITRATE_MAXIMUM); max > -1)
|
||||
context->rc_max_rate = static_cast<int>(max * 1000);
|
||||
} else {
|
||||
//context->rc_min_rate = 0;
|
||||
|
@ -620,7 +608,7 @@ void nvenc::update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* c
|
|||
|
||||
// Buffer Size
|
||||
if (have_bitrate || have_bitrate_range) {
|
||||
if (int64_t v = obs_data_get_int(settings, KEY_RATECONTROL_BUFFERSIZE); v > -1)
|
||||
if (int64_t v = obs_data_get_int(settings, KEY_RATECONTROL_LIMITS_BUFFERSIZE); v > -1)
|
||||
context->rc_buffer_size = static_cast<int>(v * 1000);
|
||||
} else {
|
||||
context->rc_buffer_size = 0;
|
||||
|
@ -628,9 +616,9 @@ void nvenc::update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* c
|
|||
|
||||
// Quality Limits
|
||||
if (have_quality) {
|
||||
if (int qmin = static_cast<int>(obs_data_get_int(settings, KEY_RATECONTROL_QUALITY_MINIMUM)); qmin > -1)
|
||||
if (int qmin = static_cast<int>(obs_data_get_int(settings, KEY_RATECONTROL_QP_MINIMUM)); qmin > -1)
|
||||
context->qmin = qmin;
|
||||
if (int qmax = static_cast<int>(obs_data_get_int(settings, KEY_RATECONTROL_QUALITY_MAXIMUM)); qmax > -1)
|
||||
if (int qmax = static_cast<int>(obs_data_get_int(settings, KEY_RATECONTROL_QP_MAXIMUM)); qmax > -1)
|
||||
context->qmax = qmax;
|
||||
} else {
|
||||
context->qmin = -1;
|
||||
|
@ -638,7 +626,7 @@ void nvenc::update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* c
|
|||
}
|
||||
|
||||
// Quality Target
|
||||
if (double_t v = obs_data_get_double(settings, KEY_RATECONTROL_QUALITY_TARGET) / 100.0 * 51.0; v > 0) {
|
||||
if (double_t v = obs_data_get_double(settings, KEY_RATECONTROL_LIMITS_QUALITY) / 100.0 * 51.0; v > 0) {
|
||||
av_opt_set_double(context->priv_data, "cq", v, AV_OPT_SEARCH_CHILDREN);
|
||||
}
|
||||
|
||||
|
@ -777,3 +765,27 @@ void nvenc::log_options(obs_data_t*, const AVCodec* codec, AVCodecContext* conte
|
|||
tools::print_av_option_bool(context, "a53cc", " A53 Closed Captions");
|
||||
tools::print_av_option_int(context, "dpb_size", " DPB Size", "Frames");
|
||||
}
|
||||
|
||||
void streamfx::encoder::ffmpeg::handler::nvenc::migrate(obs_data_t* settings, uint64_t version, const AVCodec* codec,
|
||||
AVCodecContext* context)
|
||||
{
|
||||
switch (static_cast<uint64_t>(obs_data_get_int(settings, S_VERSION)) & STREAMFX_MASK_UPDATE) {
|
||||
default:
|
||||
case STREAMFX_MAKE_VERSION(0, 8, 0, 0):
|
||||
|
||||
obs_data_set_int(settings, KEY_RATECONTROL_LIMITS_BITRATE_TARGET,
|
||||
obs_data_get_int(settings, "RateControl.Bitrate.Target"));
|
||||
obs_data_set_int(settings, KEY_RATECONTROL_LIMITS_BITRATE_MAXIMUM,
|
||||
obs_data_get_int(settings, "RateControl.Bitrate.Maximum"));
|
||||
obs_data_set_int(settings, KEY_RATECONTROL_LIMITS_BUFFERSIZE,
|
||||
obs_data_get_int(settings, "RateControl.BufferSize"));
|
||||
obs_data_set_double(settings, KEY_RATECONTROL_LIMITS_QUALITY,
|
||||
obs_data_get_double(settings, "RateControl.Quality.Target"));
|
||||
obs_data_set_int(settings, KEY_RATECONTROL_QP_MINIMUM,
|
||||
obs_data_get_int(settings, "RateControl.Quality.Minimum"));
|
||||
obs_data_set_int(settings, KEY_RATECONTROL_QP_MAXIMUM,
|
||||
obs_data_get_int(settings, "RateControl.Quality.Maximum"));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,6 +101,8 @@ namespace streamfx::encoder::ffmpeg::handler::nvenc {
|
|||
|
||||
void get_runtime_properties(obs_properties_t* props, const AVCodec* codec, AVCodecContext* context);
|
||||
|
||||
void migrate(obs_data_t* settings, uint64_t version, const AVCodec* codec, AVCodecContext* context);
|
||||
|
||||
void update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context);
|
||||
|
||||
void log_options(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context);
|
||||
|
|
Loading…
Reference in a new issue