Important: Please read the Qt Code of Conduct -

Calculate progress percentage of a process (which calls ffmpeg) (without progressbar)

  • Hi there,

    i my application i call ffmpeg.exe via process->start(). With this call ffmpeg starts encoding an audio file in the background. Now i want to calculate the percentage of the progress of the encoding and show it to the user in my GUI in a Label.
    Should be look like "encoding ... 45%" and then it should everytime refresh the percentage.

    And i don't want to use a progressbar. Only if i could disable the green indicator and show only the percentage.


  • Lifetime Qt Champion

    I don't think you can calculate it since ffmpeg is encoding, not your application. You should check which parameters ffmpeg is providing. Maybe it can output the current status as percentage. In this case you can parse the standard output of the ffmpeg process to get the current percentage.

  • Moderators

    There is a switch to ffmpeg that makes it output a line looking like "frame=XXX ..." while it processes. I don't recall the param name. -verbose or -info or something like that. Check the manual.
    Then you would connect to the readyReadStandardOutput signal of QProcess, read the output and parse it for current frame value. Having a total frame count and current frame you can calculate the percentage.

  • @Chris-Kawa thanks for the hint. Works now :)