Skip to main content

Subtitles delocalizer tools.

Project description

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:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

subdeloc_tools-0.9.4-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file subdeloc_tools-0.9.4-py3-none-any.whl.

File metadata

  • Download URL: subdeloc_tools-0.9.4-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for subdeloc_tools-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 297a822887b2a1dc824e0b79ff836fe9a94eced3b196a5a903f30454765fc186
MD5 cd93a590b10a976c54013b291a843245
BLAKE2b-256 51c9131a5ddd2c0ab269f21ab2dcc2aed9c2453b2b3f735ad2340c0b4c5540c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page