diff --git a/plugins/obs-x264/obs-x264.c b/plugins/obs-x264/obs-x264.c index aaab60089..02333bd28 100644 --- a/plugins/obs-x264/obs-x264.c +++ b/plugins/obs-x264/obs-x264.c @@ -346,11 +346,20 @@ static inline int get_x264_cs_val(enum video_colorspace cs, return 0; } +static void obs_x264_video_info(void *data, struct video_scale_info *info); + static void update_params(struct obs_x264 *obsx264, obs_data_t *settings, char **params) { video_t *video = obs_encoder_video(obsx264->encoder); const struct video_output_info *voi = video_output_get_info(video); + struct video_scale_info info; + + info.format = voi->format; + info.colorspace = voi->colorspace; + info.range = voi->range; + + obs_x264_video_info(obsx264, &info); int bitrate = (int)obs_data_get_int(settings, "bitrate"); int buffer_size = (int)obs_data_get_int(settings, "buffer_size"); @@ -381,13 +390,13 @@ static void update_params(struct obs_x264 *obsx264, obs_data_t *settings, obsx264->params.i_log_level = X264_LOG_WARNING; obsx264->params.vui.i_transfer = - get_x264_cs_val(voi->colorspace, x264_transfer_names); + get_x264_cs_val(info.colorspace, x264_transfer_names); obsx264->params.vui.i_colmatrix = - get_x264_cs_val(voi->colorspace, x264_colmatrix_names); + get_x264_cs_val(info.colorspace, x264_colmatrix_names); obsx264->params.vui.i_colorprim = - get_x264_cs_val(voi->colorspace, x264_colorprim_names); + get_x264_cs_val(info.colorspace, x264_colorprim_names); obsx264->params.vui.b_fullrange = - voi->range == VIDEO_RANGE_FULL; + info.range == VIDEO_RANGE_FULL; /* use the new filler method for CBR to allow real-time adjusting of * the bitrate */ @@ -405,11 +414,11 @@ static void update_params(struct obs_x264 *obsx264, obs_data_t *settings, obsx264->params.rc.f_rf_constant = (float)crf; } - if (voi->format == VIDEO_FORMAT_NV12) + if (info.format == VIDEO_FORMAT_NV12) obsx264->params.i_csp = X264_CSP_NV12; - else if (voi->format == VIDEO_FORMAT_I420) + else if (info.format == VIDEO_FORMAT_I420) obsx264->params.i_csp = X264_CSP_I420; - else if (voi->format == VIDEO_FORMAT_I444) + else if (info.format == VIDEO_FORMAT_I444) obsx264->params.i_csp = X264_CSP_I444; else obsx264->params.i_csp = X264_CSP_NV12;