Skip to main content
# 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') \
.run()
```

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

## 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="https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/doc/graph1.png" alt="Signal graph" align="middle" width="50%" />

The corresponding command-line arguments are pretty gnarly:
```
ffmpeg -i input.mp4 \
-filter_complex "\
[0]trim=start_frame=10:end_frame=20,setpts=PTS-STARTPTS[v0];\
[0]trim=start_frame=30:end_frame=40,setpts=PTS-STARTPTS[v1];\
[0]trim=start_frame=50:end_frame=60,setpts=PTS-STARTPTS[v2];\
[v0][v1][v2]concat=n=3[v3]"\
-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') \
ffmpeg.concat(
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') \
.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.

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

Metadata

Release files for ffmpeg-python 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ffmpeg-python 0.1
File Size Uploaded
ffmpeg-python-0.1.tar.gz 3.8 kB Details

Release files / ffmpeg-python-0.1.tar.gz

Download URL ffmpeg-python-0.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8746ecc19243b5df39d5c5735187a7bed5cbe5cc5fd5ed692cc061926a969314
BLAKE2b-256 checksum
How to use checksums
d828293e8398aade2905218a294b0d7456446b51b19a2716a276c1df27596d43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.2.0

2 release files

0.1.17

3 release files

0.1.16

1 release file

0.1.15

1 release file

0.1.14

1 release file

0.1.13

1 release file

0.1.12

1 release file

0.1.11

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page