Fix [#21351] PROPERTIES: Resolution changes based solely on changing
authorMatt Ebb <matt@mke3.net>
Sat, 13 Mar 2010 00:17:52 +0000 (00:17 +0000)
committerMatt Ebb <matt@mke3.net>
Sat, 13 Mar 2010 00:17:52 +0000 (00:17 +0000)
encoding format

Bypassed existing hardcoded ffmpeg presets that executed when changing
format, replaced with bpy presets.

Leaving old code there for now, haven't got python/rna access to the ffmpeg
id properties.. Anyone know how to do this?
Code snippets here: http://www.pasteall.org/11657/c

release/scripts/presets/ffmpeg/DV.py [new file with mode: 0644]
release/scripts/presets/ffmpeg/DVD.py [new file with mode: 0644]
release/scripts/presets/ffmpeg/SVCD.py [new file with mode: 0644]
release/scripts/presets/ffmpeg/VCD.py [new file with mode: 0644]
release/scripts/presets/ffmpeg/h264.py [new file with mode: 0644]
release/scripts/presets/ffmpeg/theora.py [new file with mode: 0644]
release/scripts/presets/ffmpeg/xvid.py [new file with mode: 0644]
release/scripts/ui/properties_render.py
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/makesrna/intern/rna_scene.c

diff --git a/release/scripts/presets/ffmpeg/DV.py b/release/scripts/presets/ffmpeg/DV.py
new file mode 100644 (file)
index 0000000..db1bc0f
--- /dev/null
@@ -0,0 +1,9 @@
+is_ntsc = (bpy.context.scene.render.fps != 25)
+
+bpy.context.scene.render.ffmpeg_format = "DV"
+bpy.context.scene.render.resolution_x = 720
+
+if is_ntsc:
+    bpy.context.scene.render.resolution_y = 480
+else:
+    bpy.context.scene.render.resolution_y = 576
diff --git a/release/scripts/presets/ffmpeg/DVD.py b/release/scripts/presets/ffmpeg/DVD.py
new file mode 100644 (file)
index 0000000..6ac6c3c
--- /dev/null
@@ -0,0 +1,18 @@
+is_ntsc = (bpy.context.scene.render.fps != 25)
+
+bpy.context.scene.render.ffmpeg_format = "MPEG2"
+bpy.context.scene.render.resolution_x = 720
+
+if is_ntsc:
+    bpy.context.scene.render.resolution_y = 480
+    bpy.context.scene.render.ffmpeg_gopsize = 18
+else:
+    bpy.context.scene.render.resolution_y = 576
+    bpy.context.scene.render.ffmpeg_gopsize = 15
+
+bpy.context.scene.render.ffmpeg_video_bitrate = 6000
+bpy.context.scene.render.ffmpeg_maxrate = 9000
+bpy.context.scene.render.ffmpeg_minrate = 0
+bpy.context.scene.render.ffmpeg_buffersize = 224*8
+bpy.context.scene.render.ffmpeg_packetsize = 2048
+bpy.context.scene.render.ffmpeg_muxrate = 10080000
\ No newline at end of file
diff --git a/release/scripts/presets/ffmpeg/SVCD.py b/release/scripts/presets/ffmpeg/SVCD.py
new file mode 100644 (file)
index 0000000..1d8752f
--- /dev/null
@@ -0,0 +1,18 @@
+is_ntsc = (bpy.context.scene.render.fps != 25)
+
+bpy.context.scene.render.ffmpeg_format = "MPEG2"
+bpy.context.scene.render.resolution_x = 480
+
+if is_ntsc:
+    bpy.context.scene.render.resolution_y = 480
+    bpy.context.scene.render.ffmpeg_gopsize = 18
+else:
+    bpy.context.scene.render.resolution_y = 576
+    bpy.context.scene.render.ffmpeg_gopsize = 15
+
+bpy.context.scene.render.ffmpeg_video_bitrate = 2040
+bpy.context.scene.render.ffmpeg_maxrate = 2516
+bpy.context.scene.render.ffmpeg_minrate = 0
+bpy.context.scene.render.ffmpeg_buffersize = 224*8
+bpy.context.scene.render.ffmpeg_packetsize = 2324
+bpy.context.scene.render.ffmpeg_muxrate = 0
\ No newline at end of file
diff --git a/release/scripts/presets/ffmpeg/VCD.py b/release/scripts/presets/ffmpeg/VCD.py
new file mode 100644 (file)
index 0000000..303fd85
--- /dev/null
@@ -0,0 +1,18 @@
+is_ntsc = (bpy.context.scene.render.fps != 25)
+
+bpy.context.scene.render.ffmpeg_format = "MPEG1"
+bpy.context.scene.render.resolution_x = 352
+
+if is_ntsc:
+    bpy.context.scene.render.resolution_y = 240
+    bpy.context.scene.render.ffmpeg_gopsize = 18
+else:
+    bpy.context.scene.render.resolution_y = 288
+    bpy.context.scene.render.ffmpeg_gopsize = 15
+
+bpy.context.scene.render.ffmpeg_video_bitrate = 1150
+bpy.context.scene.render.ffmpeg_maxrate = 1150
+bpy.context.scene.render.ffmpeg_minrate = 1150
+bpy.context.scene.render.ffmpeg_buffersize = 40*8
+bpy.context.scene.render.ffmpeg_packetsize = 2324
+bpy.context.scene.render.ffmpeg_muxrate = 2352 * 75 * 8
\ No newline at end of file
diff --git a/release/scripts/presets/ffmpeg/h264.py b/release/scripts/presets/ffmpeg/h264.py
new file mode 100644 (file)
index 0000000..e46dcd4
--- /dev/null
@@ -0,0 +1,16 @@
+is_ntsc = (bpy.context.scene.render.fps != 25)
+
+bpy.context.scene.render.ffmpeg_format = "H264"
+bpy.context.scene.render.ffmpeg_codec = "H264"
+
+if is_ntsc:
+    bpy.context.scene.render.ffmpeg_gopsize = 18
+else:
+    bpy.context.scene.render.ffmpeg_gopsize = 15
+
+bpy.context.scene.render.ffmpeg_video_bitrate = 6000
+bpy.context.scene.render.ffmpeg_maxrate = 9000
+bpy.context.scene.render.ffmpeg_minrate = 0
+bpy.context.scene.render.ffmpeg_buffersize = 224*8
+bpy.context.scene.render.ffmpeg_packetsize = 2048
+bpy.context.scene.render.ffmpeg_muxrate = 10080000
\ No newline at end of file
diff --git a/release/scripts/presets/ffmpeg/theora.py b/release/scripts/presets/ffmpeg/theora.py
new file mode 100644 (file)
index 0000000..bb84d97
--- /dev/null
@@ -0,0 +1,16 @@
+is_ntsc = (bpy.context.scene.render.fps != 25)
+
+bpy.context.scene.render.ffmpeg_format = "OGG"
+bpy.context.scene.render.ffmpeg_codec = "THEORA"
+
+if is_ntsc:
+    bpy.context.scene.render.ffmpeg_gopsize = 18
+else:
+    bpy.context.scene.render.ffmpeg_gopsize = 15
+
+bpy.context.scene.render.ffmpeg_video_bitrate = 6000
+bpy.context.scene.render.ffmpeg_maxrate = 9000
+bpy.context.scene.render.ffmpeg_minrate = 0
+bpy.context.scene.render.ffmpeg_buffersize = 224*8
+bpy.context.scene.render.ffmpeg_packetsize = 2048
+bpy.context.scene.render.ffmpeg_muxrate = 10080000
\ No newline at end of file
diff --git a/release/scripts/presets/ffmpeg/xvid.py b/release/scripts/presets/ffmpeg/xvid.py
new file mode 100644 (file)
index 0000000..c0f5a3a
--- /dev/null
@@ -0,0 +1,16 @@
+is_ntsc = (bpy.context.scene.render.fps != 25)
+
+bpy.context.scene.render.ffmpeg_format = "AVI"
+bpy.context.scene.render.ffmpeg_codec = "XVID"
+
+if is_ntsc:
+    bpy.context.scene.render.ffmpeg_gopsize = 18
+else:
+    bpy.context.scene.render.ffmpeg_gopsize = 15
+
+bpy.context.scene.render.ffmpeg_video_bitrate = 6000
+bpy.context.scene.render.ffmpeg_maxrate = 9000
+bpy.context.scene.render.ffmpeg_minrate = 0
+bpy.context.scene.render.ffmpeg_buffersize = 224*8
+bpy.context.scene.render.ffmpeg_packetsize = 2048
+bpy.context.scene.render.ffmpeg_muxrate = 10080000
\ No newline at end of file
index a0992251f76ce33dd052654788110475de9ee518..23dc434ae38f968883cd86d606bc57e4f6e79afc 100644 (file)
@@ -29,6 +29,13 @@ class RENDER_MT_presets(bpy.types.Menu):
     draw = bpy.types.Menu.draw_preset
 
 
+class RENDER_MT_ffmpeg_presets(bpy.types.Menu):
+    bl_label = "FFMPEG Presets"
+    preset_subdir = "ffmpeg"
+    preset_operator = "script.python_file_run"
+    draw = bpy.types.Menu.draw_preset
+
+
 class RenderButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
@@ -379,6 +386,8 @@ class RENDER_PT_encoding(RenderButtonsPanel):
         rd = context.scene.render
         wide_ui = context.region.width > narrowui
 
+        layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
+
         split = layout.split()
 
         col = split.column()
@@ -627,6 +636,7 @@ class RENDER_PT_bake(RenderButtonsPanel):
 
 classes = [
     RENDER_MT_presets,
+    RENDER_MT_ffmpeg_presets,
     RENDER_PT_render,
     RENDER_PT_layers,
     RENDER_PT_dimensions,
index 8aa9282937c02482f04ba797351014f6fac848ef..ccef6832be85e29a2a274fa6eb15731176d28822 100644 (file)
@@ -1242,7 +1242,8 @@ void ffmpeg_verify_image_type(RenderData *rd)
                   rd->ffcodecdata.video_bitrate <= 1) {
 
                        rd->ffcodecdata.codec = CODEC_ID_MPEG2VIDEO;
-                       ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD);
+                       /* Don't set preset, disturbs render resolution.
+                        * ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD); */
                }
 
                audio= 1;
index 9872d6e1801d81f518b22d53e19e766e2996a1ce..5139a06aba5e51506132e2b75f2938229462f711 100644 (file)
@@ -132,7 +132,7 @@ EnumPropertyItem image_type_items[] = {
        {R_H264, "H264", ICON_FILE_MOVIE, "H.264", ""},
        {R_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", ""},
        {R_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", ""},
-       {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "FFMpeg", ""},
+       {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", ""},
 #endif
        {R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", ""},
        {0, NULL, 0, NULL, NULL}};