ソフトウェア/whisper のバックアップ(No.1)

更新


公開メモ

OpenAI の Whisper を使って授業動画に正しい字幕を付けたい

Microsoft Stream の標準機能で動画に字幕を付けられるのだけれど、 精度が悪すぎて残念な感じになっている。

OpenAI の Whisper を使うとより正確な文字起こしができそうなので試してみます。

Docker を使うと簡単に動かせるようです

https://dev.classmethod.jp/articles/openai_whisper_only_local_cpu/ を参考に、

LANG:sh
$ mkdir whisper
$ cd whisper
$ cat <<EOF >Dockerfile
FROM python:3.9-slim

WORKDIR /workspace

RUN apt update && apt install -y \
    build-essential \
    gcc \
    git \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

RUN pip install --upgrade pip

RUN pip install git+https://github.com/openai/whisper.git
EOF
$ docker build -t whisper .
$ docker images
 REPOSITORY               TAG             IMAGE ID       CREATED          SIZE
 whisper                  latest          5f346a2f452e   40 minutes ago   3.52GB
 python                   3.9-slim        690ca4c8a70d   6 hours ago      125MB
$ alias whisper='docker run --rm -v $(pwd):/workspace/ whisper whisper'
$ whisper --language ja --model medium audio.mp3 | tee script.txt

のようにして、簡単に動かすことができました。

ただ、GPU を使わないとかなり時間がかかるみたい。。。


Counter: 2868 (from 2010/06/03), today: 1, yesterday: 2