Module: synfig
Branch: eldruin_ffmpeg2
Commit: 88af81669e1fb2e2634d807f2326acd9ce2f3817
URL:    
http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=88af81669e1fb2e2634d807f2326acd9ce2f3817

Author: Diego Barrios Romero <eldr...@gmailcom>
Date:   Thu Feb 25 00:42:49 2010 +0100

libx264 codec parameters fix

---

 synfig-core/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp |   63 ++++++++++++++------
 1 files 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"));


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to