Skip to main content

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

Metadata

Release files for undertext 0.4.1

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

Source distribution (sdist)

Source distribution for undertext 0.4.1
File Size Uploaded
undertext-0.4.1.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for undertext 0.4.1
File Interpreter ABI Platform
undertext-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 27.4 kB

Release files / undertext-0.4.1.tar.gz

Download URL undertext-0.4.1.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0f1a4517301ba2c29f51079662613e4cca979864cc250a74be93001e035a09cb
BLAKE2b-256 checksum
How to use checksums
b6e40bab61557973a695634d048f86fcf74ed294b8c691c812f0e1f838533795
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Release files / undertext-0.4.1-py3-none-any.whl

Download URL undertext-0.4.1-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0868aaf32a55ed243b7f8df91dbcb7f9dbdaad07649402fb768096d4fd106357
BLAKE2b-256 checksum
How to use checksums
c21970375bc1efb323c878054c6dd99a9ee41cce322eb2ec48ab7a5b1281f716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.0

2 release files

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