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:
authorPeter Schlaile <peter@schlaile.de>2008-10-05 21:31:33 +0400
committerPeter Schlaile <peter@schlaile.de>2008-10-05 21:31:33 +0400
commit34399546b71fc10a2e5ca9e808ba589ee8e8f394 (patch)
tree9a515133a10c68295c3dd65203c82aecd894bade
parente99ff615d78132bf206ab7fbf572d3d63f345a75 (diff)
== FFMPEG ==
Added optional OGG / theora / vorbis support. (OGG-format encoding is currently disabled, since the bundled ffmpeg version is broken here) Fixed a bug with PTS-encoding, to make theora work. You have to explicitly enable it and currently only scons is supported. Otherwise: enjoy! :)
-rw-r--r--config/linux2-config.py12
-rw-r--r--source/blender/blenkernel/BKE_writeffmpeg.h10
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c20
-rw-r--r--source/blender/src/SConscript3
-rw-r--r--source/blender/src/buttons_scene.c38
-rw-r--r--tools/Blender.py2
-rwxr-xr-xtools/btools.py5
7 files changed, 64 insertions, 26 deletions
diff --git a/config/linux2-config.py b/config/linux2-config.py
index cd7e6659af1..2b7bf074f83 100644
--- a/config/linux2-config.py
+++ b/config/linux2-config.py
@@ -143,21 +143,21 @@ BF_FFMPEG_LIB = ''
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
+# enable ogg, vorbis and theora in ffmpeg
+WITH_BF_OGG = 'false' # -DWITH_OGG
+BF_OGG = '/usr'
+BF_OGG_INC = '${BF_OGG}/include'
+BF_OGG_LIB = 'ogg vorbis theoraenc theoradec'
+
WITH_BF_OPENJPEG = 'true'
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
-# Uncomment the following two lines to use system's ffmpeg
-# BF_FFMPEG = '/usr'
-# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_REDCODE = 'false'
BF_REDCODE = '#extern/libredcode'
BF_REDCODE_LIB = ''
-# Uncomment the following two lines to use system's ffmpeg
-# BF_FFMPEG = '/usr'
-# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
BF_REDCODE_INC = '${BF_REDCODE}/include'
BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h
index 7819919fba8..02f7ba6f860 100644
--- a/source/blender/blenkernel/BKE_writeffmpeg.h
+++ b/source/blender/blenkernel/BKE_writeffmpeg.h
@@ -44,15 +44,7 @@ extern "C" {
#define FFMPEG_XVID 7
#define FFMPEG_FLV 8
#define FFMPEG_MKV 9
-
-#define FFMPEG_CODEC_MPEG1 0
-#define FFMPEG_CODEC_MPEG2 1
-#define FFMPEG_CODEC_MPEG4 2
-#define FFMPEG_CODEC_HUFFYUV 3
-#define FFMPEG_CODEC_DV 4
-#define FFMPEG_CODEC_H264 5
-#define FFMPEG_CODEC_XVID 6
-#define FFMPEG_CODEC_FLV1 7
+#define FFMPEG_OGG 10
#define FFMPEG_PRESET_NONE 0
#define FFMPEG_PRESET_DVD 1
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 64af8258f80..cef6f802729 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -230,6 +230,10 @@ static const char** get_file_extensions(int format)
static const char * rv[] = { ".mkv", NULL };
return rv;
}
+ case FFMPEG_OGG: {
+ static const char * rv[] = { ".ogg", ".ogv", NULL };
+ return rv;
+ }
default:
return NULL;
}
@@ -251,14 +255,18 @@ static void write_video_frame(AVFrame* frame)
AVPacket packet;
av_init_packet(&packet);
+ if (c->coded_frame->pts != AV_NOPTS_VALUE) {
#ifdef FFMPEG_CODEC_TIME_BASE
- packet.pts = av_rescale_q(c->coded_frame->pts,
- c->time_base,
- video_stream->time_base);
+ packet.pts = av_rescale_q(c->coded_frame->pts,
+ c->time_base,
+ video_stream->time_base);
#else
- packet.pts = c->coded_frame->pts;
+ packet.pts = c->coded_frame->pts;
#endif
- fprintf(stderr, "Video Frame PTS: %lld\n", packet.pts);
+ fprintf(stderr, "Video Frame PTS: %lld\n", packet.pts);
+ } else {
+ fprintf(stderr, "Video Frame PTS: not set\n");
+ }
if (c->coded_frame->key_frame)
packet.flags |= PKT_FLAG_KEY;
packet.stream_index = video_stream->index;
@@ -669,6 +677,8 @@ void start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty)
switch(ffmpeg_type) {
case FFMPEG_AVI:
case FFMPEG_MOV:
+ case FFMPEG_OGG:
+ case FFMPEG_MKV:
fmt->video_codec = ffmpeg_codec;
break;
case FFMPEG_DV:
diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript
index c421d1e8388..5365908c130 100644
--- a/source/blender/src/SConscript
+++ b/source/blender/src/SConscript
@@ -65,6 +65,9 @@ if env['WITH_BF_FFMPEG'] == 1:
defs.append('WITH_FFMPEG')
incs += ' ' + env['BF_FFMPEG_INC']
+if env['WITH_BF_OGG'] == 1:
+ defs.append('WITH_OGG')
+
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 8ea71ce38dc..74725b99fea 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -1859,7 +1859,12 @@ static char* ffmpeg_format_pup(void)
}
return string;
#endif
- strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
+ strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d"
+#if 0
+/* ifdef WITH_OGG, disabled, since broken within ffmpeg bundled with blender */
+ "|%s %%x%d"
+#endif
+ "|%s %%x%d");
sprintf(string, formatstring,
"MPEG-1", FFMPEG_MPEG1,
"MPEG-2", FFMPEG_MPEG2,
@@ -1869,6 +1874,10 @@ static char* ffmpeg_format_pup(void)
"DV", FFMPEG_DV,
"H264", FFMPEG_H264,
"XVid", FFMPEG_XVID,
+#if 0
+/* ifdef WITH_OGG, disabled, since broken within ffmpeg bundled with blender */
+ "OGG", FFMPEG_OGG,
+#endif
"FLV", FFMPEG_FLV);
return string;
}
@@ -1893,7 +1902,13 @@ static char* ffmpeg_preset_pup(void)
static char* ffmpeg_codec_pup(void) {
static char string[2048];
char formatstring[2048];
- strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
+ strcpy(formatstring,
+ "FFMpeg format: %%t"
+ "|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d"
+#ifdef WITH_OGG
+ "|%s %%x%d"
+#endif
+ "|%s %%x%d");
sprintf(string, formatstring,
"MPEG1", CODEC_ID_MPEG1VIDEO,
"MPEG2", CODEC_ID_MPEG2VIDEO,
@@ -1902,7 +1917,10 @@ static char* ffmpeg_codec_pup(void) {
"DV", CODEC_ID_DVVIDEO,
"H264", CODEC_ID_H264,
"XVid", CODEC_ID_XVID,
- "FlashVideo1", CODEC_ID_FLV1 );
+#ifdef WITH_OGG
+ "Theora", CODEC_ID_THEORA,
+#endif
+ "FlashVideo1", CODEC_ID_FLV1);
return string;
}
@@ -1910,12 +1928,20 @@ static char* ffmpeg_codec_pup(void) {
static char* ffmpeg_audio_codec_pup(void) {
static char string[2048];
char formatstring[2048];
- strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
+ strcpy(formatstring,
+ "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d"
+#ifdef WITH_OGG
+ "|%s %%x%d"
+#endif
+ "|%s %%x%d");
sprintf(string, formatstring,
"MP2", CODEC_ID_MP2,
"MP3", CODEC_ID_MP3,
"AC3", CODEC_ID_AC3,
"AAC", CODEC_ID_AAC,
+#ifdef WITH_OGG
+ "Vorbis", CODEC_ID_VORBIS,
+#endif
"PCM", CODEC_ID_PCM_S16LE);
return string;
@@ -2910,8 +2936,8 @@ static void render_panel_ffmpeg_video(void)
0, 1, 0,0, "Autosplit output at 2GB boundary.");
- if (ELEM3(G.scene->r.ffcodecdata.type, FFMPEG_AVI,
- FFMPEG_MOV, FFMPEG_MKV)) {
+ if (ELEM4(G.scene->r.ffcodecdata.type, FFMPEG_AVI,
+ FFMPEG_MOV, FFMPEG_MKV, FFMPEG_OGG)) {
uiDefBut(block, LABEL, 0, "Codec",
xcol1, yofs-44, 110, 20, 0, 0, 0, 0, 0, "");
uiDefButI(block, MENU,B_REDR, ffmpeg_codec_pup(),
diff --git a/tools/Blender.py b/tools/Blender.py
index 47bc5e9fa72..330a3713817 100644
--- a/tools/Blender.py
+++ b/tools/Blender.py
@@ -176,6 +176,8 @@ def setup_syslibs(lenv):
syslibs += Split(lenv['BF_OPENEXR_LIB'])
if lenv['WITH_BF_FFMPEG']:
syslibs += Split(lenv['BF_FFMPEG_LIB'])
+ if lenv['WITH_BF_OGG']:
+ syslibs += Split(lenv['BF_OGG_LIB'])
if lenv['WITH_BF_SDL']:
syslibs += Split(lenv['BF_SDL_LIB'])
if not lenv['WITH_BF_STATICOPENGL']:
diff --git a/tools/btools.py b/tools/btools.py
index 58b667b486f..4c5e0dd3527 100755
--- a/tools/btools.py
+++ b/tools/btools.py
@@ -35,6 +35,7 @@ def validate_arguments(args, bc):
'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC',
'WITH_BF_DDS',
'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG', 'BF_FFMPEG_INC',
+ 'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH',
'BF_TIFF', 'BF_TIFF_INC',
@@ -194,6 +195,10 @@ def read_opts(cfg, args):
('BF_FFMPEG_INC', 'FFMPEG includes', ''),
('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''),
+ (BoolOption('WITH_BF_OGG', 'Use OGG, THEORA, VORBIS in FFMPEG if true',
+ 'false')),
+ ('BF_OGG', 'OGG base path', ''),
+ ('BF_OGG_LIB', 'OGG library', ''),
(BoolOption('WITH_BF_JPEG', 'Use JPEG if true', 'true')),
('BF_JPEG', 'JPEG base path', ''),