VTT到SRT字幕转换包
vtt-to-srt的Python项目详细描述
vtt_to_srt.py
python 2.7的有用python脚本
将所有VTT文件转换为SRT字幕格式
终端使用:
vtt_to_srt.py pathname [-r]
pathname - a file or directory with files to be converted
-r - walk path recursively
作为库:
安装:
pip install --user vtt_to_srt
用法:
# convert vtt file
from vtt_to_srt import vtt_to_srt
path = '/path/to/file.vtt'
vtt_to_srt(path)
# recursively convert all vtt files in directory
from vtt_to_srt import vtts_to_srt
path = '/path/to/directory'
vtts_to_srt(path, rec = True)