Contact Us

A progress bar with eta for FFmpeg using Python

Reading Time: 2 min

Tags:  Programming

Presenting FFprogress, a Python program for showing a progress bar for FFmpeg. It uses the python library tqdm to show the progress bar.

FFprogress in action in Windows
FFprogress in Windows 10

I have not tested it properly in Linux; it seems to work.

FFprogress in action in Linux
FFprogress in Lubuntu

Limitations

FFprogress has the following limitations.

Possible Unicode problem on Windows

The Unicode version of tqdm might not work on Windows. It depends on the font and font-size of the console window. You can read more about it here. The new Windows Terminal does not seem to have this problem.

If Unicode doesn’t work, you will have to do with ASCII. This how that looks.

ASCII version of FFprogress
The ASCII version

To use ASCII instead of Unicode, do the following. Open the file progress.py. Comment out the line self.pbar = tqdm(total=100), and uncomment the line self.pbar = tqdm(total=100,ascii=True). The lines in question should look like this after the change.

1#self.pbar = tqdm(total=100)
2self.pbar = tqdm(total=100,ascii=True)

Runs in non-interactive mode

FFprogress does not support the interactive mode of FFmpeg. Hence FFmpeg is run with the –nostdin switch.

Only basic input supported

It works properly only with simple single-file input and output. Even something that seems simple like combining multiple input files, does not work. This is because FFprogress does not do any command-line parsing. It simply hands over the command supplied by the user to FFmpeg. It relies on the console output of FFmpeg. When there are multiple input files, FFmpeg reports the duration of only the first file as the duration, instead of reporting the total duration.

Requirements

Requires Python 3.6 or above and tqdm library.

Download

Download from here: https://github.com/anieshav/ffprogress

How to run

FFprogress can be run by supplying main.py as an argument to Python along with the FFmpeg arguments. Please refer to the images above. It would be easier to create a batch file or a script to run FFprogress. Then put it somewhere in the system path. A sample batch file might look something like this.

1python D:\Python\Projects\FFProgress\main.py %*

After this, you can run FFprogress the same way you run FFmpeg.

Share