diff options
-rw-r--r-- | build_files/build_environment/cmake/openal.cmake | 1 | ||||
-rw-r--r-- | build_files/build_environment/cmake/openimageio.cmake | 1 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_render.py | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/writeffmpeg.c | 33 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 17 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 31 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 21 |
7 files changed, 71 insertions, 35 deletions
diff --git a/build_files/build_environment/cmake/openal.cmake b/build_files/build_environment/cmake/openal.cmake index d63c4443ca0..3331361bfbc 100644 --- a/build_files/build_environment/cmake/openal.cmake +++ b/build_files/build_environment/cmake/openal.cmake @@ -25,6 +25,7 @@ if(BUILD_MODE STREQUAL Release) -DALSOFT_CONFIG=Off -DALSOFT_HRTF_DEFS=Off -DALSOFT_INSTALL=On + -DALSOFT_BACKEND_SNDIO=Off ) if(UNIX) diff --git a/build_files/build_environment/cmake/openimageio.cmake b/build_files/build_environment/cmake/openimageio.cmake index 07f6b3cdbef..fdc71508e47 100644 --- a/build_files/build_environment/cmake/openimageio.cmake +++ b/build_files/build_environment/cmake/openimageio.cmake @@ -90,6 +90,7 @@ set(OPENIMAGEIO_EXTRA_ARGS -DUSE_PYTHON=OFF -DUSE_PYTHON3=OFF -DUSE_OCIO=OFF + -DUSE_WEBP=${WITH_WEBP} -DOIIO_BUILD_TOOLS=${OIIO_TOOLS} -DOIIO_BUILD_TESTS=OFF -DBUILD_TESTING=OFF diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index 26fb05363ff..15b175617d6 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -490,7 +490,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel): layout.prop(ffmpeg, "use_lossless_output") # Output quality - use_crf = needs_codec and ffmpeg.codec in {'H264', 'MPEG4'} + use_crf = needs_codec and ffmpeg.codec in {'H264', 'MPEG4', 'WEBM'} if use_crf: layout.prop(ffmpeg, "constant_rate_factor") diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 85582ceea4c..0a2527bafd2 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -582,24 +582,33 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int } if (context->ffmpeg_preset) { - char const *preset_name; + /* 'preset' is used by h.264, 'deadline' is used by webm/vp9. I'm not + * setting those properties conditionally based on the video codec, + * as the FFmpeg encoder simply ignores unknown settings anyway. */ + char const *preset_name = NULL; /* used by h.264 */ + char const *deadline_name = NULL; /* used by webm/vp9 */ switch (context->ffmpeg_preset) { - case FFM_PRESET_ULTRAFAST: preset_name = "ultrafast"; break; - case FFM_PRESET_SUPERFAST: preset_name = "superfast"; break; - case FFM_PRESET_VERYFAST: preset_name = "veryfast"; break; - case FFM_PRESET_FASTER: preset_name = "faster"; break; - case FFM_PRESET_FAST: preset_name = "fast"; break; - case FFM_PRESET_MEDIUM: preset_name = "medium"; break; - case FFM_PRESET_SLOW: preset_name = "slow"; break; - case FFM_PRESET_SLOWER: preset_name = "slower"; break; - case FFM_PRESET_VERYSLOW: preset_name = "veryslow"; break; + case FFM_PRESET_GOOD: + preset_name = "medium"; + deadline_name = "good"; + break; + case FFM_PRESET_BEST: + preset_name = "slower"; + deadline_name = "best"; + break; + case FFM_PRESET_REALTIME: + preset_name = "superfast"; + deadline_name = "realtime"; + break; default: printf("Unknown preset number %i, ignoring.\n", context->ffmpeg_preset); - preset_name = NULL; } if (preset_name != NULL) { av_dict_set(&opts, "preset", preset_name, 0); } + if (deadline_name != NULL) { + av_dict_set(&opts, "deadline", deadline_name, 0); + } } #if 0 @@ -1676,7 +1685,7 @@ void BKE_ffmpeg_image_type_verify(RenderData *rd, ImageFormatData *imf) { BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_H264); rd->ffcodecdata.constant_rate_factor = FFM_CRF_MEDIUM; - rd->ffcodecdata.ffmpeg_preset = FFM_PRESET_MEDIUM; + rd->ffcodecdata.ffmpeg_preset = FFM_PRESET_GOOD; rd->ffcodecdata.type = FFMPEG_MKV; } if (rd->ffcodecdata.type == FFMPEG_OGG) { diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index bd4e4c2e35c..7228c3522f0 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1817,6 +1817,23 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } + + for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { + int preset = scene->r.ffcodecdata.ffmpeg_preset; + if (preset == FFM_PRESET_NONE || preset >= FFM_PRESET_GOOD) { + continue; + } + if (preset <= FFM_PRESET_FAST) { + preset = FFM_PRESET_REALTIME; + } + else if (preset >= FFM_PRESET_SLOW) { + preset = FFM_PRESET_BEST; + } + else { + preset = FFM_PRESET_GOOD; + } + scene->r.ffcodecdata.ffmpeg_preset = preset; + } } } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 3575ad976a5..696918d97a5 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -95,17 +95,28 @@ typedef struct AviCodecData { typedef enum eFFMpegPreset { FFM_PRESET_NONE, - FFM_PRESET_ULTRAFAST, - FFM_PRESET_SUPERFAST, - FFM_PRESET_VERYFAST, - FFM_PRESET_FASTER, - FFM_PRESET_FAST, - FFM_PRESET_MEDIUM, - FFM_PRESET_SLOW, - FFM_PRESET_SLOWER, - FFM_PRESET_VERYSLOW, -} eFFMpegPreset; +#ifdef DNA_DEPRECATED + /* Previously used by h.264 to control encoding speed vs. file size. */ + FFM_PRESET_ULTRAFAST, /* DEPRECATED */ + FFM_PRESET_SUPERFAST, /* DEPRECATED */ + FFM_PRESET_VERYFAST, /* DEPRECATED */ + FFM_PRESET_FASTER, /* DEPRECATED */ + FFM_PRESET_FAST, /* DEPRECATED */ + FFM_PRESET_MEDIUM, /* DEPRECATED */ + FFM_PRESET_SLOW, /* DEPRECATED */ + FFM_PRESET_SLOWER, /* DEPRECATED */ + FFM_PRESET_VERYSLOW, /* DEPRECATED */ +#endif + + /* Used by WEBM/VP9 and h.264 to control encoding speed vs. file size. + * WEBM/VP9 use these values directly, whereas h.264 map those to + * respectively the MEDIUM, SLOWER, and SUPERFAST presets. + */ + FFM_PRESET_GOOD = 10, /* the default and recommended for most applications */ + FFM_PRESET_BEST, /* recommended if you have lots of time and want the best compression efficiency */ + FFM_PRESET_REALTIME, /* recommended for live / fast encoding */ +} eFFMpegPreset; /* Mapping from easily-understandable descriptions to CRF values. * Assumes we output 8-bit video. Needs to be remapped if 10-bit diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index f888d198e24..568980d6976 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -5221,8 +5221,6 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {FFMPEG_AVI, "AVI", 0, "AVI", ""}, {FFMPEG_MOV, "QUICKTIME", 0, "Quicktime", ""}, {FFMPEG_DV, "DV", 0, "DV", ""}, -// {FFMPEG_H264, "H264", 0, "H.264", ""}, not a container -// {FFMPEG_XVID, "XVID", 0, "Xvid", ""}, not a container {FFMPEG_OGG, "OGG", 0, "Ogg", ""}, {FFMPEG_MKV, "MKV", 0, "Matroska", ""}, {FFMPEG_FLV, "FLASH", 0, "Flash", ""}, @@ -5243,19 +5241,18 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {AV_CODEC_ID_PNG, "PNG", 0, "PNG", ""}, {AV_CODEC_ID_QTRLE, "QTRLE", 0, "QT rle / QT Animation", ""}, {AV_CODEC_ID_THEORA, "THEORA", 0, "Theora", ""}, + {AV_CODEC_ID_VP9, "WEBM", 0, "WEBM / VP9", ""}, {0, NULL, 0, NULL, NULL} }; + /* Recommendations come from the FFmpeg wiki, https://trac.ffmpeg.org/wiki/Encode/VP9. + * The label for BEST has been changed to "Slowest" so that it fits the "Encoding Speed" + * property label in the UI. */ static const EnumPropertyItem ffmpeg_preset_items[] = { - {FFM_PRESET_ULTRAFAST, "ULTRAFAST", 0, "Ultra fast; biggest file", ""}, - {FFM_PRESET_SUPERFAST, "SUPERFAST", 0, "Super fast", ""}, - {FFM_PRESET_VERYFAST, "VERYFAST", 0, "Very fast", ""}, - {FFM_PRESET_FASTER, "FASTER", 0, "Faster", ""}, - {FFM_PRESET_FAST, "FAST", 0, "Fast", ""}, - {FFM_PRESET_MEDIUM, "MEDIUM", 0, "Medium speed", ""}, - {FFM_PRESET_SLOW, "SLOW", 0, "Slow", ""}, - {FFM_PRESET_SLOWER, "SLOWER", 0, "Slower", ""}, - {FFM_PRESET_VERYSLOW, "VERYSLOW", 0, "Very slow; smallest file", ""}, + {FFM_PRESET_BEST, "BEST", 0, "Slowest", + "Recommended if you have lots of time and want the best compression efficiency"}, + {FFM_PRESET_GOOD, "GOOD", 0, "Good", "The default and recommended for most applications"}, + {FFM_PRESET_REALTIME, "REALTIME", 0, "Realtime", "Recommended for fast encoding"}, {0, NULL, 0, NULL, NULL} }; @@ -5391,7 +5388,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "ffmpeg_preset"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, ffmpeg_preset_items); - RNA_def_property_enum_default(prop, FFM_PRESET_MEDIUM); + RNA_def_property_enum_default(prop, FFM_PRESET_GOOD); RNA_def_property_ui_text(prop, "Encoding speed", "Tradeoff between encoding speed and compression ratio"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); |