Git Product home page Git Product logo

lissettecarlr / auto-subtitle Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 2.0 29.84 MB

使用faster-whisper本地模型提取音频,生成srt和ass字幕文件。支持gpt等在线翻译,生成翻译后字幕文件。(Use the faster-whisper local model to extract audio and generate srt and ass subtitle files. Support online translation such as gpt to generate translated subtitle files.)

Python 100.00%
faster-whisper streamlit subtitles whisper

auto-subtitle's Introduction

字幕生成器

一个能够自动生成媒体字幕的工具

目前功能:

* 输入视频
* 输入音频
* 输出srt字幕
* 输出ass字幕
* GPT字幕翻译
* 百度字幕翻译
* 腾讯字幕翻译
* 音频清洁

环境

  • conda

    conda create -n subtitle python=3.10
    conda activate subtitle
  • torch(CUDA 11.8,其他版本去官网找)

    # GPU
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
    
    # CPU
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
  • 安装ffmpeg(windows)。 去官网下载,解压后将bin目录添加到环境变量

  • 安装ffmpeg(ubuntu)

    apt install ffmpeg
  • 其他依赖

    pip install -r requirements.txt
    
    # 腾讯翻译
    pip install -i https://mirrors.tencent.com/pypi/simple/ --upgrade tencentcloud-sdk-python
    
    # 音频清洁
    # https://github.com/karaokenerds/python-audio-separator
    pip install audio-separator[gpu]
    pip install audio-separator[cpu]
    

模型下载

将下载的文件夹放入根目录的models文件夹中

  • 语音清洁相关模型

    • 百度云,目前只使用了UVR_MDXNET_Main.onnx,可以只下载它,但是文件夹目录结构还是要的一样的
  • vad

  • whisper模型

    • 可以使用时候自动下载,会被保存到huggingface的缓存目录中
    • 百度云,这压缩包包含上面的所有模型
    • huggingface

示例models目录结构

│models
|
├───faster-whisper-large-v3
│       .gitattributes
│       config.json
│       model.bin
│       preprocessor_config.json
│       README.md
│       tokenizer.json
│       vocabulary.json
│
│
├───silero-vad-4.0
│
└───uvr5_weights
        UVR_MDXNET_Main.onnx

运行

streamlit run web.py --server.port 1234 --server.maxUploadSize 1000

演示视频:

1.mp4

效果

葬送的芙莉蓮 OP 主題曲 -「勇者」/ YOASOBI

识别出的歌词 本软件输出
まるでおとぎの話 終わり迎えた証 就像童话故事迎来了结局的证明
長すぎる旅路から 切り出した一節 从过长的旅程中切出的一节
それはかつてこの地に 影を落とした悪を 那是曾经在这片土地上投下阴影的恶
打ち取る自由者との 短い旅の記憶 是与击败自由者的短暂旅行的记忆
物語は終わり 勇者は眠りにつく 故事结束了 勇者已经入睡
穏やかな日常を この地に残して 留下了平静的日常在这片土地上
時の眺めは無情に 人を忘れさせる 时间的眺望无情地让人忘记
そこに生きた奇跡も 錆びついてく 在那里生活的奇迹也开始生锈了
それでも君は 生きてる 但是你依然活着
君の言葉も 願いも 勇気も 你的话语 你的愿望 你的勇气
今は確かに私の中で 生きてる 现在它们确实在我心中活着
同じ道を選んだ それだけだった 只是选择了相同的道路

参考

auto-subtitle's People

Contributors

lissettecarlr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

auto-subtitle's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.