Skip to content

Instantly share code, notes, and snippets.

@jamesmurdza
Last active May 22, 2022 23:38
Show Gist options
  • Save jamesmurdza/cc0490c515a3a6b2be1a85fd1d1932c5 to your computer and use it in GitHub Desktop.
Save jamesmurdza/cc0490c515a3a6b2be1a85fd1d1932c5 to your computer and use it in GitHub Desktop.
Batch transcribe long audio files using Google Cloud

Batch transcribe long audio files using Google Cloud

Contents

Installation

Set up a Google Cloud project and service account

In Google Cloud Console:

  1. Select a project in Google Cloud Console, or create a new one.
  2. Go to "Transcriptions" via the search bar, and enable the Speech-to-Text API.
  3. Go to "Credentials" via the search bar. Create a new service account. Grant it access to the "Storage Admin" and "Cloud Speech Client" roles.

Install the Google Cloud SDK

  1. If you haven't, install the Google Cloud SDK:
curl https://sdk.cloud.google.com | bash
  1. Create an authorization key file:
gcloud config set account USER@PROJECT.iam.gserviceaccount.com
gcloud auth login
gcloud iam service-accounts keys create ~/google-cloud-sdk/AUTH.json --iam-account USER@PROJECT.iam.gserviceaccount.com

Install the CLI

  1. If you haven't already, install go:
  • macOS: brew install go
  • Linux: apt-get install go
  1. Install the transcribe command line tool:
go install github.com/jamesmurdza/transcribe/cmd/transcribe@HEAD

Usage

  1. Run these commands to prepare your environment:
export GOOGLE_APPLICATION_CREDENTIALS=~/google-cloud-sdk/AUTH.json
export PATH=$PATH:~/go/bin
  1. Run the command as follows:
transcribe --project=PROJECT ./file.wav

Alternatives

Option Features
Google Cloud Speech-to-Text - 1 hour/month free forever (subject to change) then 2.4c/minute
AWS Transcribe - 1 hour/month free for the first 12 months
Otter AI - 6000 minutes included in $13/month subscription
- Extra features such as including collaborative editing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment