** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
** Copyright (c) 2007 Chris Moore
+** Copyright (c) 2010 Diego Barrios Romero
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
/* === M E T H O D S ======================================================= */
-ffmpeg_trgt::ffmpeg_trgt(const char *Filename)
+ffmpeg_trgt::ffmpeg_trgt(const char *Filename,
+ const synfig::TargetParam& params)
{
pid=-1;
file=NULL;
buffer=NULL;
color_buffer=0;
set_remove_alpha();
+ video_codec = params.video_codec;
+ bitrate = params.bitrate;
}
ffmpeg_trgt::~ffmpeg_trgt()
string command;
if( filename.c_str()[0] == '-' )
- command=strprintf("ffmpeg -f image2pipe -vcodec ppm -an -r %f -i pipe: -loop -hq -title \"%s\" -vcodec mpeg1video -y -- \"%s\"\n",desc.get_frame_rate(),get_canvas()->get_name().c_str(),filename.c_str());
+ command = strprintf("ffmpeg -f image2pipe -vcodec ppm -an"
+ " -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(),
+ video_codec.c_str(), bitrate,
+ filename.c_str());
else
- command=strprintf("ffmpeg -f image2pipe -vcodec ppm -an -r %f -i pipe: -loop -hq -title \"%s\" -vcodec mpeg1video -y \"%s\"\n",desc.get_frame_rate(),get_canvas()->get_name().c_str(),filename.c_str());
+ command = strprintf("ffmpeg -f image2pipe -vcodec ppm -an"
+ " -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(),
+ video_codec.c_str(), bitrate,
+ filename.c_str());
file=popen(command.c_str(),POPEN_BINARY_WRITE_TYPE);
// 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", "-hq", "-title", get_canvas()->get_name().c_str(), "-vcodec", "mpeg1video", "-y", "--", filename.c_str(), (const char *)NULL);
+ execlp("ffmpeg", "ffmpeg", "-f", "image2pipe", "-vcodec",
+ "ppm", "-an", "-r",
+ strprintf("%f", desc.get_frame_rate()).c_str(),
+ "-i", "pipe:", "-loop_input",
+ //strprintf("-metadata 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", "-hq", "-title", get_canvas()->get_name().c_str(), "-vcodec", "mpeg1video", "-y", filename.c_str(), (const char *)NULL);
+ execlp("ffmpeg", "ffmpeg", "-f", "image2pipe", "-vcodec",
+ "ppm", "-an", "-r",
+ strprintf("%f", desc.get_frame_rate()).c_str(),
+ "-i", "pipe:", "-loop_input",
+ //strprintf("-metadata 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"));
return false;