Skip to content

Commit 4ed81ee

Browse files
committed
Use pyav 12.1
1 parent 991c3fc commit 4ed81ee

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

auto_editor/subcommands/subdump.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22

33
import av
4-
from av.subtitles.subtitle import SubtitleSet
4+
from av.subtitles.subtitle import AssSubtitle, TextSubtitle
55

66

77
def main(sys_args: list[str] = sys.argv[1:]) -> None:
@@ -11,11 +11,11 @@ def main(sys_args: list[str] = sys.argv[1:]) -> None:
1111
print(f"file: {input_file} ({s}:{container.streams.subtitles[s].name})")
1212
for packet in container.demux(subtitles=s):
1313
for item in packet.decode():
14-
if type(item) is SubtitleSet and item:
15-
if item[0].type == b"ass":
16-
print(item[0].ass.decode("utf-8"))
17-
elif item[0].type == b"text":
18-
print(item[0].text)
14+
for sub in item.rects:
15+
if isinstance(sub, AssSubtitle):
16+
print(sub.ass.decode("utf-8", errors="ignore"))
17+
elif isinstance(sub, TextSubtitle):
18+
print(sub.text.decode("utf-8", errors="ignore"))
1919
print("------")
2020

2121

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ authors = [{ name = "WyattBlue", email = "wyattblue@auto-editor.com" }]
1010
requires-python = ">=3.10"
1111
dependencies = [
1212
"numpy>=1.22.0",
13-
"pyav==12.0.5",
13+
"pyav==12.1.0",
1414
"ae-ffmpeg==1.2.*",
1515
]
1616
keywords = [

0 commit comments

Comments
 (0)