Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glut23/webvtt-py
Read, write, convert and segment WebVTT caption files in Python.
https://github.com/glut23/webvtt-py
captions hls python sbv srt subtitles subtitles-parsing webvtt
Last synced: 1 day ago
JSON representation
Read, write, convert and segment WebVTT caption files in Python.
- Host: GitHub
- URL: https://github.com/glut23/webvtt-py
- Owner: glut23
- License: mit
- Created: 2016-05-12T10:03:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-06-13T13:47:27.000Z (5 months ago)
- Last Synced: 2024-10-04T06:48:22.334Z (about 2 months ago)
- Topics: captions, hls, python, sbv, srt, subtitles, subtitles-parsing, webvtt
- Language: Python
- Homepage:
- Size: 278 KB
- Stars: 188
- Watchers: 2
- Forks: 56
- Open Issues: 14
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
webvtt-py
=========|pypi| |pyversions| |license| |coverage| |build-status| |docs-status| |downloads|
``webvtt-py`` is a Python library for reading, writing and converting WebVTT_ caption files. It also features caption segmentation useful when captioning `HLS videos`_.
Documentation is available at http://webvtt-py.readthedocs.io.
.. _`WebVTT`: https://www.w3.org/TR/webvtt1/
.. _`HLS videos`: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bisInstallation
------------::
$ pip install webvtt-py
Usage
-----.. code-block:: python
import webvtt
for caption in webvtt.read('captions.vtt'):
print(caption.identifier) # cue identifier if any
print(caption.start) # cue start time
print(caption.end) # cue end time
print(caption.text) # cue payload
print(caption.voice) # cue voice span if anySegmenting for HLS
------------------.. code-block:: python
import webvtt
webvtt.segment('captions.vtt', 'output/path')
Converting captions from other formats
--------------------------------------Supported formats:
* SubRip (.srt)
* YouTube SBV (.sbv).. code-block:: python
import webvtt
webvtt = webvtt.from_srt('captions.srt')
webvtt.save()# alternatively in a single line
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.
.. |pypi| image:: https://img.shields.io/pypi/v/webvtt-py.svg
:target: https://pypi.python.org/pypi/webvtt-py.. |pyversions| image:: https://img.shields.io/pypi/pyversions/webvtt-py.svg
:alt: Supported Python versions
:target: https://pypi.python.org/pypi/webvtt-py.. |license| image:: https://img.shields.io/pypi/l/webvtt-py.svg
:alt: MIT License
:target: https://opensource.org/licenses/MIT.. |coverage| image:: https://codecov.io/gh/glut23/webvtt-py/graph/badge.svg?branch=master
:target: https://codecov.io/gh/glut23/webvtt-py.. |build-status| image:: https://github.com/glut23/webvtt-py/actions/workflows/ci.yml/badge.svg?branch=master
:target: https://github.com/glut23/webvtt-py/actions/workflows/ci.yml.. |docs-status| image:: https://readthedocs.org/projects/webvtt-py/badge/?version=latest
:target: http://webvtt-py.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status.. |downloads| image:: https://static.pepy.tech/badge/webvtt-py
:target: https://pepy.tech/project/webvtt-py
:alt: Downloads