From a brief look at FFMPY, you could do this using ffmpy.FFmpeg, as that allows any and all FFMPEG command line options, including -f. -- Click the link for documentation.

You could do the FFMPEG command with os.system. You'll need to import OS anyway to iterate through the files.

You would need to iterate through all the files in a directory though. This would be the more challenging bit, it's quite easy with a for loop though.

for filename in os.listdir(path):
    if (filename.endswith(".mp4")): #or .avi, .mpeg, whatever.
        os.system("ffmpeg -i {0} -f image2 -vf fps=fps=1 output%d.png".format(filename))
    else:
        continue

The above code iterates through the directory at path, and uses command prompt to execute your given FFMPEG command, using the filename (if it's a video file) in place of mymovie.avi

Answer from ocelot on Stack Overflow
🌐
Bannerbear
bannerbear.com › blog › how-to-use-ffmpeg-in-python-with-examples
How to Use FFMpeg in Python (with Examples) - Bannerbear
In this article, we are going to learn how to use FFmpeg, a popular media manipulation tool in Python to work with media files, showing some practical examples.
🌐
GitHub
github.com › kkroening › ffmpeg-python
GitHub - kkroening/ffmpeg-python: Python bindings for FFmpeg - with complex filtering support · GitHub
See the Examples README for additional examples. Don't see the filter you're looking for? While ffmpeg-python includes shorthand notation for some of the most commonly used filters (such as concat), all filters can be referenced via the .filter operator:
Starred by 11K users
Forked by 940 users
Languages   Python
Discussions

Editing videos using the ffmpeg and ffprobe module in python
I am working on an ETL process, and I’m now in the final stage of preprocessing my videos. I used the script below (reference: @FarisHijazi) to first auto detected black-screen frames using ffprobe and trim them out using ffmpeg. The script worked for me but the problems are: It cut off all ... More on discuss.python.org
🌐 discuss.python.org
1
0
August 11, 2022
How to import ffmpeg with python - Help - Pipedream
I want to use pydub, but I get a path error and figured that I have to install ffmpeg. Can somebody help me to set it up? More on pipedream.com
🌐 pipedream.com
0
September 20, 2024
A script to batch convert media with ffmpeg
Related: I always recommend https://ffmpeg.app/ to explore the command line arguments you need for ffmpeg. It's a great and free tool. More on reddit.com
🌐 r/Python
9
August 3, 2024
Python + FFMPEG : read and write any Audio/Video format with just a few lines of code.
What advantage is there using this than something like https://code.google.com/p/pyffmpeg/ More on reddit.com
🌐 r/Python
30
123
October 5, 2013
🌐
FFmpeg Python
kkroening.github.io › ffmpeg-python
ffmpeg-python: Python bindings for FFmpeg — ffmpeg-python documentation
These parameters allow the x and y expressions to refer each other, so you can for example specify y=x/dar. ... Apply custom filter. filter_ is normally used by higher-level filter functions such as hflip, but if a filter implementation is missing from ffmpeg-python, you can call filter_ directly to have ffmpeg-python pass the filter name and arguments to ffmpeg verbatim.
🌐
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 - FFmpeg Python Library Install ffmpeg-python, a Python wrapper for FFmpeg: ... In this example, we’ll convert a video from one format to another (e.g., MP4 to AVI) using ffmpeg-python.
🌐
GitHub
github.com › kkroening › ffmpeg-python › blob › master › examples › README.md
ffmpeg-python/examples/README.md at master · kkroening/ffmpeg-python
process1 = ( ffmpeg .input(in_filename) .output('pipe:', format='rawvideo', pix_fmt='rgb24', vframes=8) .run_async(pipe_stdout=True) ) process2 = ( ffmpeg .input('pipe:', format='rawvideo', pix_fmt='rgb24', s='{}x{}'.format(width, height)) .output(out_filename, pix_fmt='yuv420p') .overwrite_output() .run_async(pipe_stdin=True) ) while True: in_bytes = process1.stdout.read(width * height * 3) if not in_bytes: break in_frame = ( np .frombuffer(in_bytes, np.uint8) .reshape([height, width, 3]) ) # See examples/tensorflow_stream.py: out_frame = deep_dream.process_frame(in_frame) process2.stdin.write( out_frame .astype(np.uint8) .tobytes() ) process2.stdin.close() process1.wait() process2.wait()
Author   kkroening
Find elsewhere
🌐
Python.org
discuss.python.org › python help
Editing videos using the ffmpeg and ffprobe module in python - Python Help - Discussions on Python.org
August 11, 2022 - I am working on an ETL process, and I’m now in the final stage of preprocessing my videos. I used the script below (reference: @FarisHijazi) to first auto detected black-screen frames using ffprobe and trim them out usin…
🌐
Readthedocs
python-ffmpeg.readthedocs.io
python-ffmpeg
from ffmpeg import FFmpeg def main(): ffmpeg = ( FFmpeg() .option("y") .input("input.mp4") .output( "output.mp4", {"codec:v": "libx264"}, vf="scale=1280:-1", preset="veryslow", crf=24, ) ) ffmpeg.execute() if __name__ == "__main__": main()
🌐
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
🌐
Pipedream
pipedream.com › help
How to import ffmpeg with python - Help - Pipedream
September 20, 2024 - I want to use pydub, but I get a path error and figured that I have to install ffmpeg. Can somebody help me to set it up?
🌐
Reddit
reddit.com › r/python › a script to batch convert media with ffmpeg
r/Python on Reddit: A script to batch convert media with ffmpeg
August 3, 2024 -

What My Project Does

This is a Python script that batch-processes videos using ffmpeg. The script evaluates the list of input files and directories provided and converts all files to the specified output directory. The conversion is done with ffmpeg using the command line argument from one of the available presets.

It also provides a nice formatted output to the console with colors and progress bars.

Target Audience

Myself and any other that has a bunch of media to transcode

Comparison

Better than a batch file, there are colored progress bars to stare at for hours while the media is converted.

GitHub

https://github.com/ts-manuel/ffmpeg-batch

🌐
Cloudinary
cloudinary.com › home › a beginner’s guide to ffmpeg in python
A Beginner’s Guide to FFmpeg in Python | Cloudinary
August 2, 2025 - The above example writes all input video file paths to a temporary file called “input.txt” in the format required by FFmpeg’s concat demuxer (each line contains file 'filename'). Then Python’s subprocess module is used to execute the command which reads the list of files from the text file and concatenates them.
🌐
Reddit
reddit.com › r/python › python + ffmpeg : read and write any audio/video format with just a few lines of code.
r/Python on Reddit: Python + FFMPEG : read and write any Audio/Video format with just a few lines of code.
October 5, 2013 - (image = [[(R, G, B), (R, G, B)], [(R, G, B), (R, G, B)]] a 2x2 pivel image example) ... Try SimpleCV, it really does that very well. Its only flaw is that it relies on OpenCV, which is heavy and not always easy to install. ... Doing that with FFMPEG will certainly be my next exploration (but it seems that the ffmpeg syntax to read a webcam is platform-dependent ) ... Actually, the input will be a string in python, of the form "RGBRGBRGBRGB..." where R,G,B are each one character (one byte) that gives a value between 0 and 255.
🌐
Medium
pjcarroll.medium.com › python-and-ffmpeg-2de5d29a4e2c
Python and ffmpeg. Say goodbye to directory woes | by PJ Carroll | Medium
December 26, 2020 - We’re going to iterate through all the files in current_directory/video, run ffmpeg on it, split off the name part (see above), rename it .mp3 and put it into current_directory/audio.
🌐
Gumlet
gumlet.com › learn › ffmpeg-python
How to Use FFmpeg with Python in 2026? - Gumlet
January 22, 2026 - If your primary use case involves audio manipulation, pydub is a Python library that simplifies working with audio files through FFmpeg. With pydub, you don’t need to deal with raw FFmpeg commands, as it abstracts most of the complexity while still leveraging FFmpeg’s capabilities in the background. Here’s an example of how to use pydub to trim an audio file:
🌐
ProgramCreek
programcreek.com › python › example › 117479 › ffmpeg.output
Python Examples of ffmpeg.output
def test_filter_concat__audio_only(): in1 = ffmpeg.input('in1.mp4') in2 = ffmpeg.input('in2.mp4') args = ffmpeg.concat(in1, in2, v=0, a=1).output('out.mp4').get_args() assert args == [ '-i', 'in1.mp4', '-i', 'in2.mp4', '-filter_complex', '[0][1]concat=a=1:n=2:v=0[s0]', '-map', '[s0]', 'out.mp4', ] ... def _get_complex_filter_asplit_example(): split = ffmpeg.input(TEST_INPUT_FILE1).vflip().asplit() split0 = split[0] split1 = split[1] return ( ffmpeg.concat( split0.filter('atrim', start=10, end=20), split1.filter('atrim', start=30, end=40), ) .output(TEST_OUTPUT_FILE1) .overwrite_output() )
🌐
PyPI
pypi.org › project › ffmpeg-python
ffmpeg-python · PyPI
Tags -vf , a/v , audio , dsp , FFmpeg , ffmpeg , ffprobe , filtering , filter_complex , movie , render , signals , sound , streaming , streams , vf , video , wrapper , aac , ac3 , avi , bmp , flac , gif , mov , mp3 , mp4 , png , raw , rawvideo , wav , .aac , .ac3 , .avi , .bmp , .flac , .gif , .mov , .mp3 , .mp4 , .png , .raw , .rawvideo , .wav
      » pip install ffmpeg-python
    
Published   Jul 06, 2019
Version   0.2.0
🌐
Json2Video
json2video.com › how-to › ffmpeg-course › ffmpeg-wrappers.html
Best FFMPEG wrappers for Python, Node JS, PHP, Java and .NET developers
January 26, 2024 - As said, ffmpeg-python is probably the most popular and used Python wrappers out there. This one claims to be the best in terms of complex filter support, working really well for simple and complex operations. This is an example code of ffmpeg-python flipping horizontally a video: