Mark
Mark

Reputation: 5102

Argument doesn't recognized if passed with QProcess

I have difficult to pass the -vo argument to mplayer using QProcess, Here a minimal example:

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QString program;
    program = "C:\\mplayer-svn-38008\\mplayer.exe";

    QStringList arguments;
    arguments << "-vo gl" << "C:\\test.mp4"; 

    QProcess *m_process = new QProcess(this);
    m_process->start(program, arguments);
}

The process outputs:

Unknown option on the command line: -vo gl

using the same argument on Windows shell leads to the correct behavior:

>mplayer -vo gl C:/test.mp4

Also, removing that argument from the QStringList works. Why the -vo option is recognized from command line but not from QProcess?

Upvotes: 0

Views: 1293

Answers (1)

eyllanesc
eyllanesc

Reputation: 244212

You have to separate each argument that is separated by a space:

arguments << "-vo"<< "gl" << "C:\\test.mp4"; 

Upvotes: 3

Related Questions