== 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! :)
This commit is contained in:
@@ -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'
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,6 +255,7 @@ 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,
|
||||
@@ -259,6 +264,9 @@ static void write_video_frame(AVFrame* frame)
|
||||
packet.pts = c->coded_frame->pts;
|
||||
#endif
|
||||
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:
|
||||
|
||||
@@ -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']
|
||||
|
||||
|
||||
@@ -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,6 +1917,9 @@ static char* ffmpeg_codec_pup(void) {
|
||||
"DV", CODEC_ID_DVVIDEO,
|
||||
"H264", CODEC_ID_H264,
|
||||
"XVid", CODEC_ID_XVID,
|
||||
#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(),
|
||||
|
||||
@@ -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']:
|
||||
|
||||
@@ -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', ''),
|
||||
|
||||
Reference in New Issue
Block a user