[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41244] trunk/blender/source/blender/ blenkernel/intern/writeffmpeg.c: Fix #28949: can't render video to Flash
Sergey Sharybin
g.ulairi at gmail.com
Mon Oct 24 12:26:37 CEST 2011
Revision: 41244
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41244
Author: nazgul
Date: 2011-10-24 10:26:37 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
Fix #28949: can't render video to Flash
Several issues were discovered when was looking into this bug:
- MPEG file format didn't set needed codec settings such as frame
rate and so, Was caused by not very correct fix fix #21351.
- "Expert" codec settings stored in idprops was affected on
formats which don't actually need them causing some conflicts
in codec settings.
- Flash codec doesn't support b-frames.
Now C presets shouldn't affect on each other and flash coded wouldn't
use b-frames even when using h264 format. Should work fine for files
created from scratch. If existing files fails to render, try to
switch file format to something else and then back to needed value.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/writeffmpeg.c
Modified: trunk/blender/source/blender/blenkernel/intern/writeffmpeg.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/writeffmpeg.c 2011-10-24 10:11:47 UTC (rev 41243)
+++ trunk/blender/source/blender/blenkernel/intern/writeffmpeg.c 2011-10-24 10:26:37 UTC (rev 41244)
@@ -396,6 +396,20 @@
}
}
+static int ffmpeg_proprty_valid(AVCodecContext *c, const char *prop_name, IDProperty *curr)
+{
+ int valid= 1;
+
+ if(strcmp(prop_name, "video")==0) {
+ if(strcmp(curr->name, "bf")==0) {
+ /* flash codec doesn't support b frames */
+ valid&= c->codec_id!=CODEC_ID_FLV1;
+ }
+ }
+
+ return valid;
+}
+
static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char * prop_name)
{
IDProperty * prop;
@@ -414,7 +428,8 @@
iter = IDP_GetGroupIterator(prop);
while ((curr = IDP_GroupIterNext(iter)) != NULL) {
- set_ffmpeg_property_option(c, curr);
+ if(ffmpeg_proprty_valid(c, prop_name, curr))
+ set_ffmpeg_property_option(c, curr);
}
}
@@ -1187,6 +1202,9 @@
{
int isntsc = (rd->frs_sec != 25);
+ if(rd->ffcodecdata.properties)
+ IDP_FreeProperty(rd->ffcodecdata.properties);
+
switch (preset) {
case FFMPEG_PRESET_VCD:
rd->ffcodecdata.type = FFMPEG_MPEG1;
@@ -1217,8 +1235,11 @@
case FFMPEG_PRESET_DVD:
rd->ffcodecdata.type = FFMPEG_MPEG2;
rd->ffcodecdata.video_bitrate = 6000;
- rd->xsch = 720;
- rd->ysch = isntsc ? 480 : 576;
+
+ /* Don't set resolution, see [#21351]
+ * rd->xsch = 720;
+ * rd->ysch = isntsc ? 480 : 576; */
+
rd->ffcodecdata.gop_size = isntsc ? 18 : 15;
rd->ffcodecdata.rc_max_rate = 9000;
rd->ffcodecdata.rc_min_rate = 0;
@@ -1321,8 +1342,8 @@
rd->ffcodecdata.video_bitrate <= 1) {
rd->ffcodecdata.codec = CODEC_ID_MPEG2VIDEO;
- /* Don't set preset, disturbs render resolution.
- * ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD); */
+
+ ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD);
}
if(rd->ffcodecdata.type == FFMPEG_OGG) {
rd->ffcodecdata.type = FFMPEG_MPEG2;
More information about the Bf-blender-cvs
mailing list