I think it is because you have arguments that contains spaces - on windows they are wrapped in "quotes" and passed to the called process as single argument, look:
// simple program that will write passed command line arguments into file
#include <stdio.h>
int main(int argc, char ** argv){
FILE * f = fopen("args.txt","w");
int i=0;
for (i=0 ; i<argc ; ++i){
fprintf(f,"%s\n",argv[i]);
}
fclose(f);
return 0;
}
// QProcess test code:
...
sl << "no_space" << "what is this" << "out.txt";
qDebug() << sl;
proc.start("args.exe",sl);
qDebug() << proc.waitForStarted();
qDebug() << proc.waitForFinished();
// simple program that will write passed command line arguments into file
#include <stdio.h>
int main(int argc, char ** argv){
FILE * f = fopen("args.txt","w");
int i=0;
for (i=0 ; i<argc ; ++i){
fprintf(f,"%s\n",argv[i]);
}
fclose(f);
return 0;
}
// QProcess test code:
...
QStringList sl;
sl << "no_space" << "what is this" << "out.txt";
qDebug() << sl;
QProcess proc;
proc.start("args.exe",sl);
qDebug() << proc.waitForStarted();
qDebug() << proc.waitForFinished();
To copy to clipboard, switch view to plain text mode
args.txt will contain four arguments, as "what is this" string was passed in as single string, I think you can see how different it is from calling the same process from the console:
args.exe no_space what is this out.txt
args.exe no_space what is this out.txt
To copy to clipboard, switch view to plain text mode
now args.txt will contain six arguments.
I don't know how ffmpeg handles its arguments, but my guess is - you have to separate the "-i" and "-r" arguments:
sl << "-i";
sl << projFilePath + sceneDir + "/" + sceneDir + "_%5d.png";
sl << "-r"
sl << sr.setNum(fps) ;
QStringList sl;
sl << "-i";
sl << projFilePath + sceneDir + "/" + sceneDir + "_%5d.png";
QString sr;
sl << "-r"
sl << sr.setNum(fps) ;
To copy to clipboard, switch view to plain text mode
Bookmarks