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.3+.

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

Installation

$ pip install webvtt-py

Usage

from webvtt import WebVTT

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

Segmenting for HLS

from webvtt import WebVTTSegmenter

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

Converting captions from other formats

Supported formats:

  • SubRip (.srt)

  • YouTube SBV (.sbv)

from webvtt import WebVTT

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

# we can convert captions in one line
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.3.2-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for webvtt_py-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 422fc31c878248efe860da4d75e67bb8131aaccc8abbaf5297420189a48bce42
MD5 3017a6cf5425eb3f9e65322b9a5316ae
BLAKE2b-256 999d871e10473992f88292df94739a5b9c0f9e5fd576565c940b0e5b9462f87d

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