typed-ffmpeg-compatible 2.6.3__tar.gz → 2.6.4__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_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/PKG-INFO +1 -1
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/pyproject.toml +1 -1
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/__init__.py +54 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/base.py +191 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/common/schema.py +602 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/common/serialize.py +234 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/dag/__init__.py +33 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/dag/compile.py +86 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/dag/context.py +334 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/dag/factory.py +27 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/dag/global_runnable/global_args.py +11 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/dag/global_runnable/runnable.py +289 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/dag/io/_input.py +2 -1
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/dag/io/_output.py +2 -1
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/dag/nodes.py +846 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/dag/schema.py +3 -1
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/dag/utils.py +62 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/dag/validate.py +83 -20
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/exceptions.py +75 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/info.py +288 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/probe.py +75 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/schema.py +55 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/streams/channel_layout.py +13 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/utils/escaping.py +90 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/utils/forzendict.py +108 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/utils/lazy_eval/operator.py +43 -1
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/utils/lazy_eval/schema.py +327 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/utils/run.py +64 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/utils/snapshot.py +65 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/utils/typing.py +42 -0
- typed_ffmpeg_compatible-2.6.4/src/typed_ffmpeg/utils/view.py +111 -0
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/__init__.py +0 -30
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/base.py +0 -133
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/common/schema.py +0 -324
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/common/serialize.py +0 -137
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/dag/__init__.py +0 -20
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/dag/compile.py +0 -51
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/dag/context.py +0 -226
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/dag/global_runnable/runnable.py +0 -180
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/dag/nodes.py +0 -511
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/dag/utils.py +0 -41
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/exceptions.py +0 -42
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/info.py +0 -167
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/probe.py +0 -50
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/schema.py +0 -28
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/utils/escaping.py +0 -50
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/utils/lazy_eval/schema.py +0 -211
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/utils/run.py +0 -27
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/utils/snapshot.py +0 -30
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/utils/typing.py +0 -17
- typed_ffmpeg_compatible-2.6.3/src/typed_ffmpeg/utils/view.py +0 -69
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/LICENSE +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/README.md +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/common/__init__.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/dag/global_runnable/__init__.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/dag/io/__init__.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/dag/io/output_args.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/filters.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/py.typed +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/sources.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/streams/__init__.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/streams/audio.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/streams/av.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/streams/video.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/types.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/utils/__init__.py +0 -0
- {typed_ffmpeg_compatible-2.6.3 → typed_ffmpeg_compatible-2.6.4}/src/typed_ffmpeg/utils/lazy_eval/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: typed-ffmpeg-compatible
|
3
|
-
Version: 2.6.
|
3
|
+
Version: 2.6.4
|
4
4
|
Summary: Modern Python FFmpeg wrappers offer comprehensive support for complex filters, complete with detailed typing and documentation.
|
5
5
|
Home-page: https://livingbio.github.io/typed-ffmpeg/
|
6
6
|
License: MIT
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "typed-ffmpeg-compatible"
|
3
|
-
version = "2.6.
|
3
|
+
version = "2.6.4"
|
4
4
|
description = "Modern Python FFmpeg wrappers offer comprehensive support for complex filters, complete with detailed typing and documentation."
|
5
5
|
authors = ["lucemia <lucemia@gmail.com>"]
|
6
6
|
readme = "README.md"
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"""
|
2
|
+
typed-ffmpeg: A strongly-typed FFmpeg binding for Python.
|
3
|
+
|
4
|
+
This module provides a high-level, type-safe interface to FFmpeg, enabling
|
5
|
+
Python developers to process audio and video with compile-time validation.
|
6
|
+
The library uses Python's type annotations to ensure correct filter graphs
|
7
|
+
and parameter usage.
|
8
|
+
|
9
|
+
Key components:
|
10
|
+
- Input/output handling via `input` and `output` functions
|
11
|
+
- Stream manipulation with `VideoStream`, `AudioStream`, and `AVStream` classes
|
12
|
+
- Filter application through the `filters` module
|
13
|
+
- Media information analysis using `probe` function
|
14
|
+
- Codec and encoder detection with `get_codecs`, `get_decoders`, and `get_encoders`
|
15
|
+
|
16
|
+
Example:
|
17
|
+
```python
|
18
|
+
import ffmpeg
|
19
|
+
|
20
|
+
# Simple video transcoding
|
21
|
+
(ffmpeg.input("input.mp4").output("output.mp4").run())
|
22
|
+
```
|
23
|
+
"""
|
24
|
+
|
25
|
+
from . import dag, filters, sources
|
26
|
+
from .base import afilter, filter_multi_output, input, merge_outputs, output, vfilter
|
27
|
+
from .dag import Stream
|
28
|
+
from .exceptions import FFMpegExecuteError, FFMpegTypeError, FFMpegValueError
|
29
|
+
from .info import get_codecs, get_decoders, get_encoders
|
30
|
+
from .probe import probe
|
31
|
+
from .streams import AudioStream, AVStream, VideoStream
|
32
|
+
|
33
|
+
__all__ = [
|
34
|
+
"sources",
|
35
|
+
"filters",
|
36
|
+
"input",
|
37
|
+
"output",
|
38
|
+
"merge_outputs",
|
39
|
+
"FFMpegExecuteError",
|
40
|
+
"FFMpegTypeError",
|
41
|
+
"FFMpegValueError",
|
42
|
+
"Stream",
|
43
|
+
"probe",
|
44
|
+
"AudioStream",
|
45
|
+
"VideoStream",
|
46
|
+
"AVStream",
|
47
|
+
"vfilter",
|
48
|
+
"afilter",
|
49
|
+
"filter_multi_output",
|
50
|
+
"dag",
|
51
|
+
"get_codecs",
|
52
|
+
"get_decoders",
|
53
|
+
"get_encoders",
|
54
|
+
]
|
@@ -0,0 +1,191 @@
|
|
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.forzendict 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
|
+
return GlobalNode(inputs=streams).stream()
|
52
|
+
|
53
|
+
|
54
|
+
def vfilter(
|
55
|
+
*streams: FilterableStream,
|
56
|
+
name: str,
|
57
|
+
input_typings: tuple[StreamType, ...] = (StreamType.video,),
|
58
|
+
**kwargs: Any,
|
59
|
+
) -> VideoStream:
|
60
|
+
"""
|
61
|
+
Apply a custom video filter that has a single video output.
|
62
|
+
|
63
|
+
This function allows you to use any FFmpeg video filter that isn't explicitly
|
64
|
+
implemented in typed-ffmpeg. It creates a FilterNode with a video output type
|
65
|
+
and returns the resulting video stream.
|
66
|
+
|
67
|
+
Args:
|
68
|
+
*streams: One or more input streams to apply the filter to
|
69
|
+
name: The FFmpeg filter name (e.g., 'hflip', 'scale', etc.)
|
70
|
+
input_typings: The expected types of the input streams (defaults to video)
|
71
|
+
**kwargs: Filter-specific parameters as keyword arguments
|
72
|
+
|
73
|
+
Returns:
|
74
|
+
A VideoStream representing the filtered output
|
75
|
+
|
76
|
+
Example:
|
77
|
+
```python
|
78
|
+
# Apply a custom deflicker filter (if not directly implemented)
|
79
|
+
filtered = ffmpeg.vfilter(stream, name="deflicker", mode="pm", size=10)
|
80
|
+
```
|
81
|
+
|
82
|
+
Note:
|
83
|
+
This function is for custom filters not implemented in typed-ffmpeg.
|
84
|
+
Use the built-in filters from the filters module when available.
|
85
|
+
"""
|
86
|
+
return FilterNode(
|
87
|
+
name=name,
|
88
|
+
inputs=streams,
|
89
|
+
output_typings=(StreamType.video,),
|
90
|
+
input_typings=input_typings,
|
91
|
+
kwargs=FrozenDict(kwargs),
|
92
|
+
).video(0)
|
93
|
+
|
94
|
+
|
95
|
+
def afilter(
|
96
|
+
*streams: FilterableStream,
|
97
|
+
name: str,
|
98
|
+
input_typings: tuple[StreamType, ...] = (StreamType.audio,),
|
99
|
+
**kwargs: Any,
|
100
|
+
) -> AudioStream:
|
101
|
+
"""
|
102
|
+
Apply a custom audio filter that has a single audio output.
|
103
|
+
|
104
|
+
This function allows you to use any FFmpeg audio filter that isn't explicitly
|
105
|
+
implemented in typed-ffmpeg. It creates a FilterNode with an audio output type
|
106
|
+
and returns the resulting audio stream.
|
107
|
+
|
108
|
+
Args:
|
109
|
+
*streams: One or more input streams to apply the filter to
|
110
|
+
name: The FFmpeg filter name (e.g., 'equalizer', 'dynaudnorm', etc.)
|
111
|
+
input_typings: The expected types of the input streams (defaults to audio)
|
112
|
+
**kwargs: Filter-specific parameters as keyword arguments
|
113
|
+
|
114
|
+
Returns:
|
115
|
+
An AudioStream representing the filtered output
|
116
|
+
|
117
|
+
Example:
|
118
|
+
```python
|
119
|
+
# Apply a custom audio compressor filter (if not directly implemented)
|
120
|
+
compressed = ffmpeg.afilter(stream, name="acompressor", threshold=0.1, ratio=2)
|
121
|
+
```
|
122
|
+
|
123
|
+
Note:
|
124
|
+
This function is for custom filters not implemented in typed-ffmpeg.
|
125
|
+
Use the built-in filters from the filters module when available.
|
126
|
+
"""
|
127
|
+
return FilterNode(
|
128
|
+
name=name,
|
129
|
+
inputs=streams,
|
130
|
+
output_typings=(StreamType.audio,),
|
131
|
+
input_typings=input_typings,
|
132
|
+
kwargs=FrozenDict(kwargs),
|
133
|
+
).audio(0)
|
134
|
+
|
135
|
+
|
136
|
+
def filter_multi_output(
|
137
|
+
*streams: FilterableStream,
|
138
|
+
name: str,
|
139
|
+
input_typings: tuple[StreamType, ...] = (),
|
140
|
+
output_tyings: tuple[StreamType, ...] = (),
|
141
|
+
**kwargs: Any,
|
142
|
+
) -> FilterNode:
|
143
|
+
"""
|
144
|
+
Apply a custom filter that produces multiple output streams.
|
145
|
+
|
146
|
+
This function allows you to use any FFmpeg filter that generates multiple outputs
|
147
|
+
(like split, asplit, or complex filters). Unlike vfilter and afilter which return
|
148
|
+
a single stream, this returns a FilterNode that you can extract specific outputs from.
|
149
|
+
|
150
|
+
Args:
|
151
|
+
*streams: One or more input streams to apply the filter to
|
152
|
+
name: The FFmpeg filter name (e.g., 'split', 'channelsplit', etc.)
|
153
|
+
input_typings: The expected types of the input streams
|
154
|
+
output_tyings: The expected types of each output stream
|
155
|
+
**kwargs: Filter-specific parameters as keyword arguments
|
156
|
+
|
157
|
+
Returns:
|
158
|
+
A FilterNode object that you can extract specific outputs from
|
159
|
+
using methods like .video(0), .audio(1), etc.
|
160
|
+
|
161
|
+
Example:
|
162
|
+
```python
|
163
|
+
# Split a video into two identical streams
|
164
|
+
split_node = ffmpeg.filter_multi_output(
|
165
|
+
stream, name="split", output_tyings=(StreamType.video, StreamType.video)
|
166
|
+
)
|
167
|
+
stream1 = split_node.video(0)
|
168
|
+
stream2 = split_node.video(1)
|
169
|
+
```
|
170
|
+
|
171
|
+
Note:
|
172
|
+
This function is for custom filters not implemented in typed-ffmpeg.
|
173
|
+
Use the built-in filters from the filters module when available.
|
174
|
+
"""
|
175
|
+
return FilterNode(
|
176
|
+
name=name,
|
177
|
+
kwargs=FrozenDict(kwargs),
|
178
|
+
inputs=streams,
|
179
|
+
input_typings=input_typings,
|
180
|
+
output_typings=output_tyings,
|
181
|
+
)
|
182
|
+
|
183
|
+
|
184
|
+
__all__ = [
|
185
|
+
"input",
|
186
|
+
"output",
|
187
|
+
"merge_outputs",
|
188
|
+
"vfilter",
|
189
|
+
"afilter",
|
190
|
+
"filter_multi_output",
|
191
|
+
]
|