Skip to content

Commit d59bb7a

Browse files
committed
Bump version
2 parents 562be84 + 697808d commit d59bb7a

File tree

4 files changed

+42
-10
lines changed

4 files changed

+42
-10
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
[![Build status](https://travis-ci.org/kkroening/ffmpeg-python.svg?branch=master)](https://travis-ci.org/kkroening/ffmpeg-python)
44

5+
<img src="https://ibin.co/3g6Z1Duj7SVU.png" alt="ffmpeg-python logo" width="60%" />
56

67
## Overview
78

89
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 complex signal graphs.
910

11+
1012
## Quickstart
1113

1214
Flip a video horizontally:
@@ -86,9 +88,9 @@ pip install ffmpeg-python
8688

8789
It's also possible to clone the source and put it on your python path (`$PYTHONPATH`, `sys.path`, etc.):
8890
```
89-
> git clone git@github.com:kkroening/ffmpeg-python.git
90-
> export PYTHONPATH=${PYTHONPATH}:ffmpeg-python
91-
> python
91+
$ git clone git@github.com:kkroening/ffmpeg-python.git
92+
$ export PYTHONPATH=${PYTHONPATH}:ffmpeg-python
93+
$ python
9294
>>> import ffmpeg
9395
```
9496

@@ -98,8 +100,8 @@ API documentation is automatically generated from python docstrings and hosted o
98100

99101
Alternatively, standard python help is available, such as at the python REPL prompt as follows:
100102
```
101-
import ffmpeg
102-
help(ffmpeg)
103+
>>> import ffmpeg
104+
>>> help(ffmpeg)
103105
```
104106

105107
## Custom Filters
@@ -126,12 +128,16 @@ When in doubt, refer to the [existing filters](https://github.com/kkroening/ffmp
126128

127129
## Contributing
128130

131+
<img align="right" src="https://ibin.co/3g6U1BtizfZG.png" alt="ffmpeg-python logo" width="20%" />
132+
129133
Feel free to report any bugs or feature requests.
130134

131135
It should be fairly easy to use filters that aren't explicitly built into `ffmpeg-python` but if there's a feature or filter you'd really like to see included in the library, don't hesitate to open a feature request.
132136

133137
Pull requests are welcome as well.
134138

139+
<br />
140+
135141
## Additional Resources
136142

137143
- [API Reference](https://kkroening.github.io/ffmpeg-python/)
@@ -140,3 +146,4 @@ Pull requests are welcome as well.
140146
- [FFmpeg Homepage](https://ffmpeg.org/)
141147
- [FFmpeg Documentation](https://ffmpeg.org/ffmpeg.html)
142148
- [FFmpeg Filters Documentation](https://ffmpeg.org/ffmpeg-filters.html)
149+
- Matrix Chat: [#ffmpeg-python:matrix.org](https://riot.im/app/#/room/#ffmpeg-python:matrix.org)

ffmpeg/_filters.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,28 @@ def vflip(stream):
152152
return FilterNode(stream, vflip.__name__).stream()
153153

154154

155+
@filter_operator()
156+
def crop(stream, x, y, width, height, **kwargs):
157+
"""Crop the input video.
158+
159+
Args:
160+
x: The horizontal position, in the input video, of the left edge of
161+
the output video.
162+
y: The vertical position, in the input video, of the top edge of the
163+
output video.
164+
width: The width of the output video. Must be greater than 0.
165+
heigth: The height of the output video. Must be greater than 0.
166+
167+
Official documentation: `crop <https://ffmpeg.org/ffmpeg-filters.html#crop>`__
168+
"""
169+
return FilterNode(
170+
stream,
171+
crop.__name__,
172+
args=[width, height, x, y],
173+
kwargs=kwargs
174+
).stream()
175+
176+
155177
@filter_operator()
156178
def drawbox(stream, x, y, width, height, color, thickness=None, **kwargs):
157179
"""Draw a colored box on the input image.
@@ -395,6 +417,7 @@ def colorchannelmixer(stream, *args, **kwargs):
395417
__all__ = [
396418
'colorchannelmixer',
397419
'concat',
420+
'crop',
398421
'drawbox',
399422
'filter_',
400423
'hflip',

ffmpeg/tests/test_ffmpeg.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def _get_complex_filter_example():
114114
split1 = split[1]
115115

116116
overlay_file = ffmpeg.input(TEST_OVERLAY_FILE)
117+
overlay_file = ffmpeg.crop(overlay_file, 10, 10, 158, 112)
117118
return (ffmpeg
118119
.concat(
119120
split0.trim(start_frame=10, end_frame=20),
@@ -137,10 +138,11 @@ def test_get_args_complex_filter():
137138
'[s1]trim=end_frame=20:start_frame=10[s3];' \
138139
'[s2]trim=end_frame=40:start_frame=30[s4];' \
139140
'[s3][s4]concat=n=2[s5];' \
140-
'[1]hflip[s6];' \
141-
'[s5][s6]overlay=eof_action=repeat[s7];' \
142-
'[s7]drawbox=50:50:120:120:red:t=5[s8]',
143-
'-map', '[s8]', TEST_OUTPUT_FILE1,
141+
'[1]crop=158:112:10:10[s6];' \
142+
'[s6]hflip[s7];' \
143+
'[s5][s7]overlay=eof_action=repeat[s8];' \
144+
'[s8]drawbox=50:50:120:120:red:t=5[s9]',
145+
'-map', '[s9]', TEST_OUTPUT_FILE1,
144146
'-y'
145147
]
146148

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from textwrap import dedent
33
import subprocess
44

5-
version = '0.1.8'
5+
version = '0.1.9'
66
download_url = 'https://github.com/kkroening/ffmpeg-python/archive/v{}.zip'.format(version)
77

88
long_description = dedent("""\

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy