ffmpy is a Python wrapper for FFmpeg. It compiles FFmpeg command line from provided arguments and their respective options and executes it using Python’s subprocess.

ffmpy resembles the command line approach FFmpeg uses. It can read from an arbitrary number of input “files” (regular files, pipes, network streams, grabbing devices, etc.) and write into arbitrary number of output “files”. See FFmpeg documentation for further details about how FFmpeg command line options and arguments work.

ffmpy supports FFmpeg pipe protocol. This means that it is possible to pass input data to stdin and get output data from stdout.

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).


pip install ffmpy


>>> import ffmpy
>>> ff = ffmpy.FFmpeg(
...     inputs={'input.mp4': None},
...     outputs={'output.avi': None}
... )
>>> ff.run()

This takes input.mp4 file in the current directory as the input, changes the video container from MP4 to AVI without changing any other video parameters and creates a new output file output.avi in the current directory.