Skip to main content

Subtitle Delocalizer Tools


SubTools

Main class

Common usage

res = pairsubs.pair_files("main_subtitle.ass", "japanese_reference.ass") # Generates PairSubtitles JSON
s = self.search_honorifics(res) # Modify texts in the PairSubtitles JSON, adding the required honorifics
honorific_fixer.fix_original("main_subtitle.ass", s) # Generates a new ASS file with updated subtitles

Modules

Extract Subs

Extract subtitle file from an MKV based on the index or the lang(Requires FFMPEG). Extracts both ASS and SRT subtitles.

from subdeloc_tools.modules import extract_subs

generated_filename = extract_subs_by_lang("subtitle.ass", "eng")
generated_filename = extract_subs_by_index("subtitle.srt", 1)

Merger

Mux/Demux subs from an MKV file.

from .merger import Merger

merger = Merger()
merger.set_file("subtitle.mkv")
streams = merger.get_streams()
index = merger.get_language_index("en")
generated_filename = merger.demux("subtitle.mkv", index, "output.ass")

Shift Subs

Shift subtitles a determined amount of seconds. Allows to choose a threshold to choose from which point to shift.

from subdeloc_tools.modules import shift_subs

generated_filename = shift_sub("subtitle.ass", 10, 102900) # Shift 10 seconds from 00:01:42
generated_filename = shift_sub("subtitle.ass", 10, 0) # Shift 10 seconds all subs

Pair subs

Pair 2 subtitle file subs based on the time. Generates a PairSubtitles JSON

from subdeloc_tools.modules import pairsubs

res = pairsubs.pair_files("main_subtitle.ass", "japanese_reference.ass")

Honorific Fixer

Receives a PairSubtitles JSON, and an ASS file used to generate it, and creates a new ASS file with the modified subs

from subdeloc_tools.modules import honorific_fixer

honorific_fixer.fix_original("main_subtitle.ass", s)

Glossary

PairSubtitles JSON

[
  {
    "start": 0,
    "end": 12250,
    "reference": [
      {
        "start": 0,
        "end": 12180,
        "text": "こんにちは世界",
        "nl": 1
      }
    ],
    "original": [
      {
        "start": 1000,
        "end": 12250,
        "text": "Hello World",
        "nl": 1
      }
    ]
  },
  ...
]

Sister projects:

Metadata

Release files for subdeloc-tools 0.9.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for subdeloc-tools 0.9.12
File Interpreter ABI Platform Actions
subdeloc_tools-0.9.12-py3-none-any.whl Python 3 none any Details for subdeloc_tools-0.9.12-py3-none-any.whl

Release files / subdeloc_tools-0.9.12-py3-none-any.whl

Download URL subdeloc_tools-0.9.12-py3-none-any.whl
Size 31.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7657fda91d8b0e9b74eb116b1de6ed5c2daa4d5fcb84fac5b7b94de3d919689f
BLAKE2b-256 checksum
How to use checksums
318e6513a7959290c0866b17d9ec66aaa5b4075366ae9a35a8cac4f99ced21f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Security for subdeloc-tools 0.9.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page