[Bf-blender-cvs] [e6eefdd4020] master: Fix T86076: MPEG Settings Ignored at Render

Hamdi Ozbayburtlu noreply at git.blender.org
Thu Jun 16 16:08:39 CEST 2022


Commit: e6eefdd4020e3a9968c48b55967e4bf512b322ef
Author: Hamdi Ozbayburtlu
Date:   Thu Jun 16 16:01:57 2022 +0200
Branches: master
https://developer.blender.org/rBe6eefdd4020e3a9968c48b55967e4bf512b322ef

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

===================================================================

M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 3b739561f9a..28fc2483ad3 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -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");



More information about the Bf-blender-cvs mailing list