typed-ffmpeg-compatible 2.1.0__py3-none-any.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.
- typed_ffmpeg/__init__.py +25 -0
- typed_ffmpeg/base.py +114 -0
- typed_ffmpeg/common/__init__.py +0 -0
- typed_ffmpeg/common/schema.py +308 -0
- typed_ffmpeg/common/serialize.py +132 -0
- typed_ffmpeg/dag/__init__.py +13 -0
- typed_ffmpeg/dag/compile.py +51 -0
- typed_ffmpeg/dag/context.py +221 -0
- typed_ffmpeg/dag/factory.py +31 -0
- typed_ffmpeg/dag/global_runnable/__init__.py +0 -0
- typed_ffmpeg/dag/global_runnable/global_args.py +178 -0
- typed_ffmpeg/dag/global_runnable/runnable.py +174 -0
- typed_ffmpeg/dag/io/__init__.py +0 -0
- typed_ffmpeg/dag/io/_input.py +197 -0
- typed_ffmpeg/dag/io/_output.py +318 -0
- typed_ffmpeg/dag/io/output_args.py +327 -0
- typed_ffmpeg/dag/nodes.py +479 -0
- typed_ffmpeg/dag/schema.py +210 -0
- typed_ffmpeg/dag/utils.py +41 -0
- typed_ffmpeg/dag/validate.py +172 -0
- typed_ffmpeg/exceptions.py +42 -0
- typed_ffmpeg/filters.py +3510 -0
- typed_ffmpeg/probe.py +43 -0
- typed_ffmpeg/py.typed +0 -0
- typed_ffmpeg/schema.py +29 -0
- typed_ffmpeg/streams/__init__.py +5 -0
- typed_ffmpeg/streams/audio.py +6955 -0
- typed_ffmpeg/streams/av.py +22 -0
- typed_ffmpeg/streams/channel_layout.py +39 -0
- typed_ffmpeg/streams/video.py +12974 -0
- typed_ffmpeg/types.py +119 -0
- typed_ffmpeg/utils/__init__.py +0 -0
- typed_ffmpeg/utils/escaping.py +49 -0
- typed_ffmpeg/utils/lazy_eval/__init__.py +0 -0
- typed_ffmpeg/utils/lazy_eval/operator.py +134 -0
- typed_ffmpeg/utils/lazy_eval/schema.py +211 -0
- typed_ffmpeg/utils/run.py +27 -0
- typed_ffmpeg/utils/snapshot.py +26 -0
- typed_ffmpeg/utils/typing.py +17 -0
- typed_ffmpeg/utils/view.py +64 -0
- typed_ffmpeg_compatible-2.1.0.dist-info/LICENSE +21 -0
- typed_ffmpeg_compatible-2.1.0.dist-info/METADATA +183 -0
- typed_ffmpeg_compatible-2.1.0.dist-info/RECORD +45 -0
- typed_ffmpeg_compatible-2.1.0.dist-info/WHEEL +4 -0
- typed_ffmpeg_compatible-2.1.0.dist-info/entry_points.txt +3 -0
typed_ffmpeg/probe.py
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
import json
|
2
|
+
import logging
|
3
|
+
import subprocess
|
4
|
+
from pathlib import Path
|
5
|
+
from typing import Any
|
6
|
+
|
7
|
+
from .exceptions import FFMpegExecuteError
|
8
|
+
from .utils.escaping import convert_kwargs_to_cmd_line_args
|
9
|
+
from .utils.run import command_line
|
10
|
+
|
11
|
+
logger = logging.getLogger(__name__)
|
12
|
+
|
13
|
+
|
14
|
+
def probe(filename: str | Path, cmd: str = "ffprobe", timeout: int | None = None, **kwargs: Any) -> dict[str, Any]:
|
15
|
+
"""
|
16
|
+
Run ffprobe on the given file and return a JSON representation of the output
|
17
|
+
|
18
|
+
Args:
|
19
|
+
filename: The path to the file to probe.
|
20
|
+
cmd: The ffprobe command to run. Defaults to "ffprobe".
|
21
|
+
timeout: The timeout for the command. Defaults to None.
|
22
|
+
**kwargs: The arguments for the ffprobe command.
|
23
|
+
|
24
|
+
Returns:
|
25
|
+
The JSON representation of the ffprobe output.
|
26
|
+
"""
|
27
|
+
args = [cmd, "-show_format", "-show_streams", "-of", "json"]
|
28
|
+
args += convert_kwargs_to_cmd_line_args(kwargs)
|
29
|
+
args += [str(filename)]
|
30
|
+
|
31
|
+
logger.info("Running ffprobe command: %s", command_line(args))
|
32
|
+
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
33
|
+
|
34
|
+
if timeout is not None:
|
35
|
+
out, err = p.communicate(timeout=timeout)
|
36
|
+
else:
|
37
|
+
out, err = p.communicate()
|
38
|
+
|
39
|
+
retcode = p.poll()
|
40
|
+
if p.returncode != 0:
|
41
|
+
raise FFMpegExecuteError(retcode=retcode, cmd=command_line(args), stdout=out, stderr=err)
|
42
|
+
|
43
|
+
return json.loads(out.decode("utf-8"))
|
typed_ffmpeg/py.typed
ADDED
File without changes
|
typed_ffmpeg/schema.py
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
"""
|
2
|
+
Defines the basic schema for the ffmpeg command line options.
|
3
|
+
"""
|
4
|
+
|
5
|
+
|
6
|
+
from .common.schema import StreamType
|
7
|
+
|
8
|
+
|
9
|
+
class Default(str):
|
10
|
+
"""
|
11
|
+
This is the default value for an option. It is used for annotation purposes only
|
12
|
+
and will not be passed to the ffmpeg command line.
|
13
|
+
"""
|
14
|
+
|
15
|
+
...
|
16
|
+
|
17
|
+
|
18
|
+
class Auto(Default):
|
19
|
+
"""
|
20
|
+
This is the auto value for an option. It is used for annotation purposes only
|
21
|
+
and will not be passed to the ffmpeg command line.
|
22
|
+
"""
|
23
|
+
|
24
|
+
|
25
|
+
__all__ = [
|
26
|
+
"Auto",
|
27
|
+
"Default",
|
28
|
+
"StreamType",
|
29
|
+
]
|