On 13/04/2010, Daniel Wamara <daol...@hotmail.com> wrote:
> Good evening all,
>
>  I am trying to call ffmpeg via the command exec in order to transcode some 
> files and the strange thing happening is that the files produced are not the 
> same as the one I can create when calling the same command via the command 
> line.
>
>  This is how I am calling fmpeg and I get a file with a particular codec in 
> it (strangely not the right one) although launching in the command line 
> exactly what I have in the sb.toString() which is the command to be executed, 
> the file created has a correct codec. So to say, the same command started via 
> Exec and the one started via the command line have not the same result. 
> Anyone has an idea?
>
>  Thanks.
>  Daniel Wamara
>
>  StringBuilder sb = new StringBuilder("/home/ect/scripts/transcoding.sh ");
>
>  sb.append(" " + source.getAbsolutePath());
>
>  sb.append(" " + attributes.getCodec());
>
>  sb.append(" " + String.valueOf(attributes.getSamplingRate().intValue()));
>
>  sb.append(" " + target.getAbsolutePath());
>
>
>  logDebug("command --> " + sb.toString());
>
>
>  CommandLine commandLine = CommandLine.parse(sb.toString());

Why do you build up the command-line and then parse it?

Much safer to add the arguments one at a time, see:

http://commons.apache.org/exec/tutorial.html

under the heading "Build the Command Line Incrementally"


>  DefaultExecutor executor = new DefaultExecutor();
>
>  executor.execute(commandLine);
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to