Giter Site home page Giter Site logo

whisper-transcribe's Introduction

Offline Audio Transcription with Whisper AI

Here's an example of how to use OpenAI's Whisper package to make OFFLINE transcriptions of your recordings of speech. This is useful for personal recordings that you want to transcribe, but would rather not upload to a third-party transcription service.

Installation

This installation has been tested with Python 3.10.12 on Ubuntu 20.02. It should work on other Platforms as well, and OpenAI says Whisper should work with all Python versions 3.9 to 3.11.

First, you will need ffmpeg on your system, if you don't have it already:

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

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

For other platforms, see the Whisper GitHub repo.

Now you can install the python requirements. Create a virtual environment, activate it, and pip install from requirements.txt:

python -m venv .venv/
source .venv/bin/activate
pip install -r requirements.txt

If you encounter errors during installation, you may need to install rust on your platform as well.

Run It!

To transcribe an MP3 to a TXT file right away, do this:

./transcribe.sh my.mp3

The scripts wav2mp3.sh and transcribe.sh are provided here for convenience.

wav2mp3.sh will take a WAV file and convert it to MP3 using ffmpeg. If you already have an MP3 file, then this is not needed. Whisper seems to perform much better when given an MP3 file, probably because of the smaller file size.

transcribe.sh is where the magic happens. This is a basic Whisper command that accepts an MP3 file as an argument. The transcription will be printed to stdio and a text file. For efficiency, this script uses the "Small English" (small.en) training model. This model is a little more than 400MB download. It should download itself automatically on the first run of the script. It seems more than adequate for transcribing clean audio in the English language. Whisper support many other languages as well and have large models that promise more accurate transcription.

This covers the most basic use case of transcribing audio to a text file, but Whisper is very powerful! For example, it can be used to generate time-coded .SRT video caption files and it can also translate to other languages as it transcribes. It also has a Python API enabling more robust use cases and automation. See the GitHub Show and Tell Page or whisper -h help command for more details and options.

The Key Package: OpenAI Whisper

The Whisper GitHub repo contains the installation and usage instructions. As of July 2023, it can be installed with pip.

pip install -U openai-whisper

NOTE: the whisper package is something else entirely: "Whisper is a fixed-size database, similar in design and purpose to RRD (round-robin-database)." So make sure you are installing OpenAI's transcription package!

whisper-transcribe's People

Contributors

whusterj avatar

Stargazers

 avatar

Watchers

 avatar

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.