10

I'm writing my own wraping for ffmpeg on Python 3.7.2 now and want to use it's "-progress" option to read current progress since it's highly machine-readable. The problem is "-progress" option of ffmpeg accepts as its parameter file names and urls only. But I don't want to create additional files not to setup the whole web-server for this purpose.

I've google a lot about it, but all the "progress bars for ffmpeg" projects rely on generic stderr output of ffmpeg only. Other answers here on Stackoverflow and on Superuser are being satisfied with just "-v quiet -stats", since "progress" is not very convenient name for parameter to google exactly it's cases.

The best solution would be to force ffmpeg write it's "-progress" output to separate pipe, since there is some useful data in stderr as well regarding file being encoded and I don't want to throw it away with "-v quiet". Though if there is a way to redirect "-progress" output to stderr, it would be cool as well! Any pipe would be ok actually, I just can't figure out how to make ffmpeg write it's "-progress" not to file in Windows. I tried "ffmpeg -progress stderr ...", but it just create the file with this name.

username
  • 337
  • 3
  • 11

1 Answers1

18

-progress pipe:1 will write out to stdout, pipe:2 to stderr. If you aren't streaming from ffmpeg, use stdout.

Gyan
  • 85,394
  • 9
  • 169
  • 201
  • This suggests that you could perhaps open file descriptor 3 and pass it in as `pipe:3` but I'm not in a place where I can test this. – tripleee Jan 27 '19 at 08:04
  • 1
    Thank you, this answer is gold. Searched for the usage of the program option everywhere ... without success. – Mr.Epic Fail Feb 26 '19 at 13:24
  • Btw: is the usage of pipe:1 and pipe:2 somewhere documented? Are there any other useful options? – Mr.Epic Fail Feb 26 '19 at 13:32
  • @Mr.EpicFail see [24.20 pipe § ffmpeg Documentation](https://www.ffmpeg.org/ffmpeg-all.html#pipe). – li ki Aug 12 '22 at 15:31