Skip to content

python script to convert all SIMPLE vtt files in a directory and all of its subdirectories to srt subtitle format

License

Notifications You must be signed in to change notification settings

jsonzilla/vtt_to_srt3

Folders and files

NameName
Last commit message
Last commit date
Nov 11, 2022
Nov 6, 2022
Jan 21, 2023
Sep 7, 2024
Sep 9, 2024
Jun 12, 2021
Nov 6, 2022
Nov 11, 2022
Nov 11, 2022
May 15, 2020
Nov 11, 2022
Sep 7, 2024
Nov 11, 2022
Jun 12, 2021
Sep 7, 2024

Repository files navigation

vtt_to_srt3

Convert vtt files to srt subtitle format

For Python 3.x

Docs

https://jsonzilla.github.io/vtt_to_srt3/

Installation

pip install vtt_to_srt3
python -m pip install vtt_to_srt3

Usage from terminal

usage: vtt_to_srt [-h] [-r] [-e ENCODING] [-rf] pathname

Convert vtt files to srt files

positional arguments:
  pathname              a file or directory with files to be converted

options:
  -h, --help            show this help message and exit
  -r, --recursive       walk path recursively
  -e ENCODING, --encoding ENCODING
                        encoding format for input and output files
  -rf, --remove_format  remove the format tags like bold & italic from output files

Usage as a lib

Convert vtt file

from vtt_to_srt.vtt_to_srt import ConvertFile

convert_file = ConvertFile("input_utf8.vtt", "utf-8")
convert_file.convert()

Recursively convert all vtt files in directory

from vtt_to_srt.vtt_to_srt import ConvertDirectories

recursive = False
convert_file = ConvertDirectories(".", recursive, "utf-8")
convert_file.convert()

Manual build

Generate wheel

python -m pip install --upgrade setuptools wheel build
python -m build

Generate documentation

Generate documentation

python -m pip install pdoc3
pdoc --html vtt_to_srt/vtt_to_srt.py -o docs
mv docs/vtt_to_srt.html docs/index.html
rm -rm docs/vtt_to_srt