From 59f158ed8092ce234619074b9fe00b41ef045f50 Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Tue, 4 Jun 2024 21:14:55 -0400 Subject: [PATCH] Use pyav 12.1 --- auto_editor/subcommands/subdump.py | 14 +++++++------- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/auto_editor/subcommands/subdump.py b/auto_editor/subcommands/subdump.py index a7ed7095c..721649136 100644 --- a/auto_editor/subcommands/subdump.py +++ b/auto_editor/subcommands/subdump.py @@ -1,7 +1,7 @@ import sys import av -from av.subtitles.subtitle import SubtitleSet +from av.subtitles.subtitle import AssSubtitle, TextSubtitle def main(sys_args: list[str] = sys.argv[1:]) -> None: @@ -10,12 +10,12 @@ def main(sys_args: list[str] = sys.argv[1:]) -> None: for s in range(len(container.streams.subtitles)): print(f"file: {input_file} ({s}:{container.streams.subtitles[s].name})") for packet in container.demux(subtitles=s): - for item in packet.decode(): - if type(item) is SubtitleSet and item: - if item[0].type == b"ass": - print(item[0].ass.decode("utf-8")) - elif item[0].type == b"text": - print(item[0].text) + for subset in packet.decode(): + for sub in subset.rects: + if isinstance(sub, AssSubtitle): + print(sub.ass.decode("utf-8", errors="ignore")) + elif isinstance(sub, TextSubtitle): + print(sub.text.decode("utf-8", errors="ignore")) print("------") diff --git a/pyproject.toml b/pyproject.toml index 993f8178c..c3084c316 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ authors = [{ name = "WyattBlue", email = "wyattblue@auto-editor.com" }] requires-python = ">=3.10" dependencies = [ "numpy>=1.22.0", - "pyav==12.0.5", + "pyav==12.1.0", "ae-ffmpeg==1.2.*", ] keywords = [