Skip to main content

Just a simple podcast transcript generator

Project description

Podcast Transcript

A simple command-line tool to generate transcripts for podcast episodes.

Table of Contents

Features

  • Download and process podcast episodes from a given MP3 URL.
  • Automatically resamples audio to 16kHz mono because Groq will do this anyway.
  • Splits large audio files into manageable chunks.
  • Transcribes audio using the Groq API.
  • Outputs transcripts in multiple formats:
    • DOTe JSON
    • Podlove JSON
    • WebVTT (subtitle format)

Prerequisites

  • Python 3.10 or higher
  • ffmpeg installed and available in your system’s PATH.
  • A Groq API key for transcription services.

Installation

1Install the package:

pip install podcast-transcript  # or pipx/uvx install podcast-transcript

Configuration

Setting the Groq API Key

The application requires a Groq API key to function. You can set the API key in one of the following ways:

  • Environment Variable:

Set the GROQ_API_KEY environment variable in your shell:

export GROQ_API_KEY=your_api_key_here
# or
GROQ_API_KEY=your_api_key_here podcast-transcript ...
  • .env File:

Create a .env file in the transcript directory (default is ~/.podcast-transcripts/) and add the following line:

GROQ_API_KEY=your_api_key_here

Transcript Directory

By default, transcripts are stored in ~/.podcast-transcripts/. You can change this by setting the TRANSCRIPT_DIR environment variable:

export TRANSCRIPT_DIR=/path/to/your/transcripts

Usage

To transcribe a podcast episode, run the transcribe command followed by the URL of the MP3 file:

transcribe <mp3_url>

Example:

transcribe https://d2mmy4gxasde9x.cloudfront.net/cast_audio/pp_53.mp3

Detailed Steps

The transcription process involves the following steps:

  1. Download the MP3 file from the provided URL.
  2. Reample the audio to 16kHz mono for optimal transcription.
  3. Split the audio into chunks if it exceeds the size limit (25 MB).
  4. Transcribe each audio chunk using the Groq API.
  5. Combine the transcribed chunks into a single transcript.
  6. Generate output files in DOTe JSON, Podlove JSON, and WebVTT formats.

The output files are saved in a directory named after the episode, within the transcript directory.

Output Formats

  • DOTe JSON (*.dote.json): A JSON format suitable for further processing or integration with other tools.
  • Podlove JSON (*.podlove.json): A JSON format compatible with Podlove transcripts.
  • WebVTT (*.vtt): A subtitle format that can be used for captioning in media players.

Development

Install Development Version

  1. Clone the repository:
git clone https://github.com/yourusername/podcast-transcript.git
cd podcast-transcript
  1. Create a virtual environment:
uv venv
  1. Install the package in editable mode:
uv sync

Running Tests

The project uses pytest for testing. To run tests:

pytest

Code Style and Linting

Install pre-commit hooks to ensure code consistency:

pre-commit install

Check the type hints:

mypy src/

Publish a Release

Build the distribution package:

uv build

Publish the package to PyPI:

uv publish --token your_pypi_token

License

This project is licensed under the MIT License.

Author

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

podcast_transcript-0.1.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

podcast_transcript-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file podcast_transcript-0.1.0.tar.gz.

File metadata

File hashes

Hashes for podcast_transcript-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56943fa0037725bff11028baab6f8dd6014a4a5c95ea8683a560fbb139aecbc2
MD5 9cebc01d3b23b8550da0fa4455e1f91d
BLAKE2b-256 79499f48318c360c72f14ef58e2a616d743a1a74a718c3f30cea30bd79005e86

See more details on using hashes here.

File details

Details for the file podcast_transcript-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for podcast_transcript-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e8a70144ce4bfa932f24d44a112bc1d65a97f335b69711185286d067f030a1dc
MD5 2a63afd214455be5c9fa176fac73c5e5
BLAKE2b-256 43bf618f78b76385779a0c6cbe29fd1857177bf89762e6857852d6563da28993

See more details on using hashes here.

Supported by

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