Skip to main content

library to load, edit and save different formats of subtitles

Project description

undertext

library to load, edit and save different formats of subtitles

PyPI - Version

[!NOTE] This Project is under development. Come back soon for updates

Installation

pip3 install undertext

File Formats

ext name read write Flags
.ass Advanced SubStation Alpha TT
.sbv SubViewer TT
.srt SubRip TT
.ssa Sub Station Alpha TT
.sub MicroDVD TF
.vtt WebVTT TT

*Listed formats that are currently unsupported may be added at a later version

Flag Information:

T. = Text Based
B. = Bitmap Based
.T = Time-Based
.F = Frame-Based

Examples

import undertext

captions = undertext.load("example.en.srt")
undertext.dump(captions, "example.en.vtt")
import undertext

captions = [
    undertext.Caption(start=0, end=10, text="Hello"),
    undertext.Caption(start=10, end=20, text="World"),
]
undertext.dump(captions, "out.srt")

CLI

[!NOTE] During the installation the undertext command should be installed and then available. If this didn't work you can invoke it with python3 -m undertext instead.

$ cat example.vtt
WEBVTT

00:00:00.000 --> 00:00:01.000
hello world 0

00:00:02.000 --> 00:00:03.000
hello world 2

00:00:04.000 --> 00:00:05.000
hello world 4

00:00:06.000 --> 00:00:07.000
hello world 6

00:00:08.000 --> 00:00:09.000
hello world 8
$ undertext read example.vtt
<00:00:00.000 -> 00:00:01.000> 'hello world 0'
<00:00:02.000 -> 00:00:03.000> 'hello world 2'
<00:00:04.000 -> 00:00:05.000> 'hello world 4'
<00:00:06.000 -> 00:00:07.000> 'hello world 6'
<00:00:08.000 -> 00:00:09.000> 'hello world 8'
$ undertext convert example.vtt output.srt 
$ cat output.srt
1
00:00:00,000 --> 00:00:01,000
hello world 0

2
00:00:02,000 --> 00:00:03,000
hello world 2

3
00:00:04,000 --> 00:00:05,000
hello world 4

4
00:00:06,000 --> 00:00:07,000
hello world 6

5
00:00:08,000 --> 00:00:09,000
hello world 8

Project details


Download files

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

Source Distribution

undertext-0.4.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

undertext-0.4.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file undertext-0.4.1.tar.gz.

File metadata

  • Download URL: undertext-0.4.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for undertext-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0f1a4517301ba2c29f51079662613e4cca979864cc250a74be93001e035a09cb
MD5 bc03f0fbcea328a09b008fb0e8541124
BLAKE2b-256 b6e40bab61557973a695634d048f86fcf74ed294b8c691c812f0e1f838533795

See more details on using hashes here.

File details

Details for the file undertext-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: undertext-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for undertext-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0868aaf32a55ed243b7f8df91dbcb7f9dbdaad07649402fb768096d4fd106357
MD5 6a8564684ea5789acf6781094e04af38
BLAKE2b-256 c21970375bc1efb323c878054c6dd99a9ee41cce322eb2ec48ab7a5b1281f716

See more details on using hashes here.

Supported by

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