02
2025
07
15:51:44

开源字幕转换工具 VTT 字幕 转 ASS 字母



VTT 转 ASS

宝石版本

描述

这是一个简单的命令行界面(CLI)应用程序,用于将VTT文件转换为ASS字幕文件。

该应用程序最初基于vttconvertanidl/hidive-downloader-nx仓库的模块。 maxwbot/maxwhidive仓库也作为处理字幕定位的灵感来源。

那两个工具缺少功能,并且在许多更复杂的字幕文件上无法正常工作。出于这个原因,我写了一个可以处理所有事情的新工具。

功能

  • 转换简单的 VTT 文件

  • 转换复杂的带定位信息的VTT文件

  • 使用CSS样式转换Hidive VTT文件

  • 通过指定输入目录批量转换字幕

  • 处理为低分辨率视频制作的字幕

  • 可以为字幕行添加偏移量

  • 可以将结果输出到 CLI

  • 可以输出到指定目录

  • 可以更改基础字体大小

  • 可以为非样式化线条指定自定义字体系列

  • 可以为转换后的文件添加标题

要求

  • Ruby 2.7.2 或更新版本

开发目前在 ruby 3.0+ 进行,但是用于构建的 Gitlab runner 支持 ruby 版本 2.7.2。较早版本的 ruby 可能兼容,但不会进行测试。

安装

安装:

$ gem install vtt2ass

用法

  • 空参数列表列出可用命令

$ vtt2ass
Commands:
  vtt2ass convert INPUT   # Run the VTT to ASS conversion for the specified file(s)
  vtt2ass help [COMMAND]  # Describe available commands or one specific command
  vtt2ass version         # Show version
  • 帮助命令显示指定命令的可用选项

$ vtt2ass help convert
Usage:
  vtt2ass convert INPUT

Options:
  -o, [--output=OUTPUT]            # Output directory of the converted file
  -t, [--title=TITLE]              # Specify a title for you file. If the input is a directory, all files will share the same title.
  -s, [--font-size=N]              # Specify a font size for the subtitles
                                   # Default: 52
  -f, [--font-family=FONT_FAMILY]  # Specify a font family for the subtitles
                                   # Default: Open Sans Semibold
  -c, [--css=CSS]                  # Specify a CSS file path for Hidive subs
  -l, [--line-offset=N]            # Specify a line offset for the main dialog (e.g. 50 lowers the text line by 50px of the total height)
                                   # Default: 0
  -w, [--width=N]                  # Specify the video width
                                   # Default: 1920
  -h, [--height=N]                 # Specify the video height
                                   # Default: 1080
  -q, [--quiet], [--no-quiet]      # Don't output to the consoleRun the VTT to ASS conversion for the specified file(s)
  • 转换命令

$ vtt2ass convert ./path/to/input/ -o ./path/to/output/ -l 50 -q
  • 版本命令显示应用程序版本

$ vtt2ass version
0.3.3

贡献

欢迎贡献。请在Gitlab上创建一个问题并链接到拉取请求,记录所作的更改。更改需要通过Ruby测试。

$ rake test

构建

要构建用于本地安装的 gem 文件:

$ git clone https://gitlab.com/dkb-weeblets/vtt2ass.git
$ cd vtt2ass/
$ gem build vtt2ass.gemspec

要安装 gem 文件:

$ gem install ./vtt2ass-0.3.5.gem



开源地址:https://github.com/lowpolyfire/vtt2ass



推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

本文链接:https://zblog.hqyman.cn/post/12102.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:
打赏





休息一下~~


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

请先 登录 再评论,若不是会员请先 注册

您的IP地址是: