X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Fsrc%2Fmodules%2Fmod_ffmpeg%2Ftrgt_ffmpeg.cpp;h=57d0b9d84299114aa09fe7a5cf914a4ee92594d0;hb=1354883f48abfa62210837cd8db7b6413b3a64eb;hp=0f2a728492ce79f5d59bbcd809938ababba85742;hpb=5eccd51f77694fb18d4618ee78c822de006fa5e6;p=synfig.git diff --git a/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp b/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp index 0f2a728..57d0b9d 100644 --- a/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp +++ b/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp @@ -90,8 +90,17 @@ ffmpeg_trgt::ffmpeg_trgt(const char *Filename, buffer=NULL; color_buffer=0; set_remove_alpha(); - video_codec = params.video_codec; - bitrate = params.bitrate; + + // Set default video codec and bitrate if they weren't given. + if (params.video_codec == "none") + video_codec = "mpeg1video"; + else + video_codec = params.video_codec; + + if (params.bitrate == -1) + bitrate = 200; + else + bitrate = params.bitrate; } ffmpeg_trgt::~ffmpeg_trgt() @@ -163,8 +172,9 @@ ffmpeg_trgt::init() if( filename.c_str()[0] == '-' ) command = strprintf("ffmpeg -f image2pipe -vcodec ppm -an" - " -r %f -i pipe: -loop -hq" - " -title \"%s\" -vcodec %s -b %i" + " -r %f -i pipe: -loop_input" + " -metadata title=\"%s\" " + " -vcodec %s -b %ik" " -y -- \"%s\"\n", desc.get_frame_rate(), get_canvas()->get_name().c_str(), @@ -172,8 +182,9 @@ ffmpeg_trgt::init() filename.c_str()); else command = strprintf("ffmpeg -f image2pipe -vcodec ppm -an" - " -r %f -i pipe: -loop -hq" - " -title \"%s\" -vcodec %s -b %i" + " -r %f -i pipe: -loop_input" + " -metadata title=\"%s\" " + "-vcodec %s -b %ik" " -y -- \"%s\"\n", desc.get_frame_rate(), get_canvas()->get_name().c_str(), @@ -213,19 +224,21 @@ ffmpeg_trgt::init() execlp("ffmpeg", "ffmpeg", "-f", "image2pipe", "-vcodec", "ppm", "-an", "-r", strprintf("%f", desc.get_frame_rate()).c_str(), - "-i", "pipe:", "-loop", "-hq", - "-title", get_canvas()->get_name().c_str(), + "-i", "pipe:", "-loop_input", + "-metadata", + strprintf("title=\"%s\"", get_canvas()->get_name().c_str()).c_str(), "-vcodec", video_codec.c_str(), - "-b", bitrate, + "-b", strprintf("%ik", bitrate).c_str(), "-y", "--", filename.c_str(), (const char *)NULL); else execlp("ffmpeg", "ffmpeg", "-f", "image2pipe", "-vcodec", "ppm", "-an", "-r", strprintf("%f", desc.get_frame_rate()).c_str(), - "-i", "pipe:", "-loop", "-hq", - "-title", get_canvas()->get_name().c_str(), + "-i", "pipe:", "-loop_input", + "-metadata", + strprintf("title=\"%s\"", get_canvas()->get_name().c_str()).c_str(), "-vcodec", video_codec.c_str(), - "-b", bitrate, + "-b", strprintf("%ik", bitrate).c_str(), "-y", filename.c_str(), (const char *)NULL); // We should never reach here unless the exec failed