Skip to main content

Cloud-based MP3 transcription CLI built on Google Speech-to-Text v2 (Chirp 2)

Project description

gcp-transcribe

Cloud-based MP3 transcription CLI built on Google Speech-to-Text v2 (Chirp 2). Submit a job, get a job ID back, then poll for status and fetch results when ready.

  • Async batch workflow for long-form audio
  • Multilingual via Chirp 2 (any BCP-47 language Chirp 2 supports)
  • Outputs .txt, .json, and optional .srt
  • Jobs survive across CLI invocations and reboots

Prerequisites

  • Python 3.10+
  • A Google Cloud account with billing enabled
  • The gcloud CLI installed locally

Set up Google Cloud

You can do this in the Google Cloud Console or entirely from the terminal. The CLI flow:

1. Create or select a project

# Create a new project
gcloud projects create <your-project-id> --name="Transcribe"

# Or pick an existing one
gcloud projects list
gcloud config set project <your-project-id>

2. Enable billing

A billing account must be linked to the project. List your billing accounts and link one:

gcloud billing accounts list
gcloud billing projects link <your-project-id> \
  --billing-account=<billing-account-id>

(Or do this once in the Console under Billing → Link a billing account.)

3. Enable the required APIs

gcloud services enable \
  speech.googleapis.com \
  storage.googleapis.com \
  --project=<your-project-id>

4. Authenticate

This tool uses Application Default Credentials, so you don't need a service-account key for local use:

gcloud auth application-default login
gcloud auth application-default set-quota-project <your-project-id>

The user account you log in with needs roles that allow Speech-to-Text recognition plus bucket and object management on the staging bucket. For personal use, Owner or Editor on the project is sufficient. For tighter scoping, the minimum is:

  • roles/speech.client
  • roles/storage.admin (or storage.objectAdmin + storage.bucketAdmin if you'd rather not grant full admin)

Running in CI or a server? Create a service account, grant the same roles, download a JSON key, and point GOOGLE_APPLICATION_CREDENTIALS at it instead of running gcloud auth ....

Install

pip install gcp-transcribe

Or from source:

git clone https://github.com/bengeos/gcp-transcribe.git
cd gcp-transcribe
pip install -e .

Configure

Create a .env file in your working directory (or export these as environment variables):

GCP_PROJECT_ID=your-gcp-project-id
GCP_REGION=us-central1
GCS_BUCKET=your-staging-bucket
DEFAULT_LANGUAGES=en-US
Key Default Notes
GCP_PROJECT_ID Required.
GCP_REGION us-central1 Must be a Chirp 2-supported region.
GCS_BUCKET <project-id>-transcription Auto-created on first run if it doesn't exist.
DEFAULT_LANGUAGES en-US Comma-separated BCP-47 codes.

Verify everything is wired up:

transcribe doctor

Usage

Submit a job

transcribe submit audio.mp3
# → prints a job ID

Multiple files in one job:

transcribe submit a.mp3 b.mp3 c.mp3

Override languages per call:

transcribe submit audio.mp3 -l en-US -l es-ES

Check status

transcribe status <job-id>

State is one of running, done, failed, fetched.

Fetch the transcript

transcribe result <job-id> --out ./transcripts

Adds subtitles:

transcribe result <job-id> --out ./transcripts --srt

GCS staging objects are deleted after a successful fetch. Use --keep-remote to retain them.

Other commands

transcribe list                # all known jobs
transcribe forget <job-id>     # remove a job from the local manifest
transcribe doctor              # verify config + GCP auth

Costs

Chirp 2 batch transcription is roughly $0.016 per minute of audio. A 3-hour file ≈ $2.88.

Limitations

  • No speaker diarization (not supported by Chirp 2 in batch mode).
  • Each file is capped at the Speech-to-Text v2 batch limit (currently 8 hours per file).

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcp_transcribe-0.1.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gcp_transcribe-0.1.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file gcp_transcribe-0.1.1.tar.gz.

File metadata

  • Download URL: gcp_transcribe-0.1.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gcp_transcribe-0.1.1.tar.gz
Algorithm Hash digest
SHA256 037bad4226c462678988fd187c1cd2b991611b919deed4f599832f8947a77b14
MD5 e7975c4bf8a6e8c927aa7a78a2c68e1a
BLAKE2b-256 5361e0dc98fc070faf3e79d11c40a5dca99664189bcda285bb529e7100f40cbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for gcp_transcribe-0.1.1.tar.gz:

Publisher: publish.yml on bengeos/gcp-transcribe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gcp_transcribe-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gcp_transcribe-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gcp_transcribe-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0725aa8efccc3338a975ef075a9dbb892f232ea296a1826434f1ab3fc11544e6
MD5 2bd0cdd6d4b1fedec267c1fc2241b199
BLAKE2b-256 565b30777eab9fc77f0a58e61cbd123d4b55b50d06299452141cb63dbb2e59da

See more details on using hashes here.

Provenance

The following attestation bundles were made for gcp_transcribe-0.1.1-py3-none-any.whl:

Publisher: publish.yml on bengeos/gcp-transcribe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page