diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2016-09-21 16:01:51 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2016-09-21 16:03:11 +0300 |
commit | a7e74791221e2ef9b44ee1b3eb9ece37785aa62a (patch) | |
tree | bdef7bcac914ea1330046baac05c52719c34cd7e /source/blender/makesdna | |
parent | 2476faebd751fe7a250d7a496a1f56338b83d4e9 (diff) |
FFmpeg interface improvements
This patch changes a couple of things in the video output encoding.
{F362527}
- Clearer separation between container and codec. No more "format", as this is
too ambiguous. As a result, codecs were removed from the container list.
- Added FFmpeg speed presets, so the user can choosen from the range "Very
slow" to "Ultra fast". By default no preset is used.
- Added Constant Rate Factor (CRF) mode, which allows changing the bit-rate
depending on the desired quality and the input. This generally produces the
best quality videos, at the expense of not knowing the exact bit-rate and
file size.
- Added optional maximum of non-B-frames between B-frames (`max_b_frames`).
- Presets were adjusted for these changes, and new presets added. One of the
new presets is [recommended](https://trac.ffmpeg.org/wiki/Encode/VFX#H.264)
for reviewing videos, as it allows players to scrub through it easily. Might
be nice in weeklies. This preset also requires control over the
`max_b_frames` setting.
GUI-only changes:
- Renamed "MPEG" in the output file format menu with "FFmpeg", as this is more
accurate. After all, FFmpeg is used when this option is chosen, which can
also output non-MPEG files.
- Certain parts of the GUI are disabled when not in use:
- bit rate options are not used when a constant rate factor is given.
- audio bitrate & volume are not used when no audio is exported.
Note that I did not touch `BKE_ffmpeg_preset_set()`. There are currently two
preset systems for FFmpeg (`BKE_ffmpeg_preset_set()` and the Python preset
system). Before we do more work on `BKE_ffmpeg_preset_set()`, I think it's a
good idea to determine whether we want to keep it at all.
After this patch has been accepted, I'd be happy to go through the code and
remove any then-obsolete bits, such as the handling of "XVID" as a container
format.
Reviewers: sergey, mont29, brecht
Subscribers: mpan3, Blendify, brecht, fsiddi
Tags: #bf_blender
Differential Revision: https://developer.blender.org/D2242
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 5c5264afcba..94f23197293 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -135,6 +135,37 @@ typedef struct QuicktimeCodecSettings { int pad1; } QuicktimeCodecSettings; +typedef enum FFMpegPreset { + 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, +} FFMpegPreset; + + +/* Mapping from easily-understandable descriptions to CRF values. + * Assumes we output 8-bit video. Needs to be remapped if 10-bit + * is output. + * We use a slightly wider than "subjectively sane range" according + * to https://trac.ffmpeg.org/wiki/Encode/H.264#a1.ChooseaCRFvalue + */ +typedef enum FFMpegCrf { + FFM_CRF_NONE = -1, + FFM_CRF_LOSSLESS = 0, + FFM_CRF_PERC_LOSSLESS = 17, + FFM_CRF_HIGH = 20, + FFM_CRF_MEDIUM = 23, + FFM_CRF_LOW = 26, + FFM_CRF_VERYLOW = 29, + FFM_CRF_LOWEST = 32, +} FFMpegCrf; + typedef struct FFMpegCodecData { int type; int codec; @@ -146,13 +177,18 @@ typedef struct FFMpegCodecData { int audio_pad; float audio_volume; int gop_size; + int max_b_frames; /* only used if FFMPEG_USE_MAX_B_FRAMES flag is set. */ int flags; + int constant_rate_factor; + int ffmpeg_preset; /* see FFMpegPreset */ int rc_min_rate; int rc_max_rate; int rc_buffer_size; int mux_packet_size; int mux_rate; + int pad1; + IDProperty *properties; } FFMpegCodecData; @@ -1982,6 +2018,7 @@ enum { #endif FFMPEG_AUTOSPLIT_OUTPUT = 2, FFMPEG_LOSSLESS_OUTPUT = 4, + FFMPEG_USE_MAX_B_FRAMES = (1 << 3), }; /* Paint.flags */ |