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
🌐
GitHub
github.com › kkroening › ffmpeg-python
GitHub - kkroening/ffmpeg-python: Python bindings for FFmpeg - with complex filtering support · GitHub
error from import ffmpeg? Make sure you ran pip install ffmpeg-python and not pip install ffmpeg (wrong) or pip install python-ffmpeg (also wrong).
Starred by 11K users
Forked by 941 users
Languages   Python
🌐
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
Discussions

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 fps=fps=1 output%d.png ... import ffmpy import os path = './Videos/MyVideos/' for filename in ... More on stackoverflow.com
🌐 stackoverflow.com
How to import ffmpeg into Python?
install python-ffmpeg with pip More on reddit.com
🌐 r/learnpython
2
1
July 18, 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
Ffmpeg-Python: Python bindings for FFmpeg – with complex filtering support
For actual python bindings check out PyAV [0] · ffmpeg -i input.mp4 -i overlay.png -filter_complex "[0]trim=start_frame=10:end_frame=20[v0];\ [0]trim=start_frame=30:end_frame=40[v1];[v0][v1]concat=n=2[v2];[1]hflip[v3];\ [v2][v3]overlay=eof_action=repeat[v4];[v4]drawbox=50:50:120:120:red:t=5[v5]"\ ... More on news.ycombinator.com
🌐 news.ycombinator.com
29
220
December 31, 2019
🌐
Readthedocs
python-ffmpeg.readthedocs.io
python-ffmpeg
from ffmpeg import FFmpeg, Progress def main(): ffmpeg = ( FFmpeg() .option("y") .input( "rtsp://username:password@127.0.0.1/cam", rtsp_transport="tcp", rtsp_flags="prefer_tcp", ) .output("output.mp4", vcodec="copy") ) @ffmpeg.on("progress") def time_to_terminate(progress: Progress): if progress.frame > 200: ffmpeg.terminate() ffmpeg.execute() if __name__ == "__main__": main()
🌐
Bannerbear
bannerbear.com › blog › how-to-use-ffmpeg-in-python-with-examples
How to Use FFMpeg in Python (with Examples) - Bannerbear
Once you have the tools above installed, open up the terminal/command prompt and run the command below in your working directory to install ffmpeg-python in your Python project using pip: ... Then, create a Python file (eg. index.py), import ...
🌐
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?
Find elsewhere
🌐
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 is a powerful open-source multimedia framework used to handle video, audio, and other multimedia files and streams. Combining FFmpeg with Python enables developers to automate media processing workflows and integrate advanced media handling into Python applications.
🌐
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.
🌐
Gumlet
gumlet.com › learn › ffmpeg-python
How to Use FFmpeg with Python in 2026? - Gumlet
January 22, 2026 - One of the most flexible ways to interact with FFmpeg in Python is by using the subprocess module, which allows you to execute FFmpeg commands as if you were running them in a terminal.
🌐
PyPI
pypi.org › project › ffmpeg-python › 0.1.1
ffmpeg-python · PyPI
If you're like me and find Python to be powerful and readable, it's easy with `ffmpeg-python`: ``` import ffmpeg in_file = ffmpeg.file_input(TEST_INPUT_FILE) overlay_file = ffmpeg.file_input(TEST_OVERLAY_FILE) ffmpeg \ .concat( in_file.trim(10, 20), in_file.trim(30, 40), ) \ .overlay(overlay_file.hflip()) \ .drawbox(50, 50, 120, 120, color='red', thickness=5) \ .file_output(TEST_OUTPUT_FILE) \ .run() ``` `ffmpeg-python` takes care of running `ffmpeg` with the command-line arguments that correspond to the above filter diagram, and it's easy to what's going on and make changes as needed.
      » pip install ffmpeg-python
    
Published   May 14, 2017
Version   0.1.1
🌐
Medium
pjcarroll.medium.com › python-and-ffmpeg-2de5d29a4e2c
Python and ffmpeg. Say goodbye to directory woes | by PJ Carroll | Medium
December 26, 2020 - First up, install ffmpeg-python. This is a cracking utility from Karl Kroening: ... I have my video files in a directory called video and an adjacent empty directory called audio. ... import ffmpeg, os print("This takes mp4 files from ./video and converts them into mp3 files in ./audio") print("\nyou are here:\n") current_directory = os.getcwd() print(current_directory + "\n")
🌐
Readthedocs
ffmpy.readthedocs.io › 1.0.0
ffmpy — ffmpy 1.0.0 documentation
At this moment ffmpy has wrappers for ffmpeg and ffprobe commands, but it should be possible to run other FFmpeg tools with it (e.g. ffserver). ... from ffmpy import FFmpeg ff = FFmpeg( inputs={'input.mp4': None}, outputs={'output.avi': None} ) ff.run()
🌐
Cloudinary
cloudinary.com › home › a beginner’s guide to ffmpeg in python
A Beginner’s Guide to FFmpeg in Python | Cloudinary
January 14, 2026 - 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. Splitting a video into its individual frames is useful for tasks like motion analysis, creating animations, or extracting image sequences. FFmpeg can extract frames at a specified rate or all frames, saving them as individual images. import ffmpeg import os def split_video_to_f
🌐
GitHub
github.com › jonghwanhyeon › python-ffmpeg
GitHub - jonghwanhyeon/python-ffmpeg: A python binding for FFmpeg which provides sync and async APIs · GitHub
from ffmpeg import FFmpeg, Progress def main(): ffmpeg = ( FFmpeg() .option("y") .input( "rtsp://username:password@127.0.0.1/cam", rtsp_transport="tcp", rtsp_flags="prefer_tcp", ) .output("output.mp4", vcodec="copy") ) @ffmpeg.on("progress") def time_to_terminate(progress: Progress): if progress.frame > 200: ffmpeg.terminate() ffmpeg.execute() if __name__ == "__main__": main()
Starred by 382 users
Forked by 52 users
Languages   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.
🌐
Json2Video
json2video.com › how-to › ffmpeg-course › ffmpeg-wrappers.html
Best FFMPEG wrappers for Python, Node JS, PHP, Java and .NET developers
February 7, 2022 - Here is a code example: from ... hls.output('/var/media/hls.m3u8') You can install python-ffmpeg-video-streaming using pip package manager....
🌐
Clipcat
clipcat.com › blog › a-beginners-guide-to-using-ffmpeg-in-python-for-video-processing
A Beginner’s Guide to Using FFmpeg in Python for Video Processing - Clipcat
Once you’ve installed them, open your terminal/command prompt and run the following command in your working directory to install ffmpeg-python in your Python project: ... Then, create a Python file (e.g., index.py), import ffmpeg into your code, ...
🌐
Hacker News
news.ycombinator.com › item
Ffmpeg-Python: Python bindings for FFmpeg – with complex filtering support | Hacker News
December 31, 2019 - For actual python bindings check out PyAV [0] · ffmpeg -i input.mp4 -i overlay.png -filter_complex "[0]trim=start_frame=10:end_frame=20[v0];\ [0]trim=start_frame=30:end_frame=40[v1];[v0][v1]concat=n=2[v2];[1]hflip[v3];\ [v2][v3]overlay=eof_action=repeat[v4];[v4]drawbox=50:50:120:120:red:t=5[v5]"\ ...
🌐
PyPI
pypi.org › project › ffmpy
ffmpy · PyPI
It implements a Pythonic interface for FFmpeg command line compilation and uses Python’s subprocess to execute the compiled command line. ffmpy requires Python 3.9 or greater. pip install ffmpy · from ffmpy import FFmpeg ff = FFmpeg( ...
      » pip install ffmpy
    
Published   Nov 11, 2025
Version   1.0.0