Repolode
kkroening

kkroening/ffmpeg-python

Python bindings that build and run FFmpeg command lines from chained Python calls, including complex filter graphs.

Stars
11,015
Forks
948
Open issues
524
Last commit
2 years ago

What is it?

ffmpeg-python is a pure-Python wrapper around the FFmpeg command-line tool. Instead of writing long FFmpeg argument strings by hand, you chain Python calls such as input, filter, and output, and the library generates the matching ffmpeg command and runs it.

Its main strength is complex filter graphs. Streams can be split, trimmed, concatenated, overlaid, and passed through any FFmpeg filter, either through named helper methods or the generic filter operator. The library handles graphs of arbitrary size as long as they are directed acyclic graphs. Developers can inspect the generated arguments with get_args() or compile() before running.

FFmpeg must be installed separately and available on the PATH, since the package only builds commands and does not download the binary.

Key features

  • 01Builds ffmpeg commands from chained Python calls.
  • 02Supports complex filter graphs with splitting, concatenation, and overlays.
  • 03Exposes any FFmpeg filter through a generic filter method.
  • 04Lets you preview generated arguments with get_args() or compile().
  • 05Installable with pip and works with any FFmpeg build on the PATH.

Use cases

  • Batch-transforming videos in a Python data or media pipeline.
  • Generating thumbnails or extracting frames from video files.
  • Reading raw audio or video frames into NumPy arrays through a pipe.
  • Building multi-input overlay or concatenation workflows without hand-writing filter strings.

Quick start

  1. 1

    Install FFmpeg itself (e.g. via your package manager)

  2. 2

    Install the Python package from PyPI

    pip install ffmpeg-python
  3. 3

    Flip a video horizontally with the fluent interface

Things to know

  • FFmpeg must be installed separately; the package does not install it.
  • Some filters drop audio streams, so the audio/video operators may be needed.

Topics

FAQ

What is ffmpeg-python?
Python bindings that build and run FFmpeg command lines from chained Python calls, including complex filter graphs. ffmpeg-python is a pure-Python wrapper around the FFmpeg command-line tool. Instead of writing long FFmpeg argument strings by hand, you chain Python calls such as input, filter, and output, and the library generates the matching ffmpeg command and runs it.
Is ffmpeg-python free to use? What license does it have?
ffmpeg-python is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is ffmpeg-python still maintained?
No commits for 6+ months. The last commit to ffmpeg-python was on Aug 4, 2024.
What can I use ffmpeg-python for?
Batch-transforming videos in a Python data or media pipeline. Generating thumbnails or extracting frames from video files. Reading raw audio or video frames into NumPy arrays through a pipe. Building multi-input overlay or concatenation workflows without hand-writing filter strings.
How do I install ffmpeg-python?
Install FFmpeg itself (e.g. via your package manager) Install the Python package from PyPI: pip install ffmpeg-python Flip a video horizontally with the fluent interface
Where can I get ffmpeg-python?
The source code and installation instructions are on GitHub: https://github.com/kkroening/ffmpeg-python

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects