Skip to main content

WebVTT reader, writer and segmenter

Project description

pypi Supported Python versions MIT License coverage build-status Documentation Status Downloads

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

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 output/path

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 Distribution

webvtt-py-0.5.0.tar.gz (53.9 kB view details)

Uploaded Source

Built Distribution

webvtt_py-0.5.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file webvtt-py-0.5.0.tar.gz.

File metadata

  • Download URL: webvtt-py-0.5.0.tar.gz
  • Upload date:
  • Size: 53.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.6

File hashes

Hashes for webvtt-py-0.5.0.tar.gz
Algorithm Hash digest
SHA256 df07bff9005a411b403569f9e8e1c8c58e78bc80714d4e4ec81f6216989da0e5
MD5 41829f0cbc27a6a3a43c534a3b7eb82c
BLAKE2b-256 17c18528a8120a66fd175ae0a7ba0ca244425b2f7e391d7db6c97d301ff8e19a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: webvtt_py-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.6

File hashes

Hashes for webvtt_py-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92080e4248b51646f80b1d8a8238a06245e1d1970f26b7f6ea866777cc0e2d2b
MD5 dd58e2bc0442e85b1710a44eab1a139b
BLAKE2b-256 e7142cc1f1b21c54fce63d1abf4d12708bfcb082a2f9ffd9b5c122c7c55594bd

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