https://github.com/bizz84/convert-srt-vtt
Bash script to convert closed captions from SRT to VTT format
https://github.com/bizz84/convert-srt-vtt
Last synced: 6 months ago
JSON representation
Bash script to convert closed captions from SRT to VTT format
- Host: GitHub
- URL: https://github.com/bizz84/convert-srt-vtt
- Owner: bizz84
- License: mit
- Created: 2019-08-23T10:26:28.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-23T11:01:56.000Z (about 6 years ago)
- Last Synced: 2025-04-26T06:02:28.336Z (6 months ago)
- Language: Shell
- Size: 3.91 KB
- Stars: 15
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Srt to VTT converter
This script can be used to convert subtitles from Srt to VTT format.
## Example workflow: Generate VTT subtitles for your own videos
### Upload Video to YouTube and generate Closed Captions
- Upload video: [https://www.youtube.com/upload](https://www.youtube.com/upload)
- Open with the (old) Creator Studio
- Set video as unlisted (if this should not be public)
- Once video is uploaded, select Subtitles/CC tab and wait until CCs are published (auto-generated)
- Then Click on the Generated CC and download the subtitles in `.srt` format.**NOTE**: YouTube supports downloading captions in VTT format as well. But the VTT format used is not supported by all players (e.g. Udemy).
Hence, this script was created to convert `.srt` to "simple" `.vtt`.
## Convert
Run:
```
convert-srt-vtt.sh file.srt
```This will output a `file.srt.vtt` file.
## Batch convert
To convert all files in a given folder, run:
```
convert-all-srt-vtt.sh
```## Overlapping captions
When using `.srt`, the start and end times for each caption can overlap.
Example input file (notice how the end time of each caption is after the start time of the next caption):
```
1
00:00:00,030 --> 00:00:04,920
hello and welcome to my course on coding2
00:00:02,730 --> 00:00:06,930
with flutter by taking this course you3
00:00:04,920 --> 00:00:09,510
will learn how to use flutter to build
```Unfortunately, not all players support overlapping captions.
So this script manipulates the timestamps, so that each caption starts exactly at the end of the previous one.
Example output file:
```
WEBVTT00:00:00.030 --> 00:00:02.730
hello and welcome to my course on coding00:00:02.730 --> 00:00:04.920
with flutter by taking this course you00:00:04.920 --> 00:00:06.930
will learn how to use flutter to build
```