Skip to main content

WebVTT reader, writer and segmenter

Project description

https://img.shields.io/pypi/v/webvtt-py.svg https://travis-ci.org/glut23/webvtt-py.svg?branch=master Documentation Status

webvtt-py is a Python module for reading/writing WebVTT caption files. It also features caption segmentation useful when captioning HLS videos.

Requires Python 3.4+.

Documentation is available at http://webvtt-py.readthedocs.io.

Installation

$ pip install webvtt-py

Usage

import webvtt

for caption in webvtt.read('captions.vtt'):
    print(caption.start)
    print(caption.end)
    print(caption.text)

Segmenting for HLS

import webvtt

webvtt.segment('captions.vtt', 'output/path')

Converting captions from other formats

Supported formats:

  • SubRip (.srt)

  • YouTube SBV (.sbv)

import webvtt

webvtt = webvtt.from_srt('captions.srt')
webvtt.save()

# one liner if we just need to convert without editing
webvtt.from_sbv('captions.sbv').save()

CLI

Caption segmentation is also available from the command line:

$ webvtt segment captions.vtt --output destination/directoy

License

Licensed under the MIT License.

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

webvtt_py-0.4.6-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file webvtt_py-0.4.6-py3-none-any.whl.

File metadata

  • Download URL: webvtt_py-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for webvtt_py-0.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5cf9da2a8c34bc789db599377be87b228b7e4734c629597edd27a8054e004a57
MD5 3841639ba16b2c7b37152dba6d9a3709
BLAKE2b-256 1b83115b001f8c79f9580834faf214062b1ff69f61c62ab1a5c3c1e5e347d4a3

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