typed-ffmpeg-compatible 2.4.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- typed_ffmpeg_compatible-2.4.1/LICENSE +21 -0
- typed_ffmpeg_compatible-2.4.1/PKG-INFO +182 -0
- typed_ffmpeg_compatible-2.4.1/README.md +152 -0
- typed_ffmpeg_compatible-2.4.1/pyproject.toml +102 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/__init__.py +25 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/base.py +114 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/common/__init__.py +0 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/common/schema.py +308 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/common/serialize.py +132 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/__init__.py +13 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/compile.py +51 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/context.py +221 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/factory.py +31 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/global_runnable/__init__.py +0 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/global_runnable/global_args.py +178 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/global_runnable/runnable.py +174 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/io/__init__.py +0 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/io/_input.py +197 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/io/_output.py +320 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/io/output_args.py +327 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/nodes.py +479 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/schema.py +210 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/utils.py +41 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/dag/validate.py +172 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/exceptions.py +42 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/filters.py +3572 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/probe.py +43 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/py.typed +0 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/schema.py +29 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/streams/__init__.py +5 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/streams/audio.py +7358 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/streams/av.py +22 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/streams/channel_layout.py +39 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/streams/video.py +13469 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/types.py +119 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/utils/__init__.py +0 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/utils/escaping.py +49 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/utils/lazy_eval/__init__.py +0 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/utils/lazy_eval/operator.py +134 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/utils/lazy_eval/schema.py +211 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/utils/run.py +27 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/utils/snapshot.py +26 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/utils/typing.py +17 -0
- typed_ffmpeg_compatible-2.4.1/src/typed_ffmpeg/utils/view.py +64 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 livingbio
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,182 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: typed-ffmpeg-compatible
|
3
|
+
Version: 2.4.1
|
4
|
+
Summary: Modern Python FFmpeg wrappers offer comprehensive support for complex filters, complete with detailed typing and documentation.
|
5
|
+
Home-page: https://livingbio.github.io/typed-ffmpeg/
|
6
|
+
License: MIT
|
7
|
+
Keywords: ffmpeg,video,audio,multimedia,filter
|
8
|
+
Author: lucemia
|
9
|
+
Author-email: lucemia@gmail.com
|
10
|
+
Requires-Python: >=3.10,<4.0
|
11
|
+
Classifier: Intended Audience :: Developers
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
13
|
+
Classifier: Natural Language :: English
|
14
|
+
Classifier: Operating System :: OS Independent
|
15
|
+
Classifier: Programming Language :: Python
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
20
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
21
|
+
Classifier: Topic :: Multimedia :: Video
|
22
|
+
Classifier: Topic :: Software Development :: Libraries
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
25
|
+
Provides-Extra: graph
|
26
|
+
Requires-Dist: graphviz ; extra == "graph"
|
27
|
+
Project-URL: Repository, https://github.com/livingbio/typed-ffmpeg
|
28
|
+
Description-Content-Type: text/markdown
|
29
|
+
|
30
|
+
## typed-ffmpeg
|
31
|
+
|
32
|
+
[](https://github.com/livingbio/typed-ffmpeg/actions?query=workflow%3Aci-package)
|
33
|
+
[](https://livingbio.github.io/typed-ffmpeg/)
|
34
|
+
[](https://pypi.org/project/typed-ffmpeg/)
|
35
|
+
[](https://codecov.io/gh/livingbio/typed-ffmpeg)
|
36
|
+
|
37
|
+
**typed-ffmpeg** offers a modern, Pythonic interface to FFmpeg, providing extensive support for complex filters with detailed typing and documentation. Inspired by `ffmpeg-python`, this package enhances functionality by addressing common limitations, such as lack of IDE integration and comprehensive typing, while also introducing new features like JSON serialization of filter graphs and automatic FFmpeg validation.
|
38
|
+
|
39
|
+
---
|
40
|
+
|
41
|
+
### Table of Contents
|
42
|
+
|
43
|
+
- [Features](#features)
|
44
|
+
- [Installation](#installation)
|
45
|
+
- [Quick Usage](#quick-usage)
|
46
|
+
- [Documentation](https://livingbio.github.io/typed-ffmpeg/)
|
47
|
+
- [Acknowledgements](#acknowledgements)
|
48
|
+
|
49
|
+
---
|
50
|
+
|
51
|
+
## Features
|
52
|
+
|
53
|
+

|
54
|
+
|
55
|
+
|
56
|
+
- **Zero Dependencies:** Built purely with the Python standard library, ensuring maximum compatibility and security.
|
57
|
+
- **User-Friendly:** Simplifies the construction of filter graphs with an intuitive Pythonic interface.
|
58
|
+
- **Comprehensive FFmpeg Filter Support:** Out-of-the-box support for most FFmpeg filters, with IDE auto-completion.
|
59
|
+
- **Integrated Documentation:** In-line docstrings provide immediate reference for filter usage, reducing the need to consult external documentation.
|
60
|
+
- **Robust Typing:** Offers static and dynamic type checking, enhancing code reliability and development experience.
|
61
|
+
- **Filter Graph Serialization:** Enables saving and reloading of filter graphs in JSON format for ease of use and repeatability.
|
62
|
+
- **Graph Visualization:** Leverages `graphviz` for visual representation, aiding in understanding and debugging.
|
63
|
+
- **Validation and Auto-correction:** Assists in identifying and fixing errors within filter graphs.
|
64
|
+
- **Input and Output Options Support:** Provide a more comprehensive interface for input and output options, including support for additional codecs and formats.
|
65
|
+
- **Partial Evaluation:** Enhance the flexibility of filter graphs by enabling partial evaluation, allowing for modular construction and reuse.
|
66
|
+
|
67
|
+
### Planned Features
|
68
|
+
|
69
|
+
Please note that the following features are under consideration or development for future releases:
|
70
|
+
|
71
|
+
- **Extended FFmpeg Version Support:** While `typed-ffmpeg` is currently built with FFmpeg version 6.0 in mind, we are working to ensure compatibility across different FFmpeg versions. Feedback and issue reports are welcome to improve version support.
|
72
|
+
- **Additional Filter Support:** We aim to expand the range of FFmpeg filters supported by `typed-ffmpeg`. Continuous updates will be made to include more complex and varied filters.
|
73
|
+
|
74
|
+
---
|
75
|
+
|
76
|
+
## Installation
|
77
|
+
|
78
|
+
To install `typed-ffmpeg`, simply use pip:
|
79
|
+
|
80
|
+
```bash
|
81
|
+
pip install typed-ffmpeg
|
82
|
+
```
|
83
|
+
|
84
|
+
Note: FFmpeg must be installed on your system.
|
85
|
+
|
86
|
+
Note: If you need to install `ffmpeg-python` at the same time, use `pip install typed-ffmpeg-compatible` to prevent conflicts with the module name.
|
87
|
+
|
88
|
+
### Visualization Support
|
89
|
+
|
90
|
+
To enable graph visualization features:
|
91
|
+
|
92
|
+
```bash
|
93
|
+
pip install 'typed-ffmpeg[graph]'
|
94
|
+
```
|
95
|
+
|
96
|
+
Note: This requires Graphviz to be installed on your system.
|
97
|
+
|
98
|
+
---
|
99
|
+
|
100
|
+
## Quick Usage
|
101
|
+
|
102
|
+
Here's how to quickly start using `typed-ffmpeg`:
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
```python
|
108
|
+
import ffmpeg
|
109
|
+
|
110
|
+
# Flip video horizontally and output
|
111
|
+
f = (
|
112
|
+
ffmpeg
|
113
|
+
.input(filename='input.mp4')
|
114
|
+
.hflip()
|
115
|
+
.output(filename='output.mp4')
|
116
|
+
)
|
117
|
+
f
|
118
|
+
```
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+

|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
For a more complex example:
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
```python
|
134
|
+
import ffmpeg.filters
|
135
|
+
import ffmpeg
|
136
|
+
|
137
|
+
# Complex filter graph example
|
138
|
+
in_file = ffmpeg.input("input.mp4")
|
139
|
+
overlay_file = ffmpeg.input("overlay.png")
|
140
|
+
|
141
|
+
f = (
|
142
|
+
ffmpeg.filters
|
143
|
+
.concat(
|
144
|
+
in_file.trim(start_frame=10, end_frame=20),
|
145
|
+
in_file.trim(start_frame=30, end_frame=40),
|
146
|
+
)
|
147
|
+
.video(0)
|
148
|
+
.overlay(overlay_file.hflip())
|
149
|
+
.drawbox(x="50", y="50", width="120", height="120", color="red", thickness="5")
|
150
|
+
.output(filename="out.mp4")
|
151
|
+
)
|
152
|
+
f
|
153
|
+
```
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+

|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
See the [Usage](https://livingbio.github.io/typed-ffmpeg/usage/typed/) section in our documentation for more examples and detailed guides.
|
165
|
+
|
166
|
+
|
167
|
+
---
|
168
|
+
|
169
|
+
## Acknowledgements
|
170
|
+
|
171
|
+
This project was initially inspired by the capabilities of GPT-3, with the original concept focusing on using GPT-3 to generate an FFmpeg filter SDK directly from the FFmpeg documentation. However, during the development process, I encountered limitations with GPT-3's ability to fully automate this task.
|
172
|
+
|
173
|
+
As a result, I shifted to traditional code generation methods to complete the SDK, ensuring a more robust and reliable tool. Despite this change in approach, both GitHub Copilot and GPT-3 were instrumental in accelerating the development process, providing valuable insights and saving significant time.
|
174
|
+
|
175
|
+
I would also like to extend my gratitude to the `ffmpeg-python` project, which inspired this project significantly. The API style and design ideas from `ffmpeg-python` have been influential, and I have utilized these aspects to shape the development of our SDK.
|
176
|
+
|
177
|
+
This project is dedicated to my son, Austin, on his seventh birthday (February 24, 2024), whose curiosity and zest for life continually inspire me.
|
178
|
+
|
179
|
+
---
|
180
|
+
|
181
|
+
Feel free to check the [Documentation](https://livingbio.github.io/typed-ffmpeg/) for detailed information and more advanced features.
|
182
|
+
|
@@ -0,0 +1,152 @@
|
|
1
|
+
## typed-ffmpeg
|
2
|
+
|
3
|
+
[](https://github.com/livingbio/typed-ffmpeg/actions?query=workflow%3Aci-package)
|
4
|
+
[](https://livingbio.github.io/typed-ffmpeg/)
|
5
|
+
[](https://pypi.org/project/typed-ffmpeg/)
|
6
|
+
[](https://codecov.io/gh/livingbio/typed-ffmpeg)
|
7
|
+
|
8
|
+
**typed-ffmpeg** offers a modern, Pythonic interface to FFmpeg, providing extensive support for complex filters with detailed typing and documentation. Inspired by `ffmpeg-python`, this package enhances functionality by addressing common limitations, such as lack of IDE integration and comprehensive typing, while also introducing new features like JSON serialization of filter graphs and automatic FFmpeg validation.
|
9
|
+
|
10
|
+
---
|
11
|
+
|
12
|
+
### Table of Contents
|
13
|
+
|
14
|
+
- [Features](#features)
|
15
|
+
- [Installation](#installation)
|
16
|
+
- [Quick Usage](#quick-usage)
|
17
|
+
- [Documentation](https://livingbio.github.io/typed-ffmpeg/)
|
18
|
+
- [Acknowledgements](#acknowledgements)
|
19
|
+
|
20
|
+
---
|
21
|
+
|
22
|
+
## Features
|
23
|
+
|
24
|
+

|
25
|
+
|
26
|
+
|
27
|
+
- **Zero Dependencies:** Built purely with the Python standard library, ensuring maximum compatibility and security.
|
28
|
+
- **User-Friendly:** Simplifies the construction of filter graphs with an intuitive Pythonic interface.
|
29
|
+
- **Comprehensive FFmpeg Filter Support:** Out-of-the-box support for most FFmpeg filters, with IDE auto-completion.
|
30
|
+
- **Integrated Documentation:** In-line docstrings provide immediate reference for filter usage, reducing the need to consult external documentation.
|
31
|
+
- **Robust Typing:** Offers static and dynamic type checking, enhancing code reliability and development experience.
|
32
|
+
- **Filter Graph Serialization:** Enables saving and reloading of filter graphs in JSON format for ease of use and repeatability.
|
33
|
+
- **Graph Visualization:** Leverages `graphviz` for visual representation, aiding in understanding and debugging.
|
34
|
+
- **Validation and Auto-correction:** Assists in identifying and fixing errors within filter graphs.
|
35
|
+
- **Input and Output Options Support:** Provide a more comprehensive interface for input and output options, including support for additional codecs and formats.
|
36
|
+
- **Partial Evaluation:** Enhance the flexibility of filter graphs by enabling partial evaluation, allowing for modular construction and reuse.
|
37
|
+
|
38
|
+
### Planned Features
|
39
|
+
|
40
|
+
Please note that the following features are under consideration or development for future releases:
|
41
|
+
|
42
|
+
- **Extended FFmpeg Version Support:** While `typed-ffmpeg` is currently built with FFmpeg version 6.0 in mind, we are working to ensure compatibility across different FFmpeg versions. Feedback and issue reports are welcome to improve version support.
|
43
|
+
- **Additional Filter Support:** We aim to expand the range of FFmpeg filters supported by `typed-ffmpeg`. Continuous updates will be made to include more complex and varied filters.
|
44
|
+
|
45
|
+
---
|
46
|
+
|
47
|
+
## Installation
|
48
|
+
|
49
|
+
To install `typed-ffmpeg`, simply use pip:
|
50
|
+
|
51
|
+
```bash
|
52
|
+
pip install typed-ffmpeg
|
53
|
+
```
|
54
|
+
|
55
|
+
Note: FFmpeg must be installed on your system.
|
56
|
+
|
57
|
+
Note: If you need to install `ffmpeg-python` at the same time, use `pip install typed-ffmpeg-compatible` to prevent conflicts with the module name.
|
58
|
+
|
59
|
+
### Visualization Support
|
60
|
+
|
61
|
+
To enable graph visualization features:
|
62
|
+
|
63
|
+
```bash
|
64
|
+
pip install 'typed-ffmpeg[graph]'
|
65
|
+
```
|
66
|
+
|
67
|
+
Note: This requires Graphviz to be installed on your system.
|
68
|
+
|
69
|
+
---
|
70
|
+
|
71
|
+
## Quick Usage
|
72
|
+
|
73
|
+
Here's how to quickly start using `typed-ffmpeg`:
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
```python
|
79
|
+
import ffmpeg
|
80
|
+
|
81
|
+
# Flip video horizontally and output
|
82
|
+
f = (
|
83
|
+
ffmpeg
|
84
|
+
.input(filename='input.mp4')
|
85
|
+
.hflip()
|
86
|
+
.output(filename='output.mp4')
|
87
|
+
)
|
88
|
+
f
|
89
|
+
```
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+

|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
For a more complex example:
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
```python
|
105
|
+
import ffmpeg.filters
|
106
|
+
import ffmpeg
|
107
|
+
|
108
|
+
# Complex filter graph example
|
109
|
+
in_file = ffmpeg.input("input.mp4")
|
110
|
+
overlay_file = ffmpeg.input("overlay.png")
|
111
|
+
|
112
|
+
f = (
|
113
|
+
ffmpeg.filters
|
114
|
+
.concat(
|
115
|
+
in_file.trim(start_frame=10, end_frame=20),
|
116
|
+
in_file.trim(start_frame=30, end_frame=40),
|
117
|
+
)
|
118
|
+
.video(0)
|
119
|
+
.overlay(overlay_file.hflip())
|
120
|
+
.drawbox(x="50", y="50", width="120", height="120", color="red", thickness="5")
|
121
|
+
.output(filename="out.mp4")
|
122
|
+
)
|
123
|
+
f
|
124
|
+
```
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+

|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
See the [Usage](https://livingbio.github.io/typed-ffmpeg/usage/typed/) section in our documentation for more examples and detailed guides.
|
136
|
+
|
137
|
+
|
138
|
+
---
|
139
|
+
|
140
|
+
## Acknowledgements
|
141
|
+
|
142
|
+
This project was initially inspired by the capabilities of GPT-3, with the original concept focusing on using GPT-3 to generate an FFmpeg filter SDK directly from the FFmpeg documentation. However, during the development process, I encountered limitations with GPT-3's ability to fully automate this task.
|
143
|
+
|
144
|
+
As a result, I shifted to traditional code generation methods to complete the SDK, ensuring a more robust and reliable tool. Despite this change in approach, both GitHub Copilot and GPT-3 were instrumental in accelerating the development process, providing valuable insights and saving significant time.
|
145
|
+
|
146
|
+
I would also like to extend my gratitude to the `ffmpeg-python` project, which inspired this project significantly. The API style and design ideas from `ffmpeg-python` have been influential, and I have utilized these aspects to shape the development of our SDK.
|
147
|
+
|
148
|
+
This project is dedicated to my son, Austin, on his seventh birthday (February 24, 2024), whose curiosity and zest for life continually inspire me.
|
149
|
+
|
150
|
+
---
|
151
|
+
|
152
|
+
Feel free to check the [Documentation](https://livingbio.github.io/typed-ffmpeg/) for detailed information and more advanced features.
|
@@ -0,0 +1,102 @@
|
|
1
|
+
[tool.poetry]
|
2
|
+
name = "typed-ffmpeg-compatible"
|
3
|
+
version = "2.4.1"
|
4
|
+
description = "Modern Python FFmpeg wrappers offer comprehensive support for complex filters, complete with detailed typing and documentation."
|
5
|
+
authors = ["lucemia <lucemia@gmail.com>"]
|
6
|
+
readme = "README.md"
|
7
|
+
packages = [{ include = "typed_ffmpeg", from = "src" }]
|
8
|
+
include = ["typed_ffmpeg/py.typed"]
|
9
|
+
exclude = ["**/tests", "**/scripts"]
|
10
|
+
license = "MIT"
|
11
|
+
homepage = "https://livingbio.github.io/typed-ffmpeg/"
|
12
|
+
repository = "https://github.com/livingbio/typed-ffmpeg"
|
13
|
+
keywords = [
|
14
|
+
"ffmpeg",
|
15
|
+
"video",
|
16
|
+
"audio",
|
17
|
+
"multimedia",
|
18
|
+
"filter",
|
19
|
+
]
|
20
|
+
classifiers = [
|
21
|
+
'Intended Audience :: Developers',
|
22
|
+
'License :: OSI Approved :: MIT License',
|
23
|
+
'Natural Language :: English',
|
24
|
+
'Operating System :: OS Independent',
|
25
|
+
'Programming Language :: Python',
|
26
|
+
'Programming Language :: Python :: 3',
|
27
|
+
'Programming Language :: Python :: 3.10',
|
28
|
+
'Programming Language :: Python :: 3.11',
|
29
|
+
'Programming Language :: Python :: 3.12',
|
30
|
+
'Topic :: Multimedia :: Video',
|
31
|
+
'Topic :: Multimedia :: Sound/Audio',
|
32
|
+
'Topic :: Software Development :: Libraries :: Python Modules',
|
33
|
+
'Topic :: Software Development :: Libraries',
|
34
|
+
'Topic :: Software Development :: Libraries :: Application Frameworks',
|
35
|
+
'Topic :: Software Development :: Libraries :: Python Modules',
|
36
|
+
]
|
37
|
+
|
38
|
+
[tool.poetry.dependencies]
|
39
|
+
python = ">=3.10,<4.0"
|
40
|
+
|
41
|
+
# graph
|
42
|
+
graphviz = {"version" = "*", optional=true}
|
43
|
+
|
44
|
+
[tool.poetry.extras]
|
45
|
+
graph = [
|
46
|
+
"graphviz",
|
47
|
+
]
|
48
|
+
|
49
|
+
[tool.poetry.group.dev]
|
50
|
+
optional = true
|
51
|
+
|
52
|
+
[tool.poetry.group.dev.dependencies]
|
53
|
+
# test
|
54
|
+
pytest-cov = ">=4.1,<6.0"
|
55
|
+
pytest-datadir = "^1.5.0"
|
56
|
+
pytest-recording = "^0.13.1"
|
57
|
+
syrupy = "^4.6.0"
|
58
|
+
pre-commit = "*"
|
59
|
+
mypy = "*"
|
60
|
+
graphviz = "*"
|
61
|
+
|
62
|
+
# codegen
|
63
|
+
typer = "*"
|
64
|
+
jinja2 = "*"
|
65
|
+
devtools = "*"
|
66
|
+
beautifulsoup4 = "*"
|
67
|
+
html2text = "*"
|
68
|
+
|
69
|
+
# Doc
|
70
|
+
mkdocs = "*"
|
71
|
+
markdown-callouts = "^0.4.0"
|
72
|
+
mkdocs-material = "^9.5.9"
|
73
|
+
mkdocstrings = ">=0.24,<0.27"
|
74
|
+
mkdocstrings-python = "^1.8.0"
|
75
|
+
pymdown-extensions = "^10.7"
|
76
|
+
griffe_inherited_docstrings = "*"
|
77
|
+
black = "*"
|
78
|
+
ipykernel = "^6.29.4"
|
79
|
+
mknotebooks = "*"
|
80
|
+
|
81
|
+
[tool.mypy]
|
82
|
+
exclude = "^(migrations|commands|sandbox|samples|sdk)/"
|
83
|
+
show_error_codes = true # Enables showing error codes in messages for easier issue identification.
|
84
|
+
implicit_optional = true # Assumes arguments with a default `None` value are `Optional`.
|
85
|
+
follow_imports = "silent" # Ignores import errors for a cleaner output on external libraries.
|
86
|
+
warn_redundant_casts = true # Issues warnings for unnecessary type casts.
|
87
|
+
warn_unused_ignores = true # Alerts on unnecessary '# type: ignore' comments.
|
88
|
+
disallow_any_generics = true # Forces specifying types for generics, like `List[int]` instead of just `List`.
|
89
|
+
check_untyped_defs = true # Would type-check functions without type annotations, but it's commented out.
|
90
|
+
no_implicit_reexport = true # Requires explicit re-export of imported names.
|
91
|
+
disallow_untyped_defs = true # Forces all functions to have type annotations.
|
92
|
+
|
93
|
+
[tool.poetry.scripts]
|
94
|
+
scripts = "scripts.main:app"
|
95
|
+
|
96
|
+
[tool.poetry-dynamic-versioning]
|
97
|
+
enable = false
|
98
|
+
pattern = "default-unprefixed"
|
99
|
+
|
100
|
+
[build-system]
|
101
|
+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
|
102
|
+
build-backend = "poetry_dynamic_versioning.backend"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
from . import dag, filters
|
2
|
+
from .base import afilter, filter_multi_output, input, merge_outputs, output, vfilter
|
3
|
+
from .dag import Stream
|
4
|
+
from .exceptions import FFMpegExecuteError, FFMpegTypeError, FFMpegValueError
|
5
|
+
from .probe import probe
|
6
|
+
from .streams import AudioStream, AVStream, VideoStream
|
7
|
+
|
8
|
+
__all__ = [
|
9
|
+
"filters",
|
10
|
+
"input",
|
11
|
+
"output",
|
12
|
+
"merge_outputs",
|
13
|
+
"FFMpegExecuteError",
|
14
|
+
"FFMpegTypeError",
|
15
|
+
"FFMpegValueError",
|
16
|
+
"Stream",
|
17
|
+
"probe",
|
18
|
+
"AudioStream",
|
19
|
+
"VideoStream",
|
20
|
+
"AVStream",
|
21
|
+
"vfilter",
|
22
|
+
"afilter",
|
23
|
+
"filter_multi_output",
|
24
|
+
"dag",
|
25
|
+
]
|
@@ -0,0 +1,114 @@
|
|
1
|
+
"""
|
2
|
+
This module defined the basic functions for creating the ffmpeg filter graph.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from typing import Any
|
6
|
+
|
7
|
+
from .dag.io._input import input
|
8
|
+
from .dag.io._output import output
|
9
|
+
from .dag.nodes import FilterableStream, FilterNode, GlobalNode, GlobalStream, OutputStream
|
10
|
+
from .schema import StreamType
|
11
|
+
from .streams.audio import AudioStream
|
12
|
+
from .streams.video import VideoStream
|
13
|
+
|
14
|
+
|
15
|
+
def merge_outputs(*streams: OutputStream) -> GlobalStream:
|
16
|
+
"""
|
17
|
+
Merge multiple output streams into one.
|
18
|
+
|
19
|
+
Args:
|
20
|
+
*streams: The output streams to merge.
|
21
|
+
|
22
|
+
Returns:
|
23
|
+
The merged output stream.
|
24
|
+
"""
|
25
|
+
return GlobalNode(inputs=streams).stream()
|
26
|
+
|
27
|
+
|
28
|
+
def vfilter(
|
29
|
+
*streams: FilterableStream, name: str, input_typings: tuple[StreamType, ...] = (StreamType.video,), **kwargs: Any
|
30
|
+
) -> VideoStream:
|
31
|
+
"""
|
32
|
+
Apply a custom video filter which has only one output to this stream
|
33
|
+
|
34
|
+
Args:
|
35
|
+
*streams: the streams to apply the filter to
|
36
|
+
name: the name of the filter
|
37
|
+
input_typings: the input typings of the filter
|
38
|
+
**kwargs: the arguments for the filter
|
39
|
+
|
40
|
+
Returns:
|
41
|
+
the output stream
|
42
|
+
|
43
|
+
Note:
|
44
|
+
This function is for custom filter which is not implemented in typed-ffmpeg
|
45
|
+
"""
|
46
|
+
return FilterNode(
|
47
|
+
name=name,
|
48
|
+
inputs=streams,
|
49
|
+
output_typings=(StreamType.video,),
|
50
|
+
input_typings=input_typings,
|
51
|
+
kwargs=tuple(kwargs.items()),
|
52
|
+
).video(0)
|
53
|
+
|
54
|
+
|
55
|
+
def afilter(
|
56
|
+
*streams: FilterableStream, name: str, input_typings: tuple[StreamType, ...] = (StreamType.audio,), **kwargs: Any
|
57
|
+
) -> AudioStream:
|
58
|
+
"""
|
59
|
+
Apply a custom audio filter which has only one output to this stream
|
60
|
+
|
61
|
+
Args:
|
62
|
+
*streams: the streams to apply the filter to
|
63
|
+
name: the name of the filter
|
64
|
+
input_typings: the input typings of the filter
|
65
|
+
**kwargs: the arguments for the filter
|
66
|
+
|
67
|
+
Returns:
|
68
|
+
the output stream
|
69
|
+
|
70
|
+
Note:
|
71
|
+
This function is for custom filter which is not implemented in typed-ffmpeg
|
72
|
+
"""
|
73
|
+
return FilterNode(
|
74
|
+
name=name,
|
75
|
+
inputs=streams,
|
76
|
+
output_typings=(StreamType.audio,),
|
77
|
+
input_typings=input_typings,
|
78
|
+
kwargs=tuple(kwargs.items()),
|
79
|
+
).audio(0)
|
80
|
+
|
81
|
+
|
82
|
+
def filter_multi_output(
|
83
|
+
*streams: FilterableStream,
|
84
|
+
name: str,
|
85
|
+
input_typings: tuple[StreamType, ...] = (),
|
86
|
+
output_tyings: tuple[StreamType, ...] = (),
|
87
|
+
**kwargs: Any
|
88
|
+
) -> FilterNode:
|
89
|
+
"""
|
90
|
+
Apply a custom filter which has multiple outputs to this stream
|
91
|
+
|
92
|
+
Args:
|
93
|
+
*streams: the streams to apply the filter to
|
94
|
+
name: the name of the filter
|
95
|
+
input_typings: the input typings of the filter
|
96
|
+
output_tyings: the output typings of the filter
|
97
|
+
**kwargs: the arguments for the filter
|
98
|
+
|
99
|
+
Returns:
|
100
|
+
the FilterNode
|
101
|
+
|
102
|
+
Note:
|
103
|
+
This function is for custom filter which is not implemented in typed-ffmpeg
|
104
|
+
"""
|
105
|
+
return FilterNode(
|
106
|
+
name=name,
|
107
|
+
kwargs=tuple(kwargs.items()),
|
108
|
+
inputs=streams,
|
109
|
+
input_typings=input_typings,
|
110
|
+
output_typings=output_tyings,
|
111
|
+
)
|
112
|
+
|
113
|
+
|
114
|
+
__all__ = ["input", "output", "merge_outputs", "vfilter", "afilter", "filter_multi_output"]
|
File without changes
|