Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Arguments formatting when calling ffmpeg from QProcess
Forum Updated to NodeBB v4.3 + New Features

[Solved]Arguments formatting when calling ffmpeg from QProcess

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • musimbateM Offline
    musimbateM Offline
    musimbate
    wrote on last edited by
    #1

    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.
    

    @

    Why join the navy if you can be a pirate?-Steve Jobs

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      It should be something like:

      @
      arguments << "-i" << "video1.avi" << "video.wmv";
      @

      However relative path to the video files might be a bad idea

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • musimbateM Offline
        musimbateM Offline
        musimbate
        wrote on last edited by
        #3

        Thank you ,
        I resolved to using full paths:
        @
        QString program1="D:\ffmpeg\bin\ffmpeg.exe";

          arguments << "-i"<< "D:\\ffmpeg\\bin\\ohm.avi" <<"-r"<<"24" <<"D:\\ffmpeg\\bin\\output.flv";
        

        @

        and it is working fine now.

        Why join the navy if you can be a pirate?-Steve Jobs

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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 :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved