Skip to content

whisper 使用教學

Published: at 下午06:23

install 如何安裝

需要先安裝 ffmpeg (預設系統為 ubuntu)

sudo apt update && sudo apt install ffmpeg
 sudo pip install -U openai-whisper

how to use 如何使用

假設 檔案為 voice.m4a 可以使用以下指令 轉換完就會出現檔案再相對應資料目錄

whisper voice.m4a --language Chinese --model large-v2
大小參數量英文模型多語言模型需要的顯存相對速度
tiny39 Mtiny.entiny~1 GB~32x
base74 Mbase.enbase~1 GB~16x
small244 Msmall.ensmall~2 GB~6x
medium769 Mmedium.enmedium~5 GB~2x
large1550 MN/Alarge~10 GB1x

如何切割影片 開始時間到固定時間

ffmpeg -i inpout.mp4 -ss 02:32:06 -to 02:46:04 -acodec copy -vcodec copy output.mp4

https://hackmd.io/@cnsrl/HJOsARSgv#1-%E5%8F%96%E7%89%87%E6%AE%B5

ref

https://github.com/openai/whisper/blob/main/README.md