Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect -progress option output of ffmpeg to stderr?

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.

like image 736
username Avatar asked Jan 27 '19 06:01

username


People also ask

How do I redirect to stderr?

The regular output is sent to Standard Out (STDOUT) and the error messages are sent to Standard Error (STDERR). When you redirect console output using the > symbol, you are only redirecting STDOUT. In order to redirect STDERR, you have to specify 2> for the redirection symbol.

How do I redirect stderr and stdout to a file?

Redirecting stdout and stderr to a file: The I/O streams can be redirected by putting the n> operator in use, where n is the file descriptor number. For redirecting stdout, we use “1>” and for stderr, “2>” is added as an operator. We have created a file named “sample.

How do I send stderr to Dev Null?

You can send output to /dev/null, by using command >/dev/null syntax. However, this will not work when command will use the standard error (FD # 2). So you need to modify >/dev/null as follows to redirect both output and errors to /dev/null.


1 Answers

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

like image 185
Gyan Avatar answered Oct 23 '22 12:10

Gyan