Skip to main content

FFmpeg Python wrapper with support for complex filtering

Project description

# ffmpeg-python: FFmpeg Python wrapper with support for complex filtering

## Overview

There are tons of Python FFmpeg wrappers out there but they seem to lack complex filter support. `ffmpeg-python` works well for simple as well as complicated signal graphs.

## Quickstart

import ffmpeg
ffmpeg \
.file_input('input.mp4') \
.file_output('output.mp4') \

Or if you prefer a non-fluent interface:
import ffmpeg
in = ffmpeg.file_input('input.mp4')
out = ffmpeg.file_output(in)

## Complex filter graphs
FFmpeg is extremely powerful, but it's command-line interface gets really complicated really quickly - especially when working with signal graphs and doing anything more than trivial.

Take for example a signal graph that looks like this:

<img src="" alt="Signal graph" align="middle" width="50%" />

The corresponding command-line arguments are pretty gnarly:
ffmpeg -i input.mp4 \
-filter_complex "\
-map [v3] output.mp4

Maybe this looks great to you, but if you haven't worked with FFmpeg before, it probably looks pretty alien.

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('input.mp4') \
in_file.trim(start_frame=10, end_frame=20),
in_file.trim(start_frame=30, end_frame=40),
in_file.trim(start_frame=50, end_frame=60)
) \
.file_output('output.mp4') \

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

Real-world signal graphs can get a heck of a lot more complex, but `ffmpeg-python` handles them with ease.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ffmpeg-python-0.1.tar.gz (3.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page