Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-01-13 16:34:23 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-01-13 16:34:23 +0400
commit8dcb1f4d12b809c46bccfc9e6e828447cd0d58d8 (patch)
tree2b97914b12b4508148348d37567c5855d0d7680d /source/blender/blenkernel/intern/writeffmpeg.c
parent0f34ce27cf9c44cb5f10d4033be407c00fee2a09 (diff)
Added Lossless Output option for h264 codec.
This will fix #26943: render image to video problem
Diffstat (limited to 'source/blender/blenkernel/intern/writeffmpeg.c')
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c99
1 files changed, 58 insertions, 41 deletions
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 25b6a3faf0b..0b043e26ab7 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -1200,6 +1200,56 @@ int ffmpeg_property_add_string(RenderData *rd, const char * type, const char * s
return 1;
}
+static void ffmpeg_set_expert_options(RenderData *rd, int preset)
+{
+ if(rd->ffcodecdata.properties)
+ IDP_FreeProperty(rd->ffcodecdata.properties);
+
+ if(preset == FFMPEG_PRESET_H264) {
+ /*
+ * All options here are for x264, but must be set via ffmpeg.
+ * The names are therefore different - Search for "x264 to FFmpeg option mapping"
+ * to get a list.
+ */
+
+ /*
+ * Use CABAC coder. Using "coder:1", which should be equivalent,
+ * crashes Blender for some reason. Either way - this is no big deal.
+ */
+ ffmpeg_property_add_string(rd, "video", "coder:vlc");
+
+ /*
+ * The other options were taken from the libx264-default.preset
+ * included in the ffmpeg distribution.
+ */
+ ffmpeg_property_add_string(rd, "video", "flags:loop");
+ ffmpeg_property_add_string(rd, "video", "cmp:chroma");
+ ffmpeg_property_add_string(rd, "video", "partitions:parti4x4");
+ ffmpeg_property_add_string(rd, "video", "partitions:partp8x8");
+ ffmpeg_property_add_string(rd, "video", "partitions:partb8x8");
+ ffmpeg_property_add_string(rd, "video", "me:hex");
+ ffmpeg_property_add_string(rd, "video", "subq:6");
+ ffmpeg_property_add_string(rd, "video", "me_range:16");
+ ffmpeg_property_add_string(rd, "video", "qdiff:4");
+ ffmpeg_property_add_string(rd, "video", "keyint_min:25");
+ ffmpeg_property_add_string(rd, "video", "sc_threshold:40");
+ ffmpeg_property_add_string(rd, "video", "i_qfactor:0.71");
+ ffmpeg_property_add_string(rd, "video", "b_strategy:1");
+ ffmpeg_property_add_string(rd, "video", "bf:3");
+ ffmpeg_property_add_string(rd, "video", "refs:2");
+ ffmpeg_property_add_string(rd, "video", "qcomp:0.6");
+ ffmpeg_property_add_string(rd, "video", "directpred:3");
+ ffmpeg_property_add_string(rd, "video", "trellis:0");
+ ffmpeg_property_add_string(rd, "video", "flags2:wpred");
+ ffmpeg_property_add_string(rd, "video", "flags2:dct8x8");
+ ffmpeg_property_add_string(rd, "video", "flags2:fastpskip");
+ ffmpeg_property_add_string(rd, "video", "wpredp:2");
+
+ if(rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
+ ffmpeg_property_add_string(rd, "video", "cqp:0");
+ }
+}
+
void ffmpeg_set_preset(RenderData *rd, int preset)
{
int isntsc = (rd->frs_sec != 25);
@@ -1267,47 +1317,7 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
rd->ffcodecdata.mux_packet_size = 2048;
rd->ffcodecdata.mux_rate = 10080000;
- /*
- * All options here are for x264, but must be set via ffmpeg.
- * The names are therefore different - Search for "x264 to FFmpeg option mapping"
- * to get a list.
- */
-
- /*
- * Use CABAC coder. Using "coder:1", which should be equivalent,
- * crashes Blender for some reason. Either way - this is no big deal.
- */
- ffmpeg_property_add_string(rd, "video", "coder:vlc");
-
- /*
- * The other options were taken from the libx264-default.preset
- * included in the ffmpeg distribution.
- */
- ffmpeg_property_add_string(rd, "video", "flags:loop");
- ffmpeg_property_add_string(rd, "video", "cmp:chroma");
- ffmpeg_property_add_string(rd, "video", "partitions:parti4x4");
- ffmpeg_property_add_string(rd, "video", "partitions:partp8x8");
- ffmpeg_property_add_string(rd, "video", "partitions:partb8x8");
- ffmpeg_property_add_string(rd, "video", "me:hex");
- ffmpeg_property_add_string(rd, "video", "subq:6");
- ffmpeg_property_add_string(rd, "video", "me_range:16");
- ffmpeg_property_add_string(rd, "video", "qdiff:4");
- ffmpeg_property_add_string(rd, "video", "keyint_min:25");
- ffmpeg_property_add_string(rd, "video", "sc_threshold:40");
- ffmpeg_property_add_string(rd, "video", "i_qfactor:0.71");
- ffmpeg_property_add_string(rd, "video", "b_strategy:1");
- ffmpeg_property_add_string(rd, "video", "bf:3");
- ffmpeg_property_add_string(rd, "video", "refs:2");
- ffmpeg_property_add_string(rd, "video", "qcomp:0.6");
- ffmpeg_property_add_string(rd, "video", "directpred:3");
- ffmpeg_property_add_string(rd, "video", "trellis:0");
- ffmpeg_property_add_string(rd, "video", "flags2:wpred");
- ffmpeg_property_add_string(rd, "video", "flags2:dct8x8");
- ffmpeg_property_add_string(rd, "video", "flags2:fastpskip");
- ffmpeg_property_add_string(rd, "video", "wpredp:2");
-
- // This makes x264 output lossless. Will be a separate option later.
- //ffmpeg_property_add_string(rd, "video", "cqp:0");
+ ffmpeg_set_expert_options(rd, preset);
break;
case FFMPEG_PRESET_THEORA:
@@ -1378,4 +1388,11 @@ void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
}
}
+void ffmpeg_verify_lossless_format(RenderData *rd, ImageFormatData *imf)
+{
+ if(imf->imtype == R_IMF_IMTYPE_H264) {
+ ffmpeg_set_expert_options(rd, FFMPEG_PRESET_H264);
+ }
+}
+
#endif