python自动生成字幕脚本_autosub-为任意视频自动生成字幕文件的命令行工具

Autosub

Auto-generated subtitles for any video

Autosub is a utility for automatic speech recognition and subtitle generation. It takes a video or an audio file as input, performs voice activity detection to find speech regions, makes parallel requests to Google Web Speech API to generate transcriptions for those regions, (optionally) translates them to a different language, and finally saves the resulting subtitles to disk. It supports a variety of input and output languages (to see which, run the utility with the argument --list-languages) and can currently produce subtitles in either the SRT format or simple JSON.

Installation

Install ffmpeg.

Run pip install autosub.

Usage

$ autosub -h

usage: autosub [-h] [-C CONCURRENCY] [-o OUTPUT] [-F FORMAT] [-S SRC_LANGUAGE]

[-D DST_LANGUAGE] [-K API_KEY] [--list-formats]

[--list-languages]

[source_path]

positional arguments:

source_path Path to the video or audio file to subtitle

optional arguments:

-h, --help show this help message and exit

-C CONCURRENCY, --concurrency CONCURRENCY

Number of concurrent API requests to make

-o OUTPUT, --output OUTPUT

Output path for subtitles (by default, subtitles are

saved in the same directory and name as the source

path)

-F FORMAT, --format FORMAT

Destination subtitle format

-S SRC_LANGUAGE, --src-language SRC_LANGUAGE

Language spoken in source file

-D DST_LANGUAGE, --dst-language DST_LANGUAGE

Desired language for the subtitles

-K API_KEY, --api-key API_KEY

The Google Translate API key to be used. (Required for

subtitle translation)

--list-formats List all available subtitle formats

--list-languages List all available source/destination languages

License

MIT

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值