|
@@ -885,8 +885,23 @@ static bool set_config(struct ffmpeg_output *stream)
|
|
|
config.format_mime_type = "video/M2PT";
|
|
|
|
|
|
/* 2. video settings */
|
|
|
- // 2.a) set video format from obs to FFmpeg
|
|
|
- video_t *video = obs_output_video(stream->output);
|
|
|
+
|
|
|
+ // 2.a) set width & height
|
|
|
+ config.width = (int)obs_output_get_width(stream->output);
|
|
|
+ config.height = (int)obs_output_get_height(stream->output);
|
|
|
+ config.scale_width = config.width;
|
|
|
+ config.scale_height = config.height;
|
|
|
+
|
|
|
+ // 2.b) set video codec & ID from video encoder
|
|
|
+ obs_encoder_t *vencoder = obs_output_get_video_encoder(stream->output);
|
|
|
+ config.video_encoder = obs_encoder_get_codec(vencoder);
|
|
|
+ if (strcmp(config.video_encoder, "h264") == 0)
|
|
|
+ config.video_encoder_id = AV_CODEC_ID_H264;
|
|
|
+ else
|
|
|
+ config.video_encoder_id = AV_CODEC_ID_AV1;
|
|
|
+
|
|
|
+ // 2.c) set video format from OBS to FFmpeg
|
|
|
+ video_t *video = obs_encoder_video(vencoder);
|
|
|
config.format =
|
|
|
obs_to_ffmpeg_video_format(video_output_get_format(video));
|
|
|
|
|
@@ -896,7 +911,7 @@ static bool set_config(struct ffmpeg_output *stream)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // 2.b) set colorspace, color_range & transfer characteristic (from voi)
|
|
|
+ // 2.d) set colorspace, color_range & transfer characteristic (from voi)
|
|
|
const struct video_output_info *voi = video_output_get_info(video);
|
|
|
config.color_range = voi->range == VIDEO_RANGE_FULL ? AVCOL_RANGE_JPEG
|
|
|
: AVCOL_RANGE_MPEG;
|
|
@@ -929,21 +944,6 @@ static bool set_config(struct ffmpeg_output *stream)
|
|
|
config.color_trc = AVCOL_TRC_ARIB_STD_B67;
|
|
|
config.colorspace = AVCOL_SPC_BT2020_NCL;
|
|
|
}
|
|
|
-
|
|
|
- // 2.c) set width & height
|
|
|
- config.width = (int)obs_output_get_width(stream->output);
|
|
|
- config.height = (int)obs_output_get_height(stream->output);
|
|
|
- config.scale_width = config.width;
|
|
|
- config.scale_height = config.height;
|
|
|
-
|
|
|
- // 2.d) set video codec & id from video encoder
|
|
|
- obs_encoder_t *vencoder = obs_output_get_video_encoder(stream->output);
|
|
|
- config.video_encoder = obs_encoder_get_codec(vencoder);
|
|
|
- if (strcmp(config.video_encoder, "h264") == 0)
|
|
|
- config.video_encoder_id = AV_CODEC_ID_H264;
|
|
|
- else
|
|
|
- config.video_encoder_id = AV_CODEC_ID_AV1;
|
|
|
-
|
|
|
// 2.e) set video bitrate & gop through video encoder settings
|
|
|
obs_data_t *settings = obs_encoder_get_settings(vencoder);
|
|
|
config.video_bitrate = (int)obs_data_get_int(settings, "bitrate");
|