From: Diego Barrios Romero Date: Wed, 24 Feb 2010 23:42:49 +0000 (+0100) Subject: libx264 codec parameters fix X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=88af81669e1fb2e2634d807f2326acd9ce2f3817;p=synfig.git libx264 codec parameters fix --- diff --git a/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp b/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp index 57d0b9d..d1b9219 100644 --- a/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp +++ b/synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp @@ -221,25 +221,52 @@ ffmpeg_trgt::init() // Close the unneeded pipeout close(p[0]); if( filename.c_str()[0] == '-' ) - execlp("ffmpeg", "ffmpeg", "-f", "image2pipe", "-vcodec", - "ppm", "-an", "-r", - strprintf("%f", desc.get_frame_rate()).c_str(), - "-i", "pipe:", "-loop_input", - "-metadata", - strprintf("title=\"%s\"", get_canvas()->get_name().c_str()).c_str(), - "-vcodec", video_codec.c_str(), - "-b", strprintf("%ik", bitrate).c_str(), - "-y", "--", filename.c_str(), (const char *)NULL); + { + // x264 codec needs -vpre hq parameters + if (video_codec == "libx264") + execlp("ffmpeg", "ffmpeg", "-f", "image2pipe", "-vcodec", + "ppm", "-an", "-r", + strprintf("%f", desc.get_frame_rate()).c_str(), + "-i", "pipe:", "-loop_input", "-metadata", + strprintf("title=\"%s\"", get_canvas()->get_name().c_str()).c_str(), + "-vcodec", video_codec.c_str(), + "-b", strprintf("%ik", bitrate).c_str(), + "-vpre", "hq", + "-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_input", "-metadata", + strprintf("title=\"%s\"", get_canvas()->get_name().c_str()).c_str(), + "-vcodec", video_codec.c_str(), + "-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_input", - "-metadata", - strprintf("title=\"%s\"", get_canvas()->get_name().c_str()).c_str(), - "-vcodec", video_codec.c_str(), - "-b", strprintf("%ik", bitrate).c_str(), - "-y", filename.c_str(), (const char *)NULL); + { + if (video_codec == "libx264") + execlp("ffmpeg", "ffmpeg", "-f", "image2pipe", "-vcodec", + "ppm", "-an", "-r", + strprintf("%f", desc.get_frame_rate()).c_str(), + "-i", "pipe:", "-loop_input", + "-metadata", + strprintf("title=\"%s\"", get_canvas()->get_name().c_str()).c_str(), + "-vcodec", video_codec.c_str(), + "-b", strprintf("%ik", bitrate).c_str(), + "-vpre", "hq", + "-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_input", + "-metadata", + strprintf("title=\"%s\"", get_canvas()->get_name().c_str()).c_str(), + "-vcodec", video_codec.c_str(), + "-b", strprintf("%ik", bitrate).c_str(), + "-y", filename.c_str(), (const char *)NULL); + } // We should never reach here unless the exec failed synfig::error(_("Unable to open pipe to ffmpeg"));