obs-ffmpeg: Allow video headers repetition in IDR and bitstream for jim-nvenc

This commit adds a repeat_headers setting which will allow sps/pps
repetition and AUDs(access unit delimiters) .
Repetition is ensured by h264config->repeatSPSPPS &
h264config->disableSPSPPS;
the two parameters are set by nvenc to true on default.
When video headers repetition is required, we set the second in
jim-nvenc to false so that SPS/PPS are written into bitstream.
The first parameter could be omitted but is exposed since repetition of
video headers might not be required.
When headers repetition is enabled, we also enable AUD to facilitate
decoding.
Typically the video headers repetition will be useful for mpegts and
DVB broadcast decoders.
master
pkv 2020-04-16 21:21:07 +02:00
parent 915379a99d
commit 73ac96ac7c
2 changed files with 12 additions and 0 deletions

View File

@ -426,6 +426,14 @@ static bool init_encoder(struct nvenc_data *enc, obs_data_t *settings)
config->gopLength = gop_size;
config->frameIntervalP = 1 + bf;
h264_config->idrPeriod = gop_size;
bool repeat_headers = obs_data_get_bool(settings, "repeat_headers");
if (repeat_headers) {
h264_config->repeatSPSPPS = 1;
h264_config->disableSPSPPS = 0;
h264_config->outputAUD = 1;
}
vui_params->videoSignalTypePresentFlag = 1;
vui_params->videoFullRangeFlag = (voi->range == VIDEO_RANGE_FULL);
vui_params->colourDescriptionPresentFlag = 1;

View File

@ -477,6 +477,7 @@ void nvenc_defaults(obs_data_t *settings)
obs_data_set_default_bool(settings, "psycho_aq", true);
obs_data_set_default_int(settings, "gpu", 0);
obs_data_set_default_int(settings, "bf", 2);
obs_data_set_default_bool(settings, "repeat_headers", false);
}
static bool rate_control_modified(obs_properties_t *ppts, obs_property_t *p,
@ -576,6 +577,9 @@ obs_properties_t *nvenc_properties_internal(bool ffmpeg)
obs_module_text("NVENC.PsychoVisualTuning"));
obs_property_set_long_description(
p, obs_module_text("NVENC.PsychoVisualTuning.ToolTip"));
p = obs_properties_add_bool(props, "repeat_headers",
"repeat_headers");
obs_property_set_visible(p, false);
}
obs_properties_add_int(props, "gpu", obs_module_text("GPU"), 0, 8, 1);