mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-04-02 10:02:48 +08:00
Update readme; bump version; ignore errors in git rev-parse
This commit is contained in:
parent
19809fd0eb
commit
f32ec43b61
4
MANIFEST
4
MANIFEST
@ -2,3 +2,7 @@
|
||||
README
|
||||
setup.py
|
||||
ffmpeg/__init__.py
|
||||
ffmpeg/_ffmpeg.py
|
||||
ffmpeg/_filters.py
|
||||
ffmpeg/_run.py
|
||||
ffmpeg/nodes.py
|
||||
|
55
README.md
55
README.md
@ -58,8 +58,8 @@ in_file = ffmpeg.input('input.mp4')
|
||||
overlay_file = ffmpeg.input('overlay.png')
|
||||
ffmpeg \
|
||||
.concat(
|
||||
in_file.trim(10, 20),
|
||||
in_file.trim(30, 40),
|
||||
in_file.trim(start_frame=10, end_frame=20),
|
||||
in_file.trim(start_frame=30, end_frame=40),
|
||||
) \
|
||||
.overlay(overlay_file.hflip()) \
|
||||
.drawbox(50, 50, 120, 120, color='red', thickness=5) \
|
||||
@ -74,5 +74,54 @@ ffmpeg \
|
||||
Real-world signal graphs can get a heck of a lot more complex, but `ffmpeg-python` handles them with ease.
|
||||
|
||||
|
||||
# [API Reference](https://kkroening.github.io/ffmpeg-python/)
|
||||
## Installation
|
||||
|
||||
The easiest way to acquire the latest version of `ffmpeg-python` is through pip:
|
||||
|
||||
```
|
||||
pip install ffmpeg-python
|
||||
```
|
||||
|
||||
It's also possible to clone the source and make sure it's on your python path (e.g. `$PYTHONPATH`, `sys.path`, etc.):
|
||||
```
|
||||
> git clone git@github.com:kkroening/ffmpeg-python.git
|
||||
> export PYTHONPATH=${PYTHONPATH}:ffmpeg-python
|
||||
> python
|
||||
>>> import ffmpeg
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
API documentation is automatically generated from python docstrings and hosted on github pages: https://kkroening.github.io/ffmpeg-python/
|
||||
|
||||
Alternatively, standard python help is available, such as at the python REPL prompt as follows:
|
||||
```
|
||||
import ffmpeg
|
||||
help(ffmpeg)
|
||||
```
|
||||
|
||||
## Custom filters
|
||||
|
||||
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:
|
||||
```
|
||||
node = ffmpeg.input('dummy.mp4')
|
||||
node = FilterNode([node], 'custom_filter', 'a', 'b', kwarg1='c')
|
||||
node = ffmpeg.output(node, 'dummy2.mp4')
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Please feel free to report any bugs or feature requests.
|
||||
|
||||
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.
|
||||
|
||||
Pull requests are welcome as well.
|
||||
|
||||
## Additional resources
|
||||
|
||||
[FFmpeg Homepage](https://ffmpeg.org/)
|
||||
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg.html)
|
||||
[FFmpeg Filters Documentation](https://ffmpeg.org/ffmpeg-filters.html)
|
||||
[ffmpeg-python API Reference](https://github.com/kkroening/ffmpeg-python/blob/master/ffmpeg/tests/test_ffmpeg.py)
|
||||
[ffmpeg-python Filters](https://github.com/kkroening/ffmpeg-python/blob/master/ffmpeg/_filters.py)
|
||||
[ffmpeg-python Tests](https://github.com/kkroening/ffmpeg-python/blob/master/ffmpeg/tests/test_ffmpeg.py)
|
||||
|
@ -1,3 +1,4 @@
|
||||
from ffmpeg.nodes import operator, FilterNode
|
||||
import ffmpeg
|
||||
import os
|
||||
import pytest
|
||||
@ -137,3 +138,32 @@ def test_run_failing_cmd():
|
||||
node = _get_complex_filter_example()
|
||||
with pytest.raises(subprocess.CalledProcessError):
|
||||
ffmpeg.run(node, cmd='false')
|
||||
|
||||
|
||||
def test_custom_filter():
|
||||
node = ffmpeg.input('dummy.mp4')
|
||||
node = FilterNode([node], 'custom_filter', 'a', 'b', kwarg1='c')
|
||||
node = ffmpeg.output(node, 'dummy2.mp4')
|
||||
assert node.get_args() == [
|
||||
'-i', 'dummy.mp4',
|
||||
'-filter_complex', '[0]custom_filter=a:b:kwarg1=c[v0]',
|
||||
'-map', '[v0]',
|
||||
'dummy2.mp4'
|
||||
]
|
||||
|
||||
|
||||
def test_custom_filter_fluent():
|
||||
@operator()
|
||||
def custom_filter(parent_node, arg1, arg2, kwarg1):
|
||||
return FilterNode([parent_node], 'custom_filter', arg1, arg2, kwarg1=kwarg1)
|
||||
|
||||
node = ffmpeg \
|
||||
.input('dummy.mp4') \
|
||||
.custom_filter('a', 'b', kwarg1='c') \
|
||||
.output('dummy2.mp4')
|
||||
assert node.get_args() == [
|
||||
'-i', 'dummy.mp4',
|
||||
'-filter_complex', '[0]custom_filter=a:b:kwarg1=c[v0]',
|
||||
'-map', '[v0]',
|
||||
'dummy2.mp4'
|
||||
]
|
||||
|
5
setup.py
5
setup.py
@ -5,9 +5,8 @@ import subprocess
|
||||
|
||||
|
||||
def get_current_commit_hash():
|
||||
p = subprocess.Popen(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE)
|
||||
p = subprocess.Popen(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
commit_hash = p.communicate()[0].strip()
|
||||
assert p.returncode == 0, '`git rev-parse HEAD` failed'
|
||||
return commit_hash
|
||||
|
||||
|
||||
@ -67,7 +66,7 @@ keywords = misc_keywords + file_formats + filter_names
|
||||
setup(
|
||||
name = 'ffmpeg-python',
|
||||
packages = ['ffmpeg'],
|
||||
version = '0.1.3',
|
||||
version = '0.1.4',
|
||||
description = 'Python bindings for FFmpeg - with support for complex filtering',
|
||||
author = 'Karl Kroening',
|
||||
author_email = 'karlk@kralnet.us',
|
||||
|
Loading…
x
Reference in New Issue
Block a user