diff options
author | Hamdi Ozbayburtlu <hamdio> | 2022-06-16 17:01:57 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2022-06-16 17:03:37 +0300 |
commit | e6eefdd4020e3a9968c48b55967e4bf512b322ef (patch) | |
tree | 38f999dfd0a7238351f04a52f6169044e0d4e5c7 /source | |
parent | dce03ecd5c85d8e8e23969ab1dc8bf800cea550e (diff) |
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
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 16 |
1 files changed, 16 insertions, 0 deletions
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"); |