obs-ffmpeg: Set 1000 nits for HLG metadata

This commit is contained in:
jpark37 2022-05-14 18:40:59 -07:00 committed by Jim
parent c7e83518e1
commit d70c6b9dfb
2 changed files with 8 additions and 6 deletions

View File

@ -163,10 +163,9 @@ static void add_video_encoder_params(struct ffmpeg_muxer *stream,
: AVCOL_RANGE_MPEG;
const int max_luminance =
((trc == AVCOL_TRC_SMPTE2084) ||
(trc == AVCOL_TRC_ARIB_STD_B67))
(trc == AVCOL_TRC_SMPTE2084)
? (int)obs_get_video_hdr_nominal_peak_level()
: 0;
: ((trc == AVCOL_TRC_ARIB_STD_B67) ? 1000 : 0);
dstr_catf(cmd, "%s %d %d %d %d %d %d %d %d %d %d ",
obs_encoder_get_codec(vencoder), bitrate,

View File

@ -223,10 +223,13 @@ static bool create_video_stream(struct ffmpeg_data *data)
data->config.video_encoder))
return false;
if ((data->config.color_trc == AVCOL_TRC_SMPTE2084) ||
(data->config.color_trc == AVCOL_TRC_ARIB_STD_B67)) {
const enum AVColorTransferCharacteristic trc = data->config.color_trc;
const bool pq = trc == AVCOL_TRC_SMPTE2084;
const bool hlg = trc == AVCOL_TRC_ARIB_STD_B67;
if (pq || hlg) {
const int hdr_nominal_peak_level =
(int)obs_get_video_hdr_nominal_peak_level();
pq ? (int)obs_get_video_hdr_nominal_peak_level()
: (hlg ? 1000 : 0);
size_t content_size;
AVContentLightMetadata *const content =