Considering that pyFFmpeg is just a wrapper over the libraries, I'd say you shouldn't have any negligible performance difference between the 2, since they use the same libraries at the core.

Answer from John Doe on Stack Overflow
🌐
GitHub
github.com › kkroening › ffmpeg-python
GitHub - kkroening/ffmpeg-python: Python bindings for FFmpeg - with complex filtering support · GitHub
Note: ffmpeg-python makes no attempt to download/install FFmpeg, as ffmpeg-python is merely a pure-Python wrapper - whereas FFmpeg installation is platform-dependent/environment-specific, and is thus the responsibility of the user, as described ...
Starred by 11K users
Forked by 940 users
Languages   Python
Discussions

which is the best programing language with a library to write ffmpeg readable commands?
So python has an ffmpeg module which you can use instead of interfacing with the terminal. It's a bit to get used to, it works differently than commands, but you can do a lot once you get the hang of it. Plus it's generally quite readable and you can do whatever else all in python. I've been able to get frames as numpy arrays quite easily to do whatever processing with. https://pypi.org/project/ffmpeg-python/ More on reddit.com
🌐 r/ffmpeg
6
2
October 4, 2024
ffmpeg in python script - Stack Overflow
I would like to run the following command in a python script, I also want to make it loop over several videos in a folder. This is the command I want to run. ffmpeg -i mymovie.avi -f image2 -vf fp... More on stackoverflow.com
🌐 stackoverflow.com
I have trouble converted ffmpeg command to ffmpeg-python - Stack Overflow
However, I have trouble converting this in ffmpeg-python format. More on stackoverflow.com
🌐 stackoverflow.com
How do I integrate the FFMPEG commands with Python Script? - Stack Overflow
But I want to use same command in a Python script, how do I do that and what should be the code? Being an amateur in the field, currently grappling with this! ... I would recommend PyAV. it's a proper wrapper around ffmpeg's libraries. More on stackoverflow.com
🌐 stackoverflow.com
🌐
FFmpeg Python
kkroening.github.io › ffmpeg-python
ffmpeg-python: Python bindings for FFmpeg — ffmpeg-python documentation
The .audio and .video operators can be used to reference the audio/video portions of a stream so that they can be processed separately and then re-combined later in the pipeline. This dilemma is intrinsic to ffmpeg, and ffmpeg-python tries to stay out of the way while users may refer to the official ffmpeg documentation as to why certain filters drop audio.
🌐
Reddit
reddit.com › r/ffmpeg › which is the best programing language with a library to write ffmpeg readable commands?
r/ffmpeg on Reddit: which is the best programing language with a library to write ffmpeg readable commands?
October 4, 2024 -

I'm starting with fmpeg, currently I use it with python, I write the commands as if using the cli, and I create a subprocess to get the result.

But I'm already at a point where I write very long commands and it becomes difficult to read, maintain and reuse.

What is the best programming language with some library that allows me to write them in a way that is easier to read and maintain?

The idea would be to use that language only to write the ffmpeg scripts, either via api, stdout, and continue with python to read the result since I use a lot more things there than ffmpeg.

Thanks

🌐
Bannerbear
bannerbear.com › blog › how-to-use-ffmpeg-in-python-with-examples
How to Use FFMpeg in Python (with Examples) - Bannerbear
The ffmpeg-python library is only a Python wrapper for the FFmpeg installed on your machine and does not work independently.
🌐
Medium
medium.com › @aleksej.gudkov › ffmpeg-python-example-a-guide-to-using-ffmpeg-with-python-020cdb7733e7
FFmpeg Python Example: A Guide to Using FFmpeg with Python | by UATeam | Medium
November 12, 2025 - In this article, we’ll provide a simple and practical example of using FFmpeg with Python to manipulate video and audio files.
🌐
Gumlet
gumlet.com › learn › ffmpeg-python
How to Use FFmpeg with Python in 2026? - Gumlet
January 22, 2026 - While FFmpeg on its own is a powerful command-line utility, integrating it with Python opens up new possibilities, making it a more accessible and flexible solution for developers.
Find elsewhere
🌐
PyPI
pypi.org › project › python-ffmpeg
python-ffmpeg
JavaScript is disabled in your browser. Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Medium
nkugwamarkwilliam.medium.com › the-basics-of-ffmpeg-command-line-javascript-and-python-video-editing-45ab75399560
The Basics of FFmpeg: Command-Line, JavaScript, and Python Video Editing | by Nkugwa Mark William | Medium
July 25, 2023 - It’s renowned for its capabilities to convert and process media files, but it’s more than just a converter. In this article, we’ll walk you through the basics of FFmpeg, then dive deep into editing videos with it using the command-line, JavaScript, and Python.
🌐
Bruno C. Vellutini
brunovellutini.com › posts › native-video-processing-python
Native video processing in Python - Bruno C. Vellutini
March 6, 2025 - Too many for the Cifonauta’s use case. And it’s still a wrapper for FFmpeg. moviepy: Still maintained, but seems more focused on video editing and manipulation than video processing (scaling/converting formats). opencv-python: Looks super-advanced, perhaps too much for what we need.
Top answer
1 of 1
2

The conversion is quite straightforward:

ffmpeg.input('input.mov')\
    .video.filter('zscale', t='linear', npl=100)\
    .filter('format', pix_fmts='gbrpf32le')\
    .filter('zscale', p='bt709')\
    .filter('tonemap', tonemap='hable', desat=0)\
    .filter('zscale', t='bt709', m='bt709', r='tv')\
    .filter('format', pix_fmts='yuv420p')\
    .output('output.mp4', vcodec='libx264', crf=0, preset='ultrafast', tune='fastdecode')\
    .run()

  • Arguments of ffmpeg.input(...) begins with input file name followed by input arguments.
  • .video followed by .filter(...).filter(...).filter(...) applies chain of video filters.
  • filter(...) begins with filter name followed by filter parameters as arguments.
    The syntax is <param_name0>=param_value0, <param_name1>=param_value1...
  • output(...) begins with output file name followed by output arguments.

The only caveat is the format filter.
The parameter name of format filter is pix_fmts (we usually skip it).
One way for getting the parameter name is using FFmpeg help (in command line):

ffmpeg -h filter=format

Output:

Filter format
  Convert the input video to one of the specified pixel formats.
    Inputs:
       #0: default (video)
    Outputs:
       #0: default (video)
(no)format AVOptions:
   pix_fmts          <string>     ..FV....... A '|'-separated list of pixel formats

Here we can see that the parameter name is pix_fmts.


When using ffmpeg-python, it is recommended to add .overwrite_output() (equivalent to -y argument).

For testing it is recommended to add .global_args('-report') for creating a log file (remove .global_args('-report') after finish testing).

ffmpeg.input('input.mov')\
    .video.filter('zscale', t='linear', npl=100)\
    .filter('format', pix_fmts='gbrpf32le')\
    .filter('zscale', p='bt709')\
    .filter('tonemap', tonemap='hable', desat=0)\
    .filter('zscale', t='bt709', m='bt709', r='tv')\
    .filter('format', pix_fmts='yuv420p')\
    .output('output.mp4', vcodec='libx264', crf=0, preset='ultrafast', tune='fastdecode')\
    .global_args('-report').overwrite_output().run()

The log shows us the actual FFmpeg command:

ffmpeg -i input.mov -filter_complex "[0:v]zscale=npl=100:t=linear[s0];[s0]format=pix_fmts=gbrpf32le[s1];[s1]zscale=p=bt709[s2];[s2]tonemap=desat=0:tonemap=hable[s3];[s3]zscale=m=bt709:r=tv:t=bt709[s4];[s4]format=pix_fmts=yuv420p[s5]" -map "[s5]" -crf 0 -preset ultrafast -tune fastdecode -vcodec libx264 output.mp4 -report -y

As you can see, ffmpeg-python uses -filter_complex instead of -vf, and uses temporary naming as [s0], [s1], [s2]...
The result is equivalent to your original command.

🌐
PyPI
pypi.org › project › ffmpeg-python
ffmpeg-python · PyPI
Python bindings for FFmpeg - with complex filtering support
      » pip install ffmpeg-python
    
Published   Jul 06, 2019
Version   0.2.0
🌐
Medium
pjcarroll.medium.com › python-and-ffmpeg-2de5d29a4e2c
Python and ffmpeg. Say goodbye to directory woes | by PJ Carroll | Medium
December 26, 2020 - Yes, I’ve done it with a bash script, thank you, but this is to show you how it’s done in python. ... … and just to make sure you know where you’re going to run the code, here’s the same view from the console: We’re going to run this code from the tmp directory. It’ll go into the video directory, grab each mp4 file, do the conversion stuff and then stick the mp3 version into the audio directory. Clear? First up, install ffmpeg-python.
🌐
Medium
gradient-drift.medium.com › how-to-use-ffmpeg-on-python-2ba3fa360ba7
How to Use FFmpeg on Python?. I often read the python weekly… | by Gradient Drift | Medium
January 5, 2020 - I often read the python weekly Newsletters as my Sunday night routine. To prepare for Monday and to prepare for my future coding project. In the latest newsletter I find this project ffmpeg-python on Github.
Top answer
1 of 3
11

In Windows one line with spaces should work, but in Linux we have to pass the arguments as list.

  • We can build the command as a list:

     command = ['ffmpeg', '-i', 'head1.png', '-i', 'hdmiSpitting.mov', '-filter_complex', '[0:v][1:v]overlay=0:0', '-pix_fmt', 'yuv420p', '-c:a', 'copy', 'output3.mov']
    
  • We may also use shlex.split:

     import shlex
     command = shlex.split('ffmpeg -i head1.png -i hdmiSpitting.mov -filter_complex "[0:v][1:v] overlay=0:0" -pix_fmt yuv420p -c:a copy output3.mov')
    

Adding -y argument:
If the output file output3.mov already exists, FFmpeg prints a message:
File 'output3.mov' already exists. Overwrite? [y/N]
And waits for the user to press y.
In some development environments we can't see the message.
Add -y for overwriting the output if already exists (without asking):

command = shlex.split('ffmpeg -y -i head1.png -i hdmiSpitting.mov -filter_complex "[0:v][1:v] overlay=0:0" -pix_fmt yuv420p -c:a copy output3.mov')

Path issues:
There are cases when ffmpeg executable is not in the execution path.
Using full path may be necessary.
Example for Windows (assuming ffmpeg.exe is in c:\FFmpeg\bin):

command = shlex.split('c:\\FFmpeg\\bin\\ffmpeg.exe -y -i head1.png -i hdmiSpitting.mov -filter_complex "[0:v][1:v] overlay=0:0" -pix_fmt yuv420p -c:a copy output3.mov')

In Linux, the default path is /usr/bin/ffmpeg.


Using shell=True is not recommended and considered "unsafe".
For details see Security Considerations.
The default is False, so we may use subprocess.call(command).

Note: subprocess.run supposes to replace subprocess.call.
See this post for details.


Creating log file by adding -report argument:
In some development environments we can't see FFmpeg messages, which are printed to the console (written to stderr).
Adding -report argument creates a log file with name like ffmpeg-20220624-114156.log.
The log file may tell us what went wrong when we can't see the console.

Example:

import subprocess
import shlex
subprocess.run(shlex.split('ffmpeg -y -i head1.png -i hdmiSpitting.mov -filter_complex "[0:v][1:v] overlay=0:0" -pix_fmt yuv420p -c:a copy output3.mov -report'))
2 of 3
3

I ended up using os.system() instead of subprocess and got the results I wanted before returning to see answers on this question. The answer from Rotem is incredibly useful and does solve my issue as well, with the added information of -y parameter.

I'll paste my entire code here, as it may be useful to someone in the future.

import os

os.chdir('/Users/Todd/Desktop/ffmpeg')
background = "01Background/Untitled_Artwork7.png"
backgear = "02Backgear/Surfboard-01.png"
head = "03Head/Goldhead_Goldshell1.png"
eye = "04eye/Keye-01.png"
outfit = "05Outfit/Summershirt-01.png"
headgear = "06Headgear/PopejoyHair_Goldshell1.png"
mouth = "hdmiSpitting.mov"
frontgear = "08Frontgear/TreePot-01.png"


# takes a list of 3 or more files and creates ffmpeg command to overlay them in order
# the first element in the list will be the lowest Z element (farthest back)
def generateCommand(files = []):
    command = "ffmpeg"
    i = 0
    count = 0
    alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o"]
    for file in files:
        command += " -i " + file
        count += 1
    command += " -filter_complex \"[0][1]overlay[a];["
    while i < count-3: 
        command += alphabet[i] + "][" + str(i+2) + "]overlay[" + alphabet[i+1] + "];["
        i += 1
    command += alphabet[i] + "][" + str(i+2) + "]overlay\""
    command += " -pix_fmt yuv420p -c:a copy output3.mov"
    return command

# Takes two files and overlays file1 over file2
# This is a separate function because of the different command syntax for less than 3 files
def overlayTwoLayers(file1, file2):
    command = "ffmpeg -i " + file1 + " -i " + file2 + " -filter_complex \"[0:v][1:v] overlay=0:0\" -pix_fmt yuv420p -c:a copy output3.mov"
    os.system(command)

# Call this function with a list of files you want to be compiled
def generateImage(files):
    command = generateCommand(files)
    os.system(command)

files = []
files.append(background)
files.append(backgear)
files.append(head)
files.append(eye)
files.append(outfit)
files.append(headgear)
files.append(mouth)
files.append(frontgear)

generateImage(files)


print("done")
🌐
Stack Overflow
stackoverflow.com › questions › 53702183 › do-ffmpeg-python-and-ffmpy-are-system-version-independent
Do ffmpeg-python and ffmpy are system version independent? - Stack Overflow
I am making a python-based software that actually uses my Window's ffmpeg version. But I am thinking about to make it crossplatform, so, I heard that youtube-dl uses ffmpeg, so I want to know what ...
🌐
LibHunt
libhunt.com › compare-ffmpeg-python-vs-FFmpeg
ffmpeg-python vs FFmpeg - compare differences and reviews? | LibHunt
Even given an option it can be difficult to find the corresponding documentation, if only because of the many different submodules and encoders and decoders and filters that have o-so-slightly different options. That said, I've just switched from pydub to ffmpeg-python (due to memory issues of the former[1]) and judging from the Jupiter notebook[2] it seems a much more intuitive method of constructing ffmpeg pipelines.
🌐
LibHunt
libhunt.com › compare-moviepy-vs-ffmpeg-python
moviepy vs ffmpeg-python - compare differences and reviews? | LibHunt
Even given an option it can be difficult to find the corresponding documentation, if only because of the many different submodules and encoders and decoders and filters that have o-so-slightly different options. That said, I've just switched from pydub to ffmpeg-python (due to memory issues of the former[1]) and judging from the Jupiter notebook[2] it seems a much more intuitive method of constructing ffmpeg pipelines.