8000 Update readme; bump version; ignore errors in `git rev-parse` · Powercoder64/ffmpeg-python@f32ec43 · GitHub
[go: up one dir, main page]

Skip to content

Commit f32ec43

Browse files
committed
Update readme; bump 8000 version; ignore errors in git rev-parse
1 parent 19809fd commit f32ec43

File tree

4 files changed

+88
-6
lines changed

4 files changed

+88
-6
lines changed

MANIFEST

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
README
33
setup.py
44
ffmpeg/__init__.py
5+
ffmpeg/_ffmpeg.py
6+
ffmpeg/_filters.py
7+
ffmpeg/_run.py
8+
ffmpeg/nodes.py

README.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ in_file = ffmpeg.input('input.mp4')
5858
overlay_file = ffmpeg.input('overlay.png')
5959
ffmpeg \
6060
.concat(
61-
in_file.trim(10, 20),
62-
in_file.trim(30, 40),
61+
in_file.trim(start_frame=10, end_frame=20),
62+
in_file.trim(start_frame=30, end_frame=40),
6363
) \
6464
.overlay(overlay_file.hflip()) \
6565
.drawbox(50, 50, 120, 120, color='red', thickness=5) \
@@ -74,5 +74,54 @@ ffmpeg \
7474
Real-world signal graphs can get a heck of a lot more complex, but `ffmpeg-python` handles them with ease.
7575

7676

77-
# [API Reference](https://kkroening.github.io/ffmpeg-python/)
77+
## Installation
7878

79+
The easiest way to acquire the latest version of `ffmpeg-python` is through pip:
80+
81+
```
82+
pip install ffmpeg-python
83+
```
84+
85+
It's also possible to clone the source and make sure it's on your python path (e.g. `$PYTHONPATH`, `sys.path`, etc.):
86+
```
87+
> git clone git@github.com:kkroening/ffmpeg-python.git
88+
> export PYTHONPATH=${PYTHONPATH}:ffmpeg-python
89+
> python
90+
>>> import ffmpeg
91+
```
92+
93+
## API Reference
94+
95+
API documentation is automatically generated from python docstrings and hosted on github pages: https://kkroening.github.io/ffmpeg-python/
96+
97+
Alternatively, standard python help is available, such as at the python REPL prompt as follows:
98+
```
99+
import ffmpeg
100+
help(ffmpeg)
101+
```
102+
103+
## Custom filters
104+
105+
Don't see the filter you're looking for? `ffmpeg-python` is a work in progress, but it's easy to use any arbitrary ffmpeg filter:
106+
```
107+
node = ffmpeg.input('dummy.mp4')
108+
node = FilterNode([node], 'custom_filter', 'a', 'b', kwarg1='c')
109+
node = ffmpeg.output(node, 'dummy2.mp4')
110+
```
111+
112+
## Contributing
113+
114+
Please feel free to report any bugs or feature requests.
115+
116+
It should be fairly easy to use filters that aren't explicitly built into `ffmpeg-python` but if there's a filter you'd really like to see included in the library, don't hesitate to open a feature request in GitHub.
117+
118+
Pull requests are welcome as well.
119+
120+
## Additional resources
121+
122+
[FFmpeg Homepage](https://ffmpeg.org/)
123+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg.html)
124+
[FFmpeg Filters Documentation](https://ffmpeg.org/ffmpeg-filters.html)
125+
[ffmpeg-python API Reference](https://github.com/kkroening/ffmpeg-python/blob/master/ffmpeg/tests/test_ffmpeg.py)
126+
[ffmpeg-python Filters](https://github.com/kkroening/ffmpeg-python/blob/master/ffmpeg/_filters.py)
127+
[ffmpeg-python Tests](https://github.com/kkroening/ffmpeg-python/blob/master/ffmpeg/tests/test_ffmpeg.py)

ffmpeg/tests/test_ffmpeg.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from ffmpeg.nodes import operator, FilterNode
12
import ffmpeg
23
import os
34
import pytest
@@ -137,3 +138,32 @@ def test_run_failing_cmd():
137138
node = _get_complex_filter_example()
138139
with pytest.raises(subprocess.CalledProcessError):
139140
ffmpeg.run(node, cmd='false')
141+
142+
143+
def test_custom_filter():
144+
node = ffmpeg.input('dummy.mp4')
145+
node = FilterNode([node], 'custom_filter', 'a', 'b', kwarg1='c')
146+
node = ffmpeg.output(node, 'dummy2.mp4')
147+
assert node.get_args() == [
148+
'-i', 'dummy.mp4',
149+
'-filter_complex', '[0]custom_filter=a:b:kwarg1=c[v0]',
150+
'-map', '[v0]',
151+
'dummy2.mp4'
152+
]
153+
154+
155+
def test_custom_filter_fluent():
156+
@operator()
157+
def custom_filter(parent_node, arg1, arg2, kwarg1):
158+
return FilterNode([parent_node], 'custom_filter', arg1, arg2, kwarg1=kwarg1)
159+
160+
node = ffmpeg \
161+
.input('dummy.mp4') \
162+
.custom_filter('a', 'b', kwarg1='c') \
163+
.output('dummy2.mp4')
164+
assert node.get_args() == [
165+
'-i', 'dummy.mp4',
166+
'-filter_complex', '[0]custom_filter=a:b:kwarg1=c[v0]',
167+
'-map', '[v0]',
168+
'dummy2.mp4'
169+
]

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55

66

77
def get_current_commit_hash():
8-
p = subprocess.Popen(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE)
8+
p = subprocess.Popen(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
99
commit_hash = p.communicate()[0].strip()
10-
assert p.returncode == 0, '`git rev-parse HEAD` failed'
1110
return commit_hash
1211

1312

@@ -67,7 +66,7 @@ def get_current_commit_hash():
6766
setup(
6867
name = 'ffmpeg-python',
6968
packages = ['ffmpeg'],
70-
version = '0.1.3',
69+
version = '0.1.4',
7170
description = 'Python bindings for FFmpeg - with support for complex filtering',
7271
author = 'Karl Kroening',
7372
author_email = 'karlk@kralnet.us',

0 commit comments

Comments
 (0)
0