From 88af81669e1fb2e2634d807f2326acd9ce2f3817 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Thu, 25 Feb 2010 00:42:49 +0100 Subject: [PATCH] libx264 codec parameters fix --- synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp | 63 +++++++++++++++------- 1 file changed, 45 insertions(+), 18 deletions(-) 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")); -- 2.7.4