typed-ffmpeg-compatible 2.1.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. typed_ffmpeg/__init__.py +25 -0
  2. typed_ffmpeg/base.py +114 -0
  3. typed_ffmpeg/common/__init__.py +0 -0
  4. typed_ffmpeg/common/schema.py +308 -0
  5. typed_ffmpeg/common/serialize.py +132 -0
  6. typed_ffmpeg/dag/__init__.py +13 -0
  7. typed_ffmpeg/dag/compile.py +51 -0
  8. typed_ffmpeg/dag/context.py +221 -0
  9. typed_ffmpeg/dag/factory.py +31 -0
  10. typed_ffmpeg/dag/global_runnable/__init__.py +0 -0
  11. typed_ffmpeg/dag/global_runnable/global_args.py +178 -0
  12. typed_ffmpeg/dag/global_runnable/runnable.py +174 -0
  13. typed_ffmpeg/dag/io/__init__.py +0 -0
  14. typed_ffmpeg/dag/io/_input.py +197 -0
  15. typed_ffmpeg/dag/io/_output.py +318 -0
  16. typed_ffmpeg/dag/io/output_args.py +327 -0
  17. typed_ffmpeg/dag/nodes.py +479 -0
  18. typed_ffmpeg/dag/schema.py +210 -0
  19. typed_ffmpeg/dag/utils.py +41 -0
  20. typed_ffmpeg/dag/validate.py +172 -0
  21. typed_ffmpeg/exceptions.py +42 -0
  22. typed_ffmpeg/filters.py +3510 -0
  23. typed_ffmpeg/probe.py +43 -0
  24. typed_ffmpeg/py.typed +0 -0
  25. typed_ffmpeg/schema.py +29 -0
  26. typed_ffmpeg/streams/__init__.py +5 -0
  27. typed_ffmpeg/streams/audio.py +6955 -0
  28. typed_ffmpeg/streams/av.py +22 -0
  29. typed_ffmpeg/streams/channel_layout.py +39 -0
  30. typed_ffmpeg/streams/video.py +12974 -0
  31. typed_ffmpeg/types.py +119 -0
  32. typed_ffmpeg/utils/__init__.py +0 -0
  33. typed_ffmpeg/utils/escaping.py +49 -0
  34. typed_ffmpeg/utils/lazy_eval/__init__.py +0 -0
  35. typed_ffmpeg/utils/lazy_eval/operator.py +134 -0
  36. typed_ffmpeg/utils/lazy_eval/schema.py +211 -0
  37. typed_ffmpeg/utils/run.py +27 -0
  38. typed_ffmpeg/utils/snapshot.py +26 -0
  39. typed_ffmpeg/utils/typing.py +17 -0
  40. typed_ffmpeg/utils/view.py +64 -0
  41. typed_ffmpeg_compatible-2.1.0.dist-info/LICENSE +21 -0
  42. typed_ffmpeg_compatible-2.1.0.dist-info/METADATA +183 -0
  43. typed_ffmpeg_compatible-2.1.0.dist-info/RECORD +45 -0
  44. typed_ffmpeg_compatible-2.1.0.dist-info/WHEEL +4 -0
  45. typed_ffmpeg_compatible-2.1.0.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,197 @@
1
+ # NOTE: this file is auto-generated, do not modify
2
+
3
+
4
+ from pathlib import Path
5
+ from typing import Any
6
+
7
+ from ...streams.av import AVStream
8
+ from ...types import Boolean, Double, Float, Int, String, Time
9
+ from ..nodes import InputNode
10
+
11
+
12
+ def input(
13
+ filename: str | Path,
14
+ *,
15
+ f: String = None,
16
+ c: String = None,
17
+ codec: String = None,
18
+ t: Time = None,
19
+ to: Time = None,
20
+ ss: Time = None,
21
+ sseof: Time = None,
22
+ seek_timestamp: Int = None,
23
+ accurate_seek: Boolean = None,
24
+ isync: Int = None,
25
+ itsoffset: Time = None,
26
+ itsscale: Double = None,
27
+ re: Boolean = None,
28
+ readrate: Float = None,
29
+ readrate_initial_burst: Double = None,
30
+ bitexact: Boolean = None,
31
+ tag: String = None,
32
+ reinit_filter: Int = None,
33
+ dump_attachment: String = None,
34
+ stream_loop: Int = None,
35
+ discard: String = None,
36
+ thread_queue_size: Int = None,
37
+ find_stream_info: Boolean = None,
38
+ r: String = None,
39
+ s: String = None,
40
+ pix_fmt: String = None,
41
+ display_rotation: Double = None,
42
+ display_hflip: Boolean = None,
43
+ display_vflip: Boolean = None,
44
+ vn: Boolean = None,
45
+ vcodec: String = None,
46
+ vtag: String = None,
47
+ hwaccel: String = None,
48
+ hwaccel_device: String = None,
49
+ hwaccel_output_format: String = None,
50
+ autorotate: Boolean = None,
51
+ ar: Int = None,
52
+ ac: Int = None,
53
+ an: Boolean = None,
54
+ acodec: String = None,
55
+ sample_fmt: String = None,
56
+ channel_layout: String = None,
57
+ ch_layout: String = None,
58
+ guess_layout_max: Int = None,
59
+ sn: Boolean = None,
60
+ scodec: String = None,
61
+ fix_sub_duration: Boolean = None,
62
+ canvas_size: String = None,
63
+ bsf: String = None,
64
+ dcodec: String = None,
65
+ dn: Boolean = None,
66
+ top: Int = None,
67
+ **kwargs: Any
68
+ ) -> AVStream:
69
+ """
70
+ Input file URL (ffmpeg ``-i`` option)
71
+
72
+ Args:
73
+ filename: Input file URL
74
+ f: force container format (auto-detected otherwise)
75
+ c: select encoder/decoder ('copy' to copy stream without reencoding)
76
+ codec: alias for -c (select encoder/decoder)
77
+ t: stop transcoding after specified duration
78
+ to: stop transcoding after specified time is reached
79
+ ss: start transcoding at specified time
80
+ sseof: set the start time offset relative to EOF
81
+ seek_timestamp: enable/disable seeking by timestamp with -ss
82
+ accurate_seek: enable/disable accurate seeking with -ss
83
+ isync: Indicate the input index for sync reference
84
+ itsoffset: set the input ts offset
85
+ itsscale: set the input ts scale
86
+ re: read input at native frame rate; equivalent to -readrate 1
87
+ readrate: read input at specified rate
88
+ readrate_initial_burst: The initial amount of input to burst read before imposing any readrate
89
+ bitexact: bitexact mode
90
+ tag: force codec tag/fourcc
91
+ reinit_filter: reinit filtergraph on input parameter changes
92
+ dump_attachment: extract an attachment into a file
93
+ stream_loop: set number of times input stream shall be looped
94
+ discard: discard
95
+ thread_queue_size: set the maximum number of queued packets from the demuxer
96
+ find_stream_info: read and decode the streams to fill missing information with heuristics
97
+ r: override input framerate/convert to given output framerate (Hz value, fraction or abbreviation)
98
+ s: set frame size (WxH or abbreviation)
99
+ pix_fmt: set pixel format
100
+ display_rotation: set pure counter-clockwise rotation in degrees for stream(s)
101
+ display_hflip: set display horizontal flip for stream(s) (overrides any display rotation if it is not set)
102
+ display_vflip: set display vertical flip for stream(s) (overrides any display rotation if it is not set)
103
+ vn: disable video
104
+ vcodec: alias for -c:v (select encoder/decoder for video streams)
105
+ vtag: force video tag/fourcc
106
+ hwaccel: use HW accelerated decoding
107
+ hwaccel_device: select a device for HW acceleration
108
+ hwaccel_output_format: select output format used with HW accelerated decoding
109
+ autorotate: automatically insert correct rotate filters
110
+ ar: set audio sampling rate (in Hz)
111
+ ac: set number of audio channels
112
+ an: disable audio
113
+ acodec: alias for -c:a (select encoder/decoder for audio streams)
114
+ sample_fmt: set sample format
115
+ channel_layout: set channel layout
116
+ ch_layout: set channel layout
117
+ guess_layout_max: set the maximum number of channels to try to guess the channel layout
118
+ sn: disable subtitle
119
+ scodec: alias for -c:s (select encoder/decoder for subtitle streams)
120
+ fix_sub_duration: fix subtitles duration
121
+ canvas_size: set canvas size (WxH or abbreviation)
122
+ bsf: A comma-separated list of bitstream filters
123
+ dcodec: alias for -c:d (select encoder/decoder for data streams)
124
+ dn: disable data
125
+ top: deprecated, use the setfield video filter
126
+ **kwargs: ffmpeg's input file options
127
+
128
+ Returns:
129
+ Input stream
130
+
131
+ Examples:
132
+ ```py
133
+ >>> input('input.mp4')
134
+ <AVStream:input.mp4:0>
135
+ ```
136
+ """
137
+
138
+ options = {
139
+ k: v
140
+ for k, v in {
141
+ "f": f,
142
+ "c": c,
143
+ "codec": codec,
144
+ "t": t,
145
+ "to": to,
146
+ "ss": ss,
147
+ "sseof": sseof,
148
+ "seek_timestamp": seek_timestamp,
149
+ "accurate_seek": accurate_seek,
150
+ "isync": isync,
151
+ "itsoffset": itsoffset,
152
+ "itsscale": itsscale,
153
+ "re": re,
154
+ "readrate": readrate,
155
+ "readrate_initial_burst": readrate_initial_burst,
156
+ "bitexact": bitexact,
157
+ "tag": tag,
158
+ "reinit_filter": reinit_filter,
159
+ "dump_attachment": dump_attachment,
160
+ "stream_loop": stream_loop,
161
+ "discard": discard,
162
+ "thread_queue_size": thread_queue_size,
163
+ "find_stream_info": find_stream_info,
164
+ "r": r,
165
+ "s": s,
166
+ "pix_fmt": pix_fmt,
167
+ "display_rotation": display_rotation,
168
+ "display_hflip": display_hflip,
169
+ "display_vflip": display_vflip,
170
+ "vn": vn,
171
+ "vcodec": vcodec,
172
+ "vtag": vtag,
173
+ "hwaccel": hwaccel,
174
+ "hwaccel_device": hwaccel_device,
175
+ "hwaccel_output_format": hwaccel_output_format,
176
+ "autorotate": autorotate,
177
+ "ar": ar,
178
+ "ac": ac,
179
+ "an": an,
180
+ "acodec": acodec,
181
+ "sample_fmt": sample_fmt,
182
+ "channel_layout": channel_layout,
183
+ "ch_layout": ch_layout,
184
+ "guess_layout_max": guess_layout_max,
185
+ "sn": sn,
186
+ "scodec": scodec,
187
+ "fix_sub_duration": fix_sub_duration,
188
+ "canvas_size": canvas_size,
189
+ "bsf": bsf,
190
+ "dcodec": dcodec,
191
+ "dn": dn,
192
+ "top": top,
193
+ }.items()
194
+ if v is not None
195
+ }
196
+
197
+ return InputNode(filename=str(filename), kwargs=tuple((options | kwargs).items())).stream()
@@ -0,0 +1,318 @@
1
+ # NOTE: this file is auto-generated, do not modify
2
+
3
+
4
+ from pathlib import Path
5
+ from typing import Any
6
+
7
+ from ...types import Boolean, Float, Func, Int, Int64, String, Time
8
+ from ..nodes import FilterableStream, OutputNode, OutputStream
9
+
10
+
11
+ def output(
12
+ *streams: FilterableStream,
13
+ filename: str | Path,
14
+ f: String = None,
15
+ c: String = None,
16
+ codec: String = None,
17
+ pre: String = None,
18
+ map: Func = None,
19
+ map_metadata: String = None,
20
+ map_chapters: Int = None,
21
+ t: Time = None,
22
+ to: Time = None,
23
+ fs: Int64 = None,
24
+ ss: Time = None,
25
+ timestamp: Func = None,
26
+ metadata: String = None,
27
+ program: String = None,
28
+ stream_group: String = None,
29
+ dframes: Int64 = None,
30
+ target: Func = None,
31
+ shortest: Boolean = None,
32
+ shortest_buf_duration: Float = None,
33
+ bitexact: Boolean = None,
34
+ apad: String = None,
35
+ copyinkf: Boolean = None,
36
+ copypriorss: Int = None,
37
+ frames: Int64 = None,
38
+ tag: String = None,
39
+ q: Func = None,
40
+ qscale: Func = None,
41
+ profile: Func = None,
42
+ filter: String = None,
43
+ filter_script: String = None,
44
+ attach: Func = None,
45
+ disposition: String = None,
46
+ thread_queue_size: Int = None,
47
+ bits_per_raw_sample: Int = None,
48
+ stats_enc_pre: String = None,
49
+ stats_enc_post: String = None,
50
+ stats_mux_pre: String = None,
51
+ stats_enc_pre_fmt: String = None,
52
+ stats_enc_post_fmt: String = None,
53
+ stats_mux_pre_fmt: String = None,
54
+ vframes: Int64 = None,
55
+ r: String = None,
56
+ fpsmax: String = None,
57
+ s: String = None,
58
+ aspect: String = None,
59
+ pix_fmt: String = None,
60
+ vn: Boolean = None,
61
+ rc_override: String = None,
62
+ vcodec: String = None,
63
+ timecode: Func = None,
64
+ _pass: Int = None,
65
+ passlogfile: String = None,
66
+ vf: String = None,
67
+ intra_matrix: String = None,
68
+ inter_matrix: String = None,
69
+ chroma_intra_matrix: String = None,
70
+ vtag: String = None,
71
+ fps_mode: String = None,
72
+ force_fps: Boolean = None,
73
+ streamid: Func = None,
74
+ force_key_frames: String = None,
75
+ b: Func = None,
76
+ autoscale: Boolean = None,
77
+ fix_sub_duration_heartbeat: Boolean = None,
78
+ aframes: Int64 = None,
79
+ aq: Func = None,
80
+ ar: Int = None,
81
+ ac: Int = None,
82
+ an: Boolean = None,
83
+ acodec: String = None,
84
+ ab: Func = None,
85
+ atag: String = None,
86
+ sample_fmt: String = None,
87
+ channel_layout: String = None,
88
+ ch_layout: String = None,
89
+ af: String = None,
90
+ sn: Boolean = None,
91
+ scodec: String = None,
92
+ stag: String = None,
93
+ muxdelay: Float = None,
94
+ muxpreload: Float = None,
95
+ sdp_file: Func = None,
96
+ time_base: String = None,
97
+ enc_time_base: String = None,
98
+ bsf: String = None,
99
+ apre: String = None,
100
+ vpre: String = None,
101
+ spre: String = None,
102
+ fpre: String = None,
103
+ max_muxing_queue_size: Int = None,
104
+ muxing_queue_data_threshold: Int = None,
105
+ dcodec: String = None,
106
+ dn: Boolean = None,
107
+ top: Int = None,
108
+ **kwargs: Any
109
+ ) -> OutputStream:
110
+ """
111
+ Output file URL
112
+
113
+ Args:
114
+ *streams: the streams to output
115
+ filename: the filename to output to
116
+ f: force container format (auto-detected otherwise)
117
+ c: select encoder/decoder ('copy' to copy stream without reencoding)
118
+ codec: alias for -c (select encoder/decoder)
119
+ pre: preset name
120
+ map: set input stream mapping
121
+ map_metadata: set metadata information of outfile from infile
122
+ map_chapters: set chapters mapping
123
+ t: stop transcoding after specified duration
124
+ to: stop transcoding after specified time is reached
125
+ fs: set the limit file size in bytes
126
+ ss: start transcoding at specified time
127
+ timestamp: set the recording timestamp ('now' to set the current time)
128
+ metadata: add metadata
129
+ program: add program with specified streams
130
+ stream_group: add stream group with specified streams and group type-specific arguments
131
+ dframes: set the number of data frames to output
132
+ target: specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\
133
+ "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")
134
+ shortest: finish encoding within shortest input
135
+ shortest_buf_duration: maximum buffering duration (in seconds) for the -shortest option
136
+ bitexact: bitexact mode
137
+ apad: audio pad
138
+ copyinkf: copy initial non-keyframes
139
+ copypriorss: copy or discard frames before start time
140
+ frames: set the number of frames to output
141
+ tag: force codec tag/fourcc
142
+ q: use fixed quality scale (VBR)
143
+ qscale: use fixed quality scale (VBR)
144
+ profile: set profile
145
+ filter: apply specified filters to audio/video
146
+ filter_script: deprecated, use -/filter
147
+ attach: add an attachment to the output file
148
+ disposition: disposition
149
+ thread_queue_size: set the maximum number of queued packets from the demuxer
150
+ bits_per_raw_sample: set the number of bits per raw sample
151
+ stats_enc_pre: write encoding stats before encoding
152
+ stats_enc_post: write encoding stats after encoding
153
+ stats_mux_pre: write packets stats before muxing
154
+ stats_enc_pre_fmt: format of the stats written with -stats_enc_pre
155
+ stats_enc_post_fmt: format of the stats written with -stats_enc_post
156
+ stats_mux_pre_fmt: format of the stats written with -stats_mux_pre
157
+ vframes: set the number of video frames to output
158
+ r: override input framerate/convert to given output framerate (Hz value, fraction or abbreviation)
159
+ fpsmax: set max frame rate (Hz value, fraction or abbreviation)
160
+ s: set frame size (WxH or abbreviation)
161
+ aspect: set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
162
+ pix_fmt: set pixel format
163
+ vn: disable video
164
+ rc_override: rate control override for specific intervals
165
+ vcodec: alias for -c:v (select encoder/decoder for video streams)
166
+ timecode: set initial TimeCode value.
167
+ _pass: select the pass number (1 to 3)
168
+ passlogfile: select two pass log file name prefix
169
+ vf: alias for -filter:v (apply filters to video streams)
170
+ intra_matrix: specify intra matrix coeffs
171
+ inter_matrix: specify inter matrix coeffs
172
+ chroma_intra_matrix: specify intra matrix coeffs
173
+ vtag: force video tag/fourcc
174
+ fps_mode: set framerate mode for matching video streams; overrides vsync
175
+ force_fps: force the selected framerate, disable the best supported framerate selection
176
+ streamid: set the value of an outfile streamid
177
+ force_key_frames: force key frames at specified timestamps
178
+ b: video bitrate (please use -b:v)
179
+ autoscale: automatically insert a scale filter at the end of the filter graph
180
+ fix_sub_duration_heartbeat: set this video output stream to be a heartbeat stream for fix_sub_duration, according to which subtitles should be split at random access points
181
+ aframes: set the number of audio frames to output
182
+ aq: set audio quality (codec-specific)
183
+ ar: set audio sampling rate (in Hz)
184
+ ac: set number of audio channels
185
+ an: disable audio
186
+ acodec: alias for -c:a (select encoder/decoder for audio streams)
187
+ ab: alias for -b:a (select bitrate for audio streams)
188
+ atag: force audio tag/fourcc
189
+ sample_fmt: set sample format
190
+ channel_layout: set channel layout
191
+ ch_layout: set channel layout
192
+ af: alias for -filter:a (apply filters to audio streams)
193
+ sn: disable subtitle
194
+ scodec: alias for -c:s (select encoder/decoder for subtitle streams)
195
+ stag: force subtitle tag/fourcc
196
+ muxdelay: set the maximum demux-decode delay
197
+ muxpreload: set the initial demux-decode delay
198
+ sdp_file: specify a file in which to print sdp information
199
+ time_base: set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)
200
+ enc_time_base: set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). two special values are defined - 0 = use frame rate (video) or sample rate (audio),-1 = match source time base
201
+ bsf: A comma-separated list of bitstream filters
202
+ apre: set the audio options to the indicated preset
203
+ vpre: set the video options to the indicated preset
204
+ spre: set the subtitle options to the indicated preset
205
+ fpre: set options from indicated preset file
206
+ max_muxing_queue_size: maximum number of packets that can be buffered while waiting for all streams to initialize
207
+ muxing_queue_data_threshold: set the threshold after which max_muxing_queue_size is taken into account
208
+ dcodec: alias for -c:d (select encoder/decoder for data streams)
209
+ dn: disable data
210
+ top: deprecated, use the setfield video filter
211
+ **kwargs: the arguments for the output
212
+
213
+ Returns:
214
+ the output stream
215
+ """
216
+
217
+ options = {
218
+ k: v
219
+ for k, v in {
220
+ "f": f,
221
+ "c": c,
222
+ "codec": codec,
223
+ "pre": pre,
224
+ "map": map,
225
+ "map_metadata": map_metadata,
226
+ "map_chapters": map_chapters,
227
+ "t": t,
228
+ "to": to,
229
+ "fs": fs,
230
+ "ss": ss,
231
+ "timestamp": timestamp,
232
+ "metadata": metadata,
233
+ "program": program,
234
+ "stream_group": stream_group,
235
+ "dframes": dframes,
236
+ "target": target,
237
+ "shortest": shortest,
238
+ "shortest_buf_duration": shortest_buf_duration,
239
+ "bitexact": bitexact,
240
+ "apad": apad,
241
+ "copyinkf": copyinkf,
242
+ "copypriorss": copypriorss,
243
+ "frames": frames,
244
+ "tag": tag,
245
+ "q": q,
246
+ "qscale": qscale,
247
+ "profile": profile,
248
+ "filter": filter,
249
+ "filter_script": filter_script,
250
+ "attach": attach,
251
+ "disposition": disposition,
252
+ "thread_queue_size": thread_queue_size,
253
+ "bits_per_raw_sample": bits_per_raw_sample,
254
+ "stats_enc_pre": stats_enc_pre,
255
+ "stats_enc_post": stats_enc_post,
256
+ "stats_mux_pre": stats_mux_pre,
257
+ "stats_enc_pre_fmt": stats_enc_pre_fmt,
258
+ "stats_enc_post_fmt": stats_enc_post_fmt,
259
+ "stats_mux_pre_fmt": stats_mux_pre_fmt,
260
+ "vframes": vframes,
261
+ "r": r,
262
+ "fpsmax": fpsmax,
263
+ "s": s,
264
+ "aspect": aspect,
265
+ "pix_fmt": pix_fmt,
266
+ "vn": vn,
267
+ "rc_override": rc_override,
268
+ "vcodec": vcodec,
269
+ "timecode": timecode,
270
+ "pass": _pass,
271
+ "passlogfile": passlogfile,
272
+ "vf": vf,
273
+ "intra_matrix": intra_matrix,
274
+ "inter_matrix": inter_matrix,
275
+ "chroma_intra_matrix": chroma_intra_matrix,
276
+ "vtag": vtag,
277
+ "fps_mode": fps_mode,
278
+ "force_fps": force_fps,
279
+ "streamid": streamid,
280
+ "force_key_frames": force_key_frames,
281
+ "b": b,
282
+ "autoscale": autoscale,
283
+ "fix_sub_duration_heartbeat": fix_sub_duration_heartbeat,
284
+ "aframes": aframes,
285
+ "aq": aq,
286
+ "ar": ar,
287
+ "ac": ac,
288
+ "an": an,
289
+ "acodec": acodec,
290
+ "ab": ab,
291
+ "atag": atag,
292
+ "sample_fmt": sample_fmt,
293
+ "channel_layout": channel_layout,
294
+ "ch_layout": ch_layout,
295
+ "af": af,
296
+ "sn": sn,
297
+ "scodec": scodec,
298
+ "stag": stag,
299
+ "muxdelay": muxdelay,
300
+ "muxpreload": muxpreload,
301
+ "sdp_file": sdp_file,
302
+ "time_base": time_base,
303
+ "enc_time_base": enc_time_base,
304
+ "bsf": bsf,
305
+ "apre": apre,
306
+ "vpre": vpre,
307
+ "spre": spre,
308
+ "fpre": fpre,
309
+ "max_muxing_queue_size": max_muxing_queue_size,
310
+ "muxing_queue_data_threshold": muxing_queue_data_threshold,
311
+ "dcodec": dcodec,
312
+ "dn": dn,
313
+ "top": top,
314
+ }.items()
315
+ if v is not None
316
+ }
317
+
318
+ return OutputNode(inputs=streams, filename=str(filename), kwargs=tuple((options | kwargs).items())).stream()