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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file subdeloc_tools-0.9.8-py3-none-any.whl.
File metadata
- Download URL: subdeloc_tools-0.9.8-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d7ba3efdf2e3077fc52ea244ebf4f7c36dafb4c711b5a1283c5e07edd6706a9
|
|
| MD5 |
8c30dc9c92112512f04620306b5fcceb
|
|
| BLAKE2b-256 |
6348c531f3751efd49d70baaaddd18de78e9a6826818cf9299c262ca3a436d27
|