torchaudio 2.8.0__cp310-cp310-win_amd64.whl → 2.9.0__cp310-cp310-win_amd64.whl

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.

Potentially problematic release.


This version of torchaudio might be problematic. Click here for more details.

Files changed (92) hide show
  1. torchaudio/__init__.py +179 -39
  2. torchaudio/_extension/__init__.py +1 -14
  3. torchaudio/_extension/utils.py +0 -47
  4. torchaudio/_internal/module_utils.py +12 -3
  5. torchaudio/_torchcodec.py +73 -85
  6. torchaudio/datasets/cmuarctic.py +1 -1
  7. torchaudio/datasets/utils.py +1 -1
  8. torchaudio/functional/__init__.py +0 -2
  9. torchaudio/functional/_alignment.py +1 -1
  10. torchaudio/functional/filtering.py +70 -55
  11. torchaudio/functional/functional.py +26 -60
  12. torchaudio/lib/_torchaudio.pyd +0 -0
  13. torchaudio/lib/libtorchaudio.pyd +0 -0
  14. torchaudio/models/decoder/__init__.py +14 -2
  15. torchaudio/models/decoder/_ctc_decoder.py +6 -6
  16. torchaudio/models/decoder/_cuda_ctc_decoder.py +1 -1
  17. torchaudio/models/squim/objective.py +2 -2
  18. torchaudio/pipelines/_source_separation_pipeline.py +1 -1
  19. torchaudio/pipelines/_squim_pipeline.py +2 -2
  20. torchaudio/pipelines/_tts/utils.py +1 -1
  21. torchaudio/pipelines/rnnt_pipeline.py +4 -4
  22. torchaudio/transforms/__init__.py +1 -0
  23. torchaudio/transforms/_transforms.py +2 -2
  24. torchaudio/utils/__init__.py +2 -9
  25. torchaudio/utils/download.py +1 -3
  26. torchaudio/version.py +2 -2
  27. {torchaudio-2.8.0.dist-info → torchaudio-2.9.0.dist-info}/METADATA +8 -11
  28. torchaudio-2.9.0.dist-info/RECORD +85 -0
  29. {torchaudio-2.8.0.dist-info → torchaudio-2.9.0.dist-info}/top_level.txt +0 -1
  30. torchaudio/_backend/__init__.py +0 -61
  31. torchaudio/_backend/backend.py +0 -53
  32. torchaudio/_backend/common.py +0 -52
  33. torchaudio/_backend/ffmpeg.py +0 -334
  34. torchaudio/_backend/soundfile.py +0 -54
  35. torchaudio/_backend/soundfile_backend.py +0 -457
  36. torchaudio/_backend/sox.py +0 -91
  37. torchaudio/_backend/utils.py +0 -350
  38. torchaudio/backend/__init__.py +0 -8
  39. torchaudio/backend/_no_backend.py +0 -25
  40. torchaudio/backend/_sox_io_backend.py +0 -294
  41. torchaudio/backend/common.py +0 -13
  42. torchaudio/backend/no_backend.py +0 -14
  43. torchaudio/backend/soundfile_backend.py +0 -14
  44. torchaudio/backend/sox_io_backend.py +0 -14
  45. torchaudio/io/__init__.py +0 -20
  46. torchaudio/io/_effector.py +0 -347
  47. torchaudio/io/_playback.py +0 -72
  48. torchaudio/kaldi_io.py +0 -150
  49. torchaudio/prototype/__init__.py +0 -0
  50. torchaudio/prototype/datasets/__init__.py +0 -4
  51. torchaudio/prototype/datasets/musan.py +0 -68
  52. torchaudio/prototype/functional/__init__.py +0 -26
  53. torchaudio/prototype/functional/_dsp.py +0 -441
  54. torchaudio/prototype/functional/_rir.py +0 -382
  55. torchaudio/prototype/functional/functional.py +0 -193
  56. torchaudio/prototype/models/__init__.py +0 -39
  57. torchaudio/prototype/models/_conformer_wav2vec2.py +0 -801
  58. torchaudio/prototype/models/_emformer_hubert.py +0 -337
  59. torchaudio/prototype/models/conv_emformer.py +0 -529
  60. torchaudio/prototype/models/hifi_gan.py +0 -342
  61. torchaudio/prototype/models/rnnt.py +0 -717
  62. torchaudio/prototype/models/rnnt_decoder.py +0 -402
  63. torchaudio/prototype/pipelines/__init__.py +0 -21
  64. torchaudio/prototype/pipelines/_vggish/__init__.py +0 -7
  65. torchaudio/prototype/pipelines/_vggish/_vggish_impl.py +0 -236
  66. torchaudio/prototype/pipelines/_vggish/_vggish_pipeline.py +0 -83
  67. torchaudio/prototype/pipelines/hifigan_pipeline.py +0 -233
  68. torchaudio/prototype/pipelines/rnnt_pipeline.py +0 -58
  69. torchaudio/prototype/transforms/__init__.py +0 -9
  70. torchaudio/prototype/transforms/_transforms.py +0 -461
  71. torchaudio/sox_effects/__init__.py +0 -10
  72. torchaudio/sox_effects/sox_effects.py +0 -275
  73. torchaudio/utils/ffmpeg_utils.py +0 -11
  74. torchaudio/utils/sox_utils.py +0 -118
  75. torchaudio-2.8.0.dist-info/RECORD +0 -145
  76. torio/__init__.py +0 -8
  77. torio/_extension/__init__.py +0 -13
  78. torio/_extension/utils.py +0 -147
  79. torio/io/__init__.py +0 -9
  80. torio/io/_streaming_media_decoder.py +0 -977
  81. torio/io/_streaming_media_encoder.py +0 -502
  82. torio/lib/__init__.py +0 -0
  83. torio/lib/_torio_ffmpeg4.pyd +0 -0
  84. torio/lib/_torio_ffmpeg5.pyd +0 -0
  85. torio/lib/_torio_ffmpeg6.pyd +0 -0
  86. torio/lib/libtorio_ffmpeg4.pyd +0 -0
  87. torio/lib/libtorio_ffmpeg5.pyd +0 -0
  88. torio/lib/libtorio_ffmpeg6.pyd +0 -0
  89. torio/utils/__init__.py +0 -4
  90. torio/utils/ffmpeg_utils.py +0 -275
  91. {torchaudio-2.8.0.dist-info → torchaudio-2.9.0.dist-info}/WHEEL +0 -0
  92. {torchaudio-2.8.0.dist-info → torchaudio-2.9.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,502 +0,0 @@
1
- from dataclasses import dataclass
2
- from pathlib import Path
3
- from typing import BinaryIO, Dict, Optional, Union
4
-
5
- import torch
6
- import torio
7
-
8
- ffmpeg_ext = torio._extension.lazy_import_ffmpeg_ext()
9
-
10
-
11
- @dataclass
12
- class CodecConfig:
13
- """Codec configuration."""
14
-
15
- bit_rate: int = -1
16
- """Bit rate"""
17
-
18
- compression_level: int = -1
19
- """Compression level"""
20
-
21
- qscale: Optional[int] = None
22
- """Global quality factor. Enables variable bit rate. Valid values depend on encoder.
23
-
24
- For example: MP3 takes ``0`` - ``9`` (https://trac.ffmpeg.org/wiki/Encode/MP3) while
25
- libvorbis takes ``-1`` - ``10``.
26
- """
27
-
28
- gop_size: int = -1
29
- """The number of pictures in a group of pictures, or 0 for intra_only"""
30
-
31
- max_b_frames: int = -1
32
- """maximum number of B-frames between non-B-frames."""
33
-
34
-
35
- def _convert_config(cfg: CodecConfig):
36
- if cfg is None:
37
- return None
38
- # Convert the codecconfig to C++ compatible type.
39
- # omitting the return type annotation so as not to access ffmpeg_ext here.
40
- return ffmpeg_ext.CodecConfig(
41
- cfg.bit_rate,
42
- cfg.compression_level,
43
- cfg.qscale,
44
- cfg.gop_size,
45
- cfg.max_b_frames,
46
- )
47
-
48
-
49
- def _format_doc(**kwargs):
50
- def decorator(obj):
51
- obj.__doc__ = obj.__doc__.format(**kwargs)
52
- return obj
53
-
54
- return decorator
55
-
56
-
57
- _encoder = """The name of the encoder to be used.
58
- When provided, use the specified encoder instead of the default one.
59
-
60
- To list the available encoders, please use
61
- :py:func:`~torio.utils.ffmpeg_utils.get_audio_encoders` for audio, and
62
- :py:func:`~torio.utils.ffmpeg_utils.get_video_encoders` for video.
63
-
64
- Default: ``None``."""
65
-
66
-
67
- _encoder_option = """Options passed to encoder.
68
- Mapping from str to str.
69
-
70
- To list encoder options for a encoder, you can use
71
- ``ffmpeg -h encoder=<ENCODER>`` command.
72
-
73
- Default: ``None``.
74
-
75
- |
76
-
77
- In addition to encoder-specific options, you can also pass options related
78
- to multithreading. They are effective only if the encoder support them.
79
- If neither of them are provided, StreamReader defaults to single thread.
80
-
81
- ``"threads"``: The number of threads (in str).
82
- Providing the value ``"0"`` will let FFmpeg decides based on its heuristics.
83
-
84
- ``"thread_type"``: Which multithreading method to use.
85
- The valid values are ``"frame"`` or ``"slice"``.
86
- Note that each encoder supports different set of methods.
87
- If not provided, a default value is used.
88
-
89
- - ``"frame"``: Encode more than one frame at once.
90
- Each thread handles one frame.
91
- This will increase decoding delay by one frame per thread
92
- - ``"slice"``: Encode more than one part of a single frame at once.
93
-
94
- |
95
- """
96
-
97
-
98
- _encoder_format = """Format used to encode media.
99
- When encoder supports multiple formats, passing this argument will override
100
- the format used for encoding.
101
-
102
- To list supported formats for the encoder, you can use
103
- ``ffmpeg -h encoder=<ENCODER>`` command.
104
-
105
- Default: ``None``.
106
-
107
- Note:
108
- When ``encoder_format`` option is not provided, encoder uses its default format.
109
-
110
- For example, when encoding audio into wav format, 16-bit signed integer is used,
111
- and when encoding video into mp4 format (h264 encoder), one of YUV format is used.
112
-
113
- This is because typically, 32-bit or 16-bit floating point is used in audio models but
114
- they are not commonly used in audio formats. Similarly, RGB24 is commonly used in vision
115
- models, but video formats usually (and better) support YUV formats.
116
- """
117
-
118
- _codec_config = """Codec configuration. Please refer to :py:class:`CodecConfig` for
119
- configuration options.
120
-
121
- Default: ``None``."""
122
-
123
-
124
- _filter_desc = """Additional processing to apply before encoding the input media.
125
- """
126
-
127
- _format_common_args = _format_doc(
128
- encoder=_encoder,
129
- encoder_option=_encoder_option,
130
- encoder_format=_encoder_format,
131
- codec_config=_codec_config,
132
- filter_desc=_filter_desc,
133
- )
134
-
135
-
136
- class StreamingMediaEncoder:
137
- """Encode and write audio/video streams chunk by chunk
138
-
139
- Args:
140
- dst (str, path-like or file-like object): The destination where the encoded data are written.
141
- If string-type, it must be a resource indicator that FFmpeg can
142
- handle. The supported value depends on the FFmpeg found in the system.
143
-
144
- If file-like object, it must support `write` method with the signature
145
- `write(data: bytes) -> int`.
146
-
147
- Please refer to the following for the expected signature and behavior of
148
- `write` method.
149
-
150
- - https://docs.python.org/3/library/io.html#io.BufferedIOBase.write
151
-
152
- format (str or None, optional):
153
- Override the output format, or specify the output media device.
154
- Default: ``None`` (no override nor device output).
155
-
156
- This argument serves two different use cases.
157
-
158
- 1) Override the output format.
159
- This is useful when writing raw data or in a format different from the extension.
160
-
161
- 2) Specify the output device.
162
- This allows to output media streams to hardware devices,
163
- such as speaker and video screen.
164
-
165
- .. note::
166
-
167
- This option roughly corresponds to ``-f`` option of ``ffmpeg`` command.
168
- Please refer to the ffmpeg documentations for possible values.
169
-
170
- https://ffmpeg.org/ffmpeg-formats.html#Muxers
171
-
172
- Please use :py:func:`~torio.utils.ffmpeg_utils.get_muxers` to list the
173
- multiplexers available in the current environment.
174
-
175
- For device access, the available values vary based on hardware (AV device) and
176
- software configuration (ffmpeg build).
177
- Please refer to the ffmpeg documentations for possible values.
178
-
179
- https://ffmpeg.org/ffmpeg-devices.html#Output-Devices
180
-
181
- Please use :py:func:`~torio.utils.ffmpeg_utils.get_output_devices` to list
182
- the output devices available in the current environment.
183
-
184
- buffer_size (int):
185
- The internal buffer size in byte. Used only when `dst` is a file-like object.
186
-
187
- Default: `4096`.
188
- """
189
-
190
- def __init__(
191
- self,
192
- dst: Union[str, Path, BinaryIO],
193
- format: Optional[str] = None,
194
- buffer_size: int = 4096,
195
- ):
196
- if hasattr(dst, "write"):
197
- self._s = ffmpeg_ext.StreamingMediaEncoderFileObj(dst, format, buffer_size)
198
- else:
199
- self._s = ffmpeg_ext.StreamingMediaEncoder(str(dst), format)
200
- self._is_open = False
201
-
202
- @_format_common_args
203
- def add_audio_stream(
204
- self,
205
- sample_rate: int,
206
- num_channels: int,
207
- format: str = "flt",
208
- *,
209
- encoder: Optional[str] = None,
210
- encoder_option: Optional[Dict[str, str]] = None,
211
- encoder_sample_rate: Optional[int] = None,
212
- encoder_num_channels: Optional[int] = None,
213
- encoder_format: Optional[str] = None,
214
- codec_config: Optional[CodecConfig] = None,
215
- filter_desc: Optional[str] = None,
216
- ):
217
- """Add an output audio stream.
218
-
219
- Args:
220
- sample_rate (int): The sample rate.
221
-
222
- num_channels (int): The number of channels.
223
-
224
- format (str, optional): Input sample format, which determines the dtype
225
- of the input tensor.
226
-
227
- - ``"u8"``: The input tensor must be ``torch.uint8`` type.
228
- - ``"s16"``: The input tensor must be ``torch.int16`` type.
229
- - ``"s32"``: The input tensor must be ``torch.int32`` type.
230
- - ``"s64"``: The input tensor must be ``torch.int64`` type.
231
- - ``"flt"``: The input tensor must be ``torch.float32`` type.
232
- - ``"dbl"``: The input tensor must be ``torch.float64`` type.
233
-
234
- Default: ``"flt"``.
235
-
236
- encoder (str or None, optional): {encoder}
237
-
238
- encoder_option (dict or None, optional): {encoder_option}
239
-
240
- encoder_sample_rate (int or None, optional): Override the sample rate used for encoding time.
241
- Some encoders pose restriction on the sample rate used for encoding.
242
- If the source sample rate is not supported by the encoder, the source sample rate is used,
243
- otherwise a default one is picked.
244
-
245
- For example, ``"opus"`` encoder only supports 48k Hz, so, when encoding a
246
- waveform with ``"opus"`` encoder, it is always encoded as 48k Hz.
247
- Meanwhile ``"mp3"`` (``"libmp3lame"``) supports 44.1k, 48k, 32k, 22.05k,
248
- 24k, 16k, 11.025k, 12k and 8k Hz.
249
- If the original sample rate is one of these, then the original sample rate
250
- is used, otherwise it will be resampled to a default one (44.1k).
251
- When encoding into WAV format, there is no restriction on sample rate,
252
- so the original sample rate will be used.
253
-
254
- Providing ``encoder_sample_rate`` will override this behavior and
255
- make encoder attempt to use the provided sample rate.
256
- The provided value must be one support by the encoder.
257
-
258
- encoder_num_channels (int or None, optional): Override the number of channels used for encoding.
259
-
260
- Similar to sample rate, some encoders (such as ``"opus"``,
261
- ``"vorbis"`` and ``"g722"``) pose restriction on
262
- the numbe of channels that can be used for encoding.
263
-
264
- If the original number of channels is supported by encoder,
265
- then it will be used, otherwise, the encoder attempts to
266
- remix the channel to one of the supported ones.
267
-
268
- Providing ``encoder_num_channels`` will override this behavior and
269
- make encoder attempt to use the provided number of channels.
270
- The provided value must be one support by the encoder.
271
-
272
- encoder_format (str or None, optional): {encoder_format}
273
-
274
- codec_config (CodecConfig or None, optional): {codec_config}
275
-
276
- filter_desc (str or None, optional): {filter_desc}
277
- """
278
- self._s.add_audio_stream(
279
- sample_rate,
280
- num_channels,
281
- format,
282
- encoder,
283
- encoder_option,
284
- encoder_format,
285
- encoder_sample_rate,
286
- encoder_num_channels,
287
- _convert_config(codec_config),
288
- filter_desc,
289
- )
290
-
291
- @_format_common_args
292
- def add_video_stream(
293
- self,
294
- frame_rate: float,
295
- width: int,
296
- height: int,
297
- format: str = "rgb24",
298
- *,
299
- encoder: Optional[str] = None,
300
- encoder_option: Optional[Dict[str, str]] = None,
301
- encoder_frame_rate: Optional[float] = None,
302
- encoder_width: Optional[int] = None,
303
- encoder_height: Optional[int] = None,
304
- encoder_format: Optional[str] = None,
305
- codec_config: Optional[CodecConfig] = None,
306
- filter_desc: Optional[str] = None,
307
- hw_accel: Optional[str] = None,
308
- ):
309
- """Add an output video stream.
310
-
311
- This method has to be called before `open` is called.
312
-
313
- Args:
314
- frame_rate (float): Frame rate of the video.
315
-
316
- width (int): Width of the video frame.
317
-
318
- height (int): Height of the video frame.
319
-
320
- format (str, optional): Input pixel format, which determines the
321
- color channel order of the input tensor.
322
-
323
- - ``"gray8"``: One channel, grayscale.
324
- - ``"rgb24"``: Three channels in the order of RGB.
325
- - ``"bgr24"``: Three channels in the order of BGR.
326
- - ``"yuv444p"``: Three channels in the order of YUV.
327
-
328
- Default: ``"rgb24"``.
329
-
330
- In either case, the input tensor has to be ``torch.uint8`` type and
331
- the shape must be (frame, channel, height, width).
332
-
333
- encoder (str or None, optional): {encoder}
334
-
335
- encoder_option (dict or None, optional): {encoder_option}
336
-
337
- encoder_frame_rate (float or None, optional): Override the frame rate used for encoding.
338
-
339
- Some encoders, (such as ``"mpeg1"`` and ``"mpeg2"``) pose restriction on the
340
- frame rate that can be used for encoding.
341
- If such case, if the source frame rate (provided as ``frame_rate``) is not
342
- one of the supported frame rate, then a default one is picked, and the frame rate
343
- is changed on-the-fly. Otherwise the source frame rate is used.
344
-
345
- Providing ``encoder_frame_rate`` will override this behavior and
346
- make encoder attempts to use the provided sample rate.
347
- The provided value must be one support by the encoder.
348
-
349
- encoder_width (int or None, optional): Width of the image used for encoding.
350
- This allows to change the image size during encoding.
351
-
352
- encoder_height (int or None, optional): Height of the image used for encoding.
353
- This allows to change the image size during encoding.
354
-
355
- encoder_format (str or None, optional): {encoder_format}
356
-
357
- codec_config (CodecConfig or None, optional): {codec_config}
358
-
359
- filter_desc (str or None, optional): {filter_desc}
360
-
361
- hw_accel (str or None, optional): Enable hardware acceleration.
362
-
363
- When video is encoded on CUDA hardware, for example
364
- `encoder="h264_nvenc"`, passing CUDA device indicator to `hw_accel`
365
- (i.e. `hw_accel="cuda:0"`) will make StreamingMediaEncoder expect video
366
- chunk to be CUDA Tensor. Passing CPU Tensor will result in an error.
367
-
368
- If `None`, the video chunk Tensor has to be CPU Tensor.
369
- Default: ``None``.
370
- """
371
- self._s.add_video_stream(
372
- frame_rate,
373
- width,
374
- height,
375
- format,
376
- encoder,
377
- encoder_option,
378
- encoder_format,
379
- encoder_frame_rate,
380
- encoder_width,
381
- encoder_height,
382
- hw_accel,
383
- _convert_config(codec_config),
384
- filter_desc,
385
- )
386
-
387
- def set_metadata(self, metadata: Dict[str, str]):
388
- """Set file-level metadata
389
-
390
- Args:
391
- metadata (dict or None, optional): File-level metadata.
392
- """
393
- self._s.set_metadata(metadata)
394
-
395
- def _print_output_stream(self, i: int):
396
- """[debug] Print the registered stream information to stdout."""
397
- self._s.dump_format(i)
398
-
399
- def open(self, option: Optional[Dict[str, str]] = None) -> "StreamingMediaEncoder":
400
- """Open the output file / device and write the header.
401
-
402
- :py:class:`StreamingMediaEncoder` is also a context manager and therefore supports the
403
- ``with`` statement.
404
- This method returns the instance on which the method is called (i.e. `self`),
405
- so that it can be used in `with` statement.
406
- It is recommended to use context manager, as the file is closed automatically
407
- when exiting from ``with`` clause.
408
-
409
- Args:
410
- option (dict or None, optional): Private options for protocol, device and muxer. See example.
411
-
412
- Example - Protocol option
413
- >>> s = StreamingMediaEncoder(dst="rtmp://localhost:1234/live/app", format="flv")
414
- >>> s.add_video_stream(...)
415
- >>> # Passing protocol option `listen=1` makes StreamingMediaEncoder act as RTMP server.
416
- >>> with s.open(option={"listen": "1"}) as f:
417
- >>> f.write_video_chunk(...)
418
-
419
- Example - Device option
420
- >>> s = StreamingMediaEncoder("-", format="sdl")
421
- >>> s.add_video_stream(..., encoder_format="rgb24")
422
- >>> # Open SDL video player with fullscreen
423
- >>> with s.open(option={"window_fullscreen": "1"}):
424
- >>> f.write_video_chunk(...)
425
-
426
- Example - Muxer option
427
- >>> s = StreamingMediaEncoder("foo.flac")
428
- >>> s.add_audio_stream(...)
429
- >>> s.set_metadata({"artist": "torio contributors"})
430
- >>> # FLAC muxer has a private option to not write the header.
431
- >>> # The resulting file does not contain the above metadata.
432
- >>> with s.open(option={"write_header": "false"}) as f:
433
- >>> f.write_audio_chunk(...)
434
- """
435
- if not self._is_open:
436
- self._s.open(option)
437
- self._is_open = True
438
- return self
439
-
440
- def close(self):
441
- """Close the output
442
-
443
- :py:class:`StreamingMediaEncoder` is also a context manager and therefore supports the
444
- ``with`` statement.
445
- It is recommended to use context manager, as the file is closed automatically
446
- when exiting from ``with`` clause.
447
-
448
- See :py:meth:`StreamingMediaEncoder.open` for more detail.
449
- """
450
- if self._is_open:
451
- self._s.close()
452
- self._is_open = False
453
-
454
- def write_audio_chunk(self, i: int, chunk: torch.Tensor, pts: Optional[float] = None):
455
- """Write audio data
456
-
457
- Args:
458
- i (int): Stream index.
459
- chunk (Tensor): Waveform tensor. Shape: `(frame, channel)`.
460
- The ``dtype`` must match what was passed to :py:meth:`add_audio_stream` method.
461
- pts (float, optional, or None): If provided, overwrite the presentation timestamp.
462
-
463
- .. note::
464
-
465
- The provided value is converted to integer value expressed in basis of
466
- sample rate. Therefore, it is truncated to the nearest value of
467
- ``n / sample_rate``.
468
- """
469
- self._s.write_audio_chunk(i, chunk, pts)
470
-
471
- def write_video_chunk(self, i: int, chunk: torch.Tensor, pts: Optional[float] = None):
472
- """Write video/image data
473
-
474
- Args:
475
- i (int): Stream index.
476
- chunk (Tensor): Video/image tensor.
477
- Shape: `(time, channel, height, width)`.
478
- The ``dtype`` must be ``torch.uint8``.
479
- The shape (height, width and the number of channels) must match
480
- what was configured when calling :py:meth:`add_video_stream`
481
- pts (float, optional or None): If provided, overwrite the presentation timestamp.
482
-
483
- .. note::
484
-
485
- The provided value is converted to integer value expressed in basis of
486
- frame rate. Therefore, it is truncated to the nearest value of
487
- ``n / frame_rate``.
488
- """
489
- self._s.write_video_chunk(i, chunk, pts)
490
-
491
- def flush(self):
492
- """Flush the frames from encoders and write the frames to the destination."""
493
- self._s.flush()
494
-
495
- def __enter__(self):
496
- """Context manager so that the destination is closed and data are flushed automatically."""
497
- return self
498
-
499
- def __exit__(self, exception_type, exception_value, traceback):
500
- """Context manager so that the destination is closed and data are flushed automatically."""
501
- self.flush()
502
- self.close()
torio/lib/__init__.py DELETED
File without changes
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
torio/utils/__init__.py DELETED
@@ -1,4 +0,0 @@
1
- from . import ffmpeg_utils
2
-
3
-
4
- __all__ = ["ffmpeg_utils"]