typed-ffmpeg-v7 1.0.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- typed_ffmpeg_v7-1.0.0a1/PKG-INFO +20 -0
- typed_ffmpeg_v7-1.0.0a1/pyproject.toml +40 -0
- typed_ffmpeg_v7-1.0.0a1/setup.cfg +4 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/__init__.py +34 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/base.py +195 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/codecs/__init__.py +0 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/codecs/decoders.py +9247 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/codecs/encoders.py +7666 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/codecs/schema.py +11 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/common/__init__.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/common/schema.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/common/serialize.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/compile/__init__.py +1 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/compile/compile_cli.py +992 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/compile/compile_json.py +43 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/compile/compile_python.py +339 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/compile/context.py +326 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/compile/validate.py +254 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/__init__.py +32 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/base_streams.py +238 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/factory.py +101 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/global_runnable/__init__.py +0 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/global_runnable/global_args.py +334 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/global_runnable/runnable.py +585 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/io/__init__.py +7 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/io/_input.py +369 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/io/_output.py +447 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/io/output_args.py +456 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/nodes.py +453 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/schema.py +218 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/dag/utils.py +62 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/exceptions.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/expressions.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/filters.py +6414 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/formats/__init__.py +0 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/formats/demuxers.py +8501 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/formats/muxers.py +5388 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/formats/schema.py +11 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/info.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/options/__init__.py +0 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/options/codec.py +406 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/options/format.py +205 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/options/framesync.py +43 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/options/timeline.py +22 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/py.typed +0 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/schema.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/sources.py +5322 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/streams/__init__.py +0 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/streams/audio.py +11415 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/streams/av.py +98 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/streams/channel_layout.py +52 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/streams/subtitle.py +7 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/streams/video.py +20084 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/types.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/utils/__init__.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/utils/escaping.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/utils/frozendict.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/utils/lazy_eval/__init__.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/utils/lazy_eval/schema.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/utils/run.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/utils/snapshot.py +66 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/utils/typing.py +3 -0
- typed_ffmpeg_v7-1.0.0a1/src/ffmpeg/utils/view.py +113 -0
- typed_ffmpeg_v7-1.0.0a1/src/typed_ffmpeg_v7.egg-info/PKG-INFO +20 -0
- typed_ffmpeg_v7-1.0.0a1/src/typed_ffmpeg_v7.egg-info/SOURCES.txt +66 -0
- typed_ffmpeg_v7-1.0.0a1/src/typed_ffmpeg_v7.egg-info/dependency_links.txt +1 -0
- typed_ffmpeg_v7-1.0.0a1/src/typed_ffmpeg_v7.egg-info/requires.txt +7 -0
- typed_ffmpeg_v7-1.0.0a1/src/typed_ffmpeg_v7.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: typed-ffmpeg-v7
|
|
3
|
+
Version: 1.0.0a1
|
|
4
|
+
Summary: Typed FFmpeg bindings for FFmpeg 7.x
|
|
5
|
+
Author-email: lucemia <lucemia@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: ffmpeg,video,audio,multimedia,filter,ffmpeg-7
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Natural Language :: English
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Multimedia :: Video
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: ffmpeg-core<2.0,>=1.0
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
18
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
19
|
+
Requires-Dist: syrupy>=5.0; extra == "dev"
|
|
20
|
+
Requires-Dist: ruff>=0.9.6; extra == "dev"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "typed-ffmpeg-v7"
|
|
3
|
+
version = "1.0.0a1"
|
|
4
|
+
description = "Typed FFmpeg bindings for FFmpeg 7.x"
|
|
5
|
+
authors = [
|
|
6
|
+
{name = "lucemia", email = "lucemia@gmail.com"}
|
|
7
|
+
]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
keywords = ["ffmpeg", "video", "audio", "multimedia", "filter", "ffmpeg-7"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Natural Language :: English",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Multimedia :: Video",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
dependencies = ["ffmpeg-core>=1.0,<2.0"]
|
|
21
|
+
|
|
22
|
+
[tool.uv.sources]
|
|
23
|
+
ffmpeg-core = { workspace = true }
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
dev = ["pytest>=7.0", "pytest-cov>=4.0", "syrupy>=5.0", "ruff>=0.9.6"]
|
|
27
|
+
|
|
28
|
+
[build-system]
|
|
29
|
+
requires = ["setuptools>=61.0"]
|
|
30
|
+
build-backend = "setuptools.build_meta"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools]
|
|
33
|
+
package-dir = {"" = "src"}
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
where = ["src"]
|
|
37
|
+
include = ["ffmpeg*"]
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.package-data]
|
|
40
|
+
"ffmpeg" = ["py.typed"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""
|
|
2
|
+
typed-ffmpeg v7: FFmpeg 7.x type-safe Python bindings.
|
|
3
|
+
|
|
4
|
+
This package provides comprehensive type hints and IDE autocomplete for FFmpeg 7.x.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "7.1.0"
|
|
8
|
+
|
|
9
|
+
# Export main API functions and classes
|
|
10
|
+
from ffmpeg_core.ffprobe.probe import probe
|
|
11
|
+
|
|
12
|
+
# Make commonly used modules easily accessible
|
|
13
|
+
from . import codecs, filters, formats, streams
|
|
14
|
+
from .base import merge_outputs
|
|
15
|
+
from .dag.io import input, output
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"__version__",
|
|
19
|
+
"input",
|
|
20
|
+
"output",
|
|
21
|
+
"merge_outputs",
|
|
22
|
+
"probe",
|
|
23
|
+
"filters",
|
|
24
|
+
"streams",
|
|
25
|
+
"codecs",
|
|
26
|
+
"formats",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
# Dynamically add OutputArgs methods to FilterableStream
|
|
30
|
+
# This must be done after all imports to avoid circular dependencies
|
|
31
|
+
from .dag.base_streams import _add_output_args_methods
|
|
32
|
+
|
|
33
|
+
_add_output_args_methods()
|
|
34
|
+
del _add_output_args_methods
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Core functions for creating and manipulating FFmpeg filter graphs.
|
|
3
|
+
|
|
4
|
+
This module defines the fundamental functions for building FFmpeg filter graphs
|
|
5
|
+
in typed-ffmpeg. It provides functions to create custom filters, handle
|
|
6
|
+
multi-output filters, and merge output streams. These functions serve as the
|
|
7
|
+
foundation for the more specialized filters defined in the filters module.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
from .dag.io._input import input
|
|
13
|
+
from .dag.io._output import output
|
|
14
|
+
from .dag.nodes import (
|
|
15
|
+
FilterableStream,
|
|
16
|
+
FilterNode,
|
|
17
|
+
GlobalNode,
|
|
18
|
+
GlobalStream,
|
|
19
|
+
OutputStream,
|
|
20
|
+
)
|
|
21
|
+
from .schema import StreamType
|
|
22
|
+
from .streams.audio import AudioStream
|
|
23
|
+
from .streams.video import VideoStream
|
|
24
|
+
from .utils.frozendict import FrozenDict
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def merge_outputs(*streams: OutputStream) -> GlobalStream:
|
|
28
|
+
"""
|
|
29
|
+
Merge multiple output streams into a single command execution.
|
|
30
|
+
|
|
31
|
+
This function combines multiple output streams that need to be executed together
|
|
32
|
+
in a single FFmpeg command. This is useful when you need to generate multiple
|
|
33
|
+
outputs from the same input(s) in a single pass, which is more efficient than
|
|
34
|
+
running separate commands.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
*streams: Two or more output streams to be merged together
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
A global stream representing all merged outputs
|
|
41
|
+
|
|
42
|
+
Example:
|
|
43
|
+
```python
|
|
44
|
+
input_video = ffmpeg.input("input.mp4")
|
|
45
|
+
output1 = input_video.output("output1.mp4", vcodec="libx264")
|
|
46
|
+
output2 = input_video.output("output2.mp4", vcodec="libx265")
|
|
47
|
+
merged = ffmpeg.merge_outputs(output1, output2)
|
|
48
|
+
merged.run() # Executes both outputs in a single FFmpeg command
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
"""
|
|
52
|
+
return GlobalNode(inputs=streams).stream()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def vfilter(
|
|
56
|
+
*streams: FilterableStream,
|
|
57
|
+
name: str,
|
|
58
|
+
input_typings: tuple[StreamType, ...] = (StreamType.video,),
|
|
59
|
+
**kwargs: Any,
|
|
60
|
+
) -> VideoStream:
|
|
61
|
+
"""
|
|
62
|
+
Apply a custom video filter that has a single video output.
|
|
63
|
+
|
|
64
|
+
This function allows you to use any FFmpeg video filter that isn't explicitly
|
|
65
|
+
implemented in typed-ffmpeg. It creates a FilterNode with a video output type
|
|
66
|
+
and returns the resulting video stream.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
*streams: One or more input streams to apply the filter to
|
|
70
|
+
name: The FFmpeg filter name (e.g., 'hflip', 'scale', etc.)
|
|
71
|
+
input_typings: The expected types of the input streams (defaults to video)
|
|
72
|
+
**kwargs: Filter-specific parameters as keyword arguments
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
A VideoStream representing the filtered output
|
|
76
|
+
|
|
77
|
+
Example:
|
|
78
|
+
```python
|
|
79
|
+
# Apply a custom deflicker filter (if not directly implemented)
|
|
80
|
+
filtered = ffmpeg.vfilter(stream, name="deflicker", mode="pm", size=10)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Note:
|
|
84
|
+
This function is for custom filters not implemented in typed-ffmpeg.
|
|
85
|
+
Use the built-in filters from the filters module when available.
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
return FilterNode(
|
|
89
|
+
name=name,
|
|
90
|
+
inputs=streams,
|
|
91
|
+
output_typings=(StreamType.video,),
|
|
92
|
+
input_typings=input_typings,
|
|
93
|
+
kwargs=FrozenDict(kwargs),
|
|
94
|
+
).video(0)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def afilter(
|
|
98
|
+
*streams: FilterableStream,
|
|
99
|
+
name: str,
|
|
100
|
+
input_typings: tuple[StreamType, ...] = (StreamType.audio,),
|
|
101
|
+
**kwargs: Any,
|
|
102
|
+
) -> AudioStream:
|
|
103
|
+
"""
|
|
104
|
+
Apply a custom audio filter that has a single audio output.
|
|
105
|
+
|
|
106
|
+
This function allows you to use any FFmpeg audio filter that isn't explicitly
|
|
107
|
+
implemented in typed-ffmpeg. It creates a FilterNode with an audio output type
|
|
108
|
+
and returns the resulting audio stream.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
*streams: One or more input streams to apply the filter to
|
|
112
|
+
name: The FFmpeg filter name (e.g., 'equalizer', 'dynaudnorm', etc.)
|
|
113
|
+
input_typings: The expected types of the input streams (defaults to audio)
|
|
114
|
+
**kwargs: Filter-specific parameters as keyword arguments
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
An AudioStream representing the filtered output
|
|
118
|
+
|
|
119
|
+
Example:
|
|
120
|
+
```python
|
|
121
|
+
# Apply a custom audio compressor filter (if not directly implemented)
|
|
122
|
+
compressed = ffmpeg.afilter(stream, name="acompressor", threshold=0.1, ratio=2)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Note:
|
|
126
|
+
This function is for custom filters not implemented in typed-ffmpeg.
|
|
127
|
+
Use the built-in filters from the filters module when available.
|
|
128
|
+
|
|
129
|
+
"""
|
|
130
|
+
return FilterNode(
|
|
131
|
+
name=name,
|
|
132
|
+
inputs=streams,
|
|
133
|
+
output_typings=(StreamType.audio,),
|
|
134
|
+
input_typings=input_typings,
|
|
135
|
+
kwargs=FrozenDict(kwargs),
|
|
136
|
+
).audio(0)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def filter_multi_output(
|
|
140
|
+
*streams: FilterableStream,
|
|
141
|
+
name: str,
|
|
142
|
+
input_typings: tuple[StreamType, ...] = (),
|
|
143
|
+
output_typings: tuple[StreamType, ...] = (),
|
|
144
|
+
**kwargs: Any,
|
|
145
|
+
) -> FilterNode:
|
|
146
|
+
"""
|
|
147
|
+
Apply a custom filter that produces multiple output streams.
|
|
148
|
+
|
|
149
|
+
This function allows you to use any FFmpeg filter that generates multiple outputs
|
|
150
|
+
(like split, asplit, or complex filters). Unlike vfilter and afilter which return
|
|
151
|
+
a single stream, this returns a FilterNode that you can extract specific outputs from.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
*streams: One or more input streams to apply the filter to
|
|
155
|
+
name: The FFmpeg filter name (e.g., 'split', 'channelsplit', etc.)
|
|
156
|
+
input_typings: The expected types of the input streams
|
|
157
|
+
output_typings: The expected types of each output stream
|
|
158
|
+
**kwargs: Filter-specific parameters as keyword arguments
|
|
159
|
+
|
|
160
|
+
Returns:
|
|
161
|
+
A FilterNode object that you can extract specific outputs from
|
|
162
|
+
using methods like .video(0), .audio(1), etc.
|
|
163
|
+
|
|
164
|
+
Example:
|
|
165
|
+
```python
|
|
166
|
+
# Split a video into two identical streams
|
|
167
|
+
split_node = ffmpeg.filter_multi_output(
|
|
168
|
+
stream, name="split", output_typings=(StreamType.video, StreamType.video)
|
|
169
|
+
)
|
|
170
|
+
stream1 = split_node.video(0)
|
|
171
|
+
stream2 = split_node.video(1)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Note:
|
|
175
|
+
This function is for custom filters not implemented in typed-ffmpeg.
|
|
176
|
+
Use the built-in filters from the filters module when available.
|
|
177
|
+
|
|
178
|
+
"""
|
|
179
|
+
return FilterNode(
|
|
180
|
+
name=name,
|
|
181
|
+
kwargs=FrozenDict(kwargs),
|
|
182
|
+
inputs=streams,
|
|
183
|
+
input_typings=input_typings,
|
|
184
|
+
output_typings=output_typings,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
__all__ = [
|
|
189
|
+
"input",
|
|
190
|
+
"output",
|
|
191
|
+
"merge_outputs",
|
|
192
|
+
"vfilter",
|
|
193
|
+
"afilter",
|
|
194
|
+
"filter_multi_output",
|
|
195
|
+
]
|
|
File without changes
|