Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions devine/core/tracks/subtitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pycaption.geometry import Layout
from pymp4.parser import MP4
from subtitle_filter import Subtitles
from subby import ISMTConverter

from devine.core import binaries
from devine.core.tracks.track import Track
Expand Down Expand Up @@ -274,6 +275,12 @@ def convert(self, codec: Subtitle.Codec) -> Path:
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
elif self.codec in Subtitle.Codec.fTTML:
output_path = self.path.with_suffix(".srt")
converter = ISMTConverter()
srt = converter.from_file(self.path)
srt.save(output_path)
codec = Subtitle.Codec.SubRip
else:
writer = {
# pycaption generally only supports these subtitle formats
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Unidecode = "^1.3.8"
urllib3 = "^2.2.1"
chardet = "^5.2.0"
curl-cffi = "^0.7.0b4"
subby = {git = "https://github.com/Parasitic5283/subby.git", rev = "Update-lxml"} # Until https://github.com/vevv/subby/pull/31 is merged

[tool.poetry.dev-dependencies]
pre-commit = "^3.7.0"
Expand Down