[Solved]Arguments formatting when calling ffmpeg from QProcess
-
Hi,
I am trying to call a command line program (ffmpeg) from my Widgets Qt application.The program is starting but the arguments are not being passed correctly(The window is disappearing before I can see what is going wrong).
The command I want pass is:ffmpeg.exe -i video1.avi video.wmv
(All is working fine when I call it myself from the command line).
Can anyone suggest a way I can get my arguments interpreted correctly by Qt?The relevant code to the question is shown below.Thank you for your time.
@
QString program1="ffmpeg.exe";QStringList arguments; arguments << "-i"<< "video.avi" << "video.wmv"; QProcess *myProcess = new QProcess(this); if(myProcess->startDetached(program1,arguments)) ui->pushButton->setText("YOUR PROGRAM STARTED.");//for debugging purposes.
@
-
Hi,
It should be something like:
@
arguments << "-i" << "video1.avi" << "video.wmv";
@However relative path to the video files might be a bad idea
-
You're welcome !
Depending on how you intend to use your program you might better offer a configuration option to set the path to ffmpeg rather than hardcode it.
Since it's working now, don't forget to update the thread title prepending [solved] so other forum users may know a solution has been found :)