diff options
author | Peter Schlaile <peter@schlaile.de> | 2008-10-05 21:31:33 +0400 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2008-10-05 21:31:33 +0400 |
commit | 34399546b71fc10a2e5ca9e808ba589ee8e8f394 (patch) | |
tree | 9a515133a10c68295c3dd65203c82aecd894bade /source/blender | |
parent | e99ff615d78132bf206ab7fbf572d3d63f345a75 (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! :)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_writeffmpeg.h | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/writeffmpeg.c | 20 | ||||
-rw-r--r-- | source/blender/src/SConscript | 3 | ||||
-rw-r--r-- | source/blender/src/buttons_scene.c | 38 |
4 files changed, 51 insertions, 20 deletions
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(), |