Fix T86076: MPEG Settings Ignored at Render

Add a RNA update function for output video codec setting to update
properties that are incompatible with defaults.

Previously video output bitrate settings were omitted because of the
Constant Rate Factor (CRF) default. CRF setting for video codec is only
available for H264, MPEG4 and WEBM/VP9 outputs, so for the others
changing encoder quality mode to constant bitrate (CBR) as CRF is not
supported.

Reviewed By: ISS, mano-wii

Differential Revision: https://developer.blender.org/D15201
This commit is contained in:
Hamdi Ozbayburtlu 2022-06-16 16:01:57 +02:00 committed by Richard Antalik
parent dce03ecd5c
commit e6eefdd402
Notes: blender-bot 2023-02-14 05:28:01 +01:00
Referenced by commit 8b9469ec36, Cleanup: Fix build for make lite and add . to code comments
Referenced by issue #86076, VSE - MPEG Settings Ignored at Render
1 changed files with 16 additions and 0 deletions

View File

@ -2712,6 +2712,21 @@ static char *rna_FFmpegSettings_path(const PointerRNA *UNUSED(ptr))
return BLI_strdup("render.ffmpeg");
}
/* FFMpeg Codec setting update hook */
static void rna_FFmpegSettings_codec_update(Main *UNUSED(bmain),
Scene *UNUSED(scene),
PointerRNA *ptr)
{
FFMpegCodecData *codec_data = (FFMpegCodecData *)ptr->data;
if (!ELEM(codec_data->codec, AV_CODEC_ID_H264, AV_CODEC_ID_MPEG4, AV_CODEC_ID_VP9)) {
/* Constant Rate Factor (CRF) setting is only available for H264,
* MPEG4 and WEBM/VP9 codecs. So changing encoder quality mode to
* CBR as CRF is not supported
*/
codec_data->constant_rate_factor = FFM_CRF_NONE;
}
}
#else
/* Grease Pencil Interpolation tool settings */
@ -5922,6 +5937,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
RNA_def_property_enum_items(prop, ffmpeg_codec_items);
RNA_def_property_enum_default(prop, AV_CODEC_ID_H264);
RNA_def_property_ui_text(prop, "Video Codec", "FFmpeg codec to use for video output");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_update");
prop = RNA_def_property(srna, "video_bitrate", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "video_bitrate");