Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

assemblyai-transcribe

Small CLI for uploading local audio file(s) to AssemblyAI and saving the transcript(s).

The code is compatible with Python 2.7 and Python 3.x.

Installation

Install from PyPI:

pip install assemblyai-transcribe

After installation, run it as assemblyai_transcribe.

Usage

Transcribe a single file:

assemblyai_transcribe ./example.mp3 --api-key YOUR_API_KEY -o transcript.txt

Transcribe multiple files:

assemblyai_transcribe ./ep1.mp3 ./ep2.mp3 ./ep3.mp3 --api-key YOUR_API_KEY
# Saves: ep1.mp3.txt, ep2.mp3.txt, ep3.mp3.txt

Transcribe multiple files into a directory (auto-created if it doesn't exist):

assemblyai_transcribe ./ep1.mp3 ./ep2.mp3 --api-key YOUR_API_KEY -o transcripts/
# Saves: transcripts/ep1.txt, transcripts/ep2.txt

Examples:

assemblyai_transcribe ./example.mp3 --api-key YOUR_API_KEY -o transcript.txt
assemblyai_transcribe ./example.mp3 --api-key YOUR_API_KEY --eu -o transcript.txt
assemblyai_transcribe ./example.mp3 --api-key YOUR_API_KEY --model universal-3-pro -o transcript.txt
assemblyai_transcribe ./example.mp3 --api-key YOUR_API_KEY --model universal-3-pro --model universal-2 -o transcript.txt
assemblyai_transcribe ./example.mp3 --api-key YOUR_API_KEY --no-language-detection -o transcript.txt
assemblyai_transcribe ./example.mp3 --api-key YOUR_API_KEY --no-speaker-labels -o transcript.txt
assemblyai_transcribe ./example.mp3 --api-key YOUR_API_KEY --language zh -o transcript.txt
assemblyai_transcribe ./example.mp3 --api-key YOUR_API_KEY --language zh --language en -o transcript.txt
assemblyai_transcribe ./example.mp3 --api-key YOUR_API_KEY --language zh,en --code-switching -o transcript.txt

Arguments:

  • audio_files: one or more paths to local audio files.
  • --api-key API_KEY: AssemblyAI API key.
  • --base-url BASE_URL: override the API base URL. Default: https://api.assemblyai.com
  • --eu: use the EU AssemblyAI endpoint.
  • --model MODEL: repeat to provide multiple speech models. Default models: universal-3-pro, universal-2
  • --language LANG: expected language as an ISO code. Repeat the flag for several languages, or pass a comma-separated list (--language zh,en).
    • one language (e.g. --language zh): transcription is forced into that language;
    • two or more languages: automatic detection is restricted to them, with the first one as fallback;
    • omitted (default): automatic language detection over all languages, as before.
  • --code-switching: allow a single recording to mix the --language values. Requires at least two --language values.
  • --no-speaker-labels: disable speaker diarization (enabled by default).
  • --no-language-detection: disable automatic language detection (enabled by default). Cannot be combined with multiple --language values.
  • --poll-interval SECONDS: seconds between polling attempts. Default: 3.0
  • -o OUTPUT, --output OUTPUT: write transcript(s). With one input file, this is the output file path (default: AUDIO_FILE.txt). With multiple input files, this must be a directory; each transcript is saved as BASENAME.txt inside it.

Help:

assemblyai_transcribe --help

Mixed-language recordings

By default the CLI leaves language handling to AssemblyAI, which is the right choice for most files. Two things are worth knowing when a recording switches languages.

1. The detected language is chosen per file, not per sentence. If a long recording is mostly English with a Chinese section at the end, plain automatic detection can drop the minority-language section entirely (it is transcribed as nothing rather than as the wrong language). Tell the CLI about both languages instead:

assemblyai_transcribe ./episode.m4a --api-key YOUR_API_KEY \
    --language zh --language en --code-switching -o transcript.txt

2. Detection still prefers the dominant language. Restricting detection to a list helps, but the whole file is still classified as one language. If a minority-language stretch is being lost, either force that language for the specific file/segment:

assemblyai_transcribe ./chinese-segment.m4a --api-key YOUR_API_KEY --language zh -o zh.txt

or cut the recording into stretches per language (ffmpeg -ss/-t) and transcribe each one, then stitch the results together. The Language: line printed on stderr shows which strategy was used for each file.

Development

python -m unittest discover -s tests

Contributing

Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.

License

This project is licensed under the MIT License.

Metadata

Release files for assemblyai-transcribe 0.1.0a6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for assemblyai-transcribe 0.1.0a6
File Size Uploaded Provenance Actions
assemblyai_transcribe-0.1.0a6.tar.gz 9.3 kB Without provenance Details for assemblyai_transcribe-0.1.0a6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for assemblyai-transcribe 0.1.0a6
File Interpreter ABI Platform Actions
assemblyai_transcribe-0.1.0a6-py2.py3-none-any.whl Python 3, Python 2 none any Details for assemblyai_transcribe-0.1.0a6-py2.py3-none-any.whl

Total release size: 17.9 kB

Release files / assemblyai_transcribe-0.1.0a6.tar.gz

Download URL assemblyai_transcribe-0.1.0a6.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8810d16269746e2c5ece7324b7163a4d8fdea6bc00f1f275ce6f1e66c5f55ee6
BLAKE2b-256 checksum
How to use checksums
f36bf89f6709f84812a867137cc24d1e685aa6da1e8a386974eff33606b4e130
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / assemblyai_transcribe-0.1.0a6-py2.py3-none-any.whl

Download URL assemblyai_transcribe-0.1.0a6-py2.py3-none-any.whl
Size 8.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c2a5361ab46463faed81495a0ed9fa0ba5668682d8eac9a8698178ee4089c526
BLAKE2b-256 checksum
How to use checksums
ee230552ec1564e2b29da5c6030bd7a623126d9b984e096487d1b51f897e33c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for assemblyai-transcribe 0.1.0a6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page