Skip to content

Commit

Permalink
Use pyav 12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Jun 5, 2024
1 parent 991c3fc commit 59f158e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions auto_editor/subcommands/subdump.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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("------")


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = [{ name = "WyattBlue", email = "[email protected]" }]
requires-python = ">=3.10"
dependencies = [
"numpy>=1.22.0",
"pyav==12.0.5",
"pyav==12.1.0",
"ae-ffmpeg==1.2.*",
]
keywords = [
Expand Down

0 comments on commit 59f158e

Please sign in to comment.