领导总是会在里面分享一些培训视频,若只是看了不回复不总结,恐怕会让领导以为没人关注。于是我在想能不能让程序帮我总结一下视频内容呢?


Whisper 是一种通用语音识别模型。它能够帮我们将音视频中的语音识别为文字。


方式一、使用虚拟环境

安装 uv

sh
curl -LsSf https://astral.sh/uv/install.sh | sh

换源

sh
echo 'export UV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple' >> ~/.bashrc
source ~/.bashrc  # 立即生效

创建虚拟环境

sh
uv venv

激活虚拟环境

sh
source .venv/bin/activate

虚拟环境中安装 Whisper

sh
uv pip install git+https://github.com/openai/whisper.git

退出虚拟环境

sh
deactivate

方式二、不使用虚拟环境

安装 Whisper

我使用的是 WSL2 安装环境。

安装 Whisper 需要先安装 python3,我这里使用的版本是 pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)

通过以下命令我们可以安装最新发布的 whisper:

sh
pip install -U openai-whisper

或者使用以下命令从仓库中拉取并安装最新的提交,以及它的 Python 依赖项:

sh
pip install --upgrade --no-deps --force-reinstall git+https://github.com/openai/whisper.git

它还要求在您的系统上安装命令行工具 ffmpeg, 这可以从大多数包管理器中获得:

sh
# on Ubuntu or Debian
sudo apt update && sudo apt install ffmpeg

# on Arch Linux
sudo pacman -S ffmpeg

# on MacOS using Homebrew (https://brew.sh/)
brew install ffmpeg

# on Windows using Chocolatey (https://chocolatey.org/)
choco install ffmpeg

# on Windows using Scoop (https://scoop.sh/)
scoop install ffmpeg

如果你在安装 whisper 过程中遇到 tiktoken 相关错误,你可能还需要安装 rust

使用

顺利安装完成 whisper 后就可以正常使用了,下面是简单使用示例:

sh
whisper 培训视频.mp4 --language Chinese

完整的使用方法还得去 github 查看详细使用文档。

AI 总结

下面我们就可以让大语言模型帮我们生成总结,非常的 nice。

向成渝

专注计算机科学与技术

鼓励作者

感谢你赐予我前进的动力!

微信
支付宝
© 版权声明: 此文章为作者原创文章,采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源!

基于 MIT 许可发布

版权所有 © 2024-2025 向成渝