Skip to main content

Extract EIA-608 captions from Video Transport Stream (*.ts) fileand convert them to SubRip (*.srt) or Video Text Tracks (*.vtt) subtitles

Project description

TS-CC Extractor

Tests PyPi version Supported Python versions License

With this pure-python utility you can extract EIA-608 captions from Video Transport Stream (*.ts) file and convert them to SubRip (*.srt) or Video Text Tracks (*.vtt) subtitles.

Installation

pip install ts-cc-extractor

Usage

usage: ts-cc-extractor -i PATH -o PATH [-f {SRT,VTT}] [-v] [-h]

required arguments:
  -i PATH        Path to *.ts file
  -o PATH        Output subtitles file

optional arguments:
  -f {SRT,VTT}   Subtitles format (default: SRT)
  -v, --version  show program's version number and exit
  -h, --help     show this help message and exit

API example

from ts_cc_extractor import extract_subtitles

with open('video1.ts') as f:
    subs_text = extract_subtitles(f, fmt='VTT')
    print(subs_text)
WEBVTT

00:01.705 --> 00:03.974 align:left position:10% line:5% size:80%
THAT'S JUST THE WAY IT GOES.
I DONE SEEN IT TOO MANY TIMES.

00:03.974 --> 00:05.609 align:left position:30% line:89% size:60%
HEY, Y'ALL READY?

...

CLI example

$ ts-cc-extractor -i video2.ts -o subs.srt -f SRT
$ cat subs.srt
1
00:00:01,967 --> 00:00:05,633                       
>> HARRY AND MEGHAN WERE IN THE
MAJOR GENERAL'S OFFICE

2
00:00:05,633 --> 00:00:10,533       
OVERLOOKING THE PAGEANTLY OF THE
HORSE GUARDS PARADE AND THE

3
00:00:10,533 --> 00:00:10,800  
TROOPING.

...

License

BSD

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

ts-cc-extractor-0.0.3.tar.gz (40.9 kB view hashes)

Uploaded Source

Built Distribution

ts_cc_extractor-0.0.3-py3-none-any.whl (43.6 kB view hashes)

Uploaded Python 3

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