https://github.com/jsonzilla/vtt_to_srt3
python script to convert all SIMPLE vtt files in a directory and all of its subdirectories to srt subtitle format
https://github.com/jsonzilla/vtt_to_srt3
srt srt-subtitle-format vtt vtt-files
Last synced: 5 months ago
JSON representation
python script to convert all SIMPLE vtt files in a directory and all of its subdirectories to srt subtitle format
- Host: GitHub
- URL: https://github.com/jsonzilla/vtt_to_srt3
- Owner: jsonzilla
- License: apache-2.0
- Created: 2019-07-19T15:23:56.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-21T11:31:05.000Z (over 1 year ago)
- Last Synced: 2025-10-17T00:40:51.410Z (5 months ago)
- Topics: srt, srt-subtitle-format, vtt, vtt-files
- Language: Python
- Homepage: https://pypi.org/project/vtt-to-srt3/
- Size: 104 KB
- Stars: 66
- Watchers: 2
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# vtt_to_srt3
Convert vtt files to srt subtitle format
> For Python 3.x
* [you can get a new version for Python 2.7 here](https://github.com/jsonzilla/vtt_to_srt2)
* [you can get the old version for Python 2.7 here](https://github.com/jansenicus/vtt-to-srt.py)
## Docs
[https://jsonzilla.github.io/vtt_to_srt3/](https://jsonzilla.github.io/vtt_to_srt3/)
## Installation
```shell
pip install vtt_to_srt3
```
```cmd
python -m pip install vtt_to_srt3
```
## Usage from terminal
```shell
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
```python
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
```python
from vtt_to_srt.vtt_to_srt import ConvertDirectories
recursive = False
convert_file = ConvertDirectories(".", recursive, "utf-8")
convert_file.convert()
```
## Manual build
Generate wheel
```shell
python -m pip install --upgrade setuptools wheel build
python -m build
```
## Generate documentation
Generate documentation
```shell
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
```