返回 Skill 列表
extension
分类: 内容与媒体无需 API Key

assemblyai-cli

安装、配置和排查`assemblyai-cli`(Rust)的问题,以便使用AssemblyAI将音频/视频转录为文本/srt/vtt格式,包括说话人分离。可以在任何支持Agent Skills(如Codex、Claude Code等)的代理/工具中使用,特别是将本地媒体文件或YouTube链接(通过`yt-dlp`)转换成文字记录时。

person作者: jakexiaohubgithub

assemblyai-cli

Install

GitHub Releases (one-command)

Installs assemblyai-cli and attempts to install ffmpeg (required for video inputs).

Note: the installer does NOT run assemblyai-cli init.

macOS/Linux:

/bin/bash -c "$(curl -fsSL -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/diskd-ai/assemblyai-cli/main/scripts/install.sh)"

Windows (PowerShell):

powershell -NoProfile -ExecutionPolicy Bypass -Command "iwr -useb -Headers @{ 'Cache-Control'='no-cache' } https://raw.githubusercontent.com/diskd-ai/assemblyai-cli/main/scripts/install.ps1 | iex"

Ensure ffmpeg (video inputs)

macOS (Homebrew):

command -v ffmpeg >/dev/null 2>&1 || brew install ffmpeg

Linux (Debian/Ubuntu):

command -v ffmpeg >/dev/null 2>&1 || (sudo apt-get update -y && sudo apt-get install -y ffmpeg)

Windows (winget):

if (-not (Get-Command ffmpeg -ErrorAction SilentlyContinue)) { winget install --id Gyan.FFmpeg -e --accept-package-agreements --accept-source-agreements }

Homebrew (recommended)

Homebrew installs ffmpeg automatically (formula dependency).

brew tap diskd-ai/assemblyai-cli https://github.com/diskd-ai/assemblyai-cli
brew install diskd-ai/assemblyai-cli/assemblyai-cli

Upgrade:

brew update
brew upgrade diskd-ai/assemblyai-cli/assemblyai-cli

GitHub (build from source)

git clone https://github.com/diskd-ai/assemblyai-cli.git
cd assemblyai-cli
cargo install --path .

Configure

Initialize config interactively (writes/updates ~/.assemblyai-cli/config.json):

assemblyai-cli init

If apiKey already exists, it asks before overwriting. Skip the prompt:

assemblyai-cli init --yes

Alternative: set env var (no config file required):

export ASSEMBLYAI_API_KEY="..."

Use

Transcribe local audio/video file:

assemblyai-cli transcribe ./file.mp3
assemblyai-cli transcribe ./file.mp4 --format srt --output ./file.srt

Transcribe a direct media URL:

assemblyai-cli transcribe https://example.com/audio.wav --format vtt

Speaker diarization:

assemblyai-cli transcribe ./file.mp3 --speaker-labels

Video site links (YouTube, etc.) via yt-dlp

assemblyai-cli transcribe accepts HTTP(S) URLs, but YouTube/Vimeo/etc. links are usually page URLs, not direct media files. If the user passes a video-site link, download the audio first with yt-dlp (https://github.com/yt-dlp/yt-dlp), then transcribe the local file.

If yt-dlp is not installed:

  • macOS: brew install yt-dlp
  • Linux: python3 -m pip install -U yt-dlp
  • Windows: winget install yt-dlp.yt-dlp

macOS/Linux (download audio to a known mp3 path, then transcribe):

yt-dlp -x --audio-format mp3 -o "/tmp/assemblyai-cli-input.%(ext)s" "https://www.youtube.com/watch?v=VIDEO_ID"
assemblyai-cli transcribe "/tmp/assemblyai-cli-input.mp3" --format text --output transcript.txt

Windows (PowerShell):

yt-dlp -x --audio-format mp3 -o "$env:TEMP\\assemblyai-cli-input.%(ext)s" "https://www.youtube.com/watch?v=VIDEO_ID"
assemblyai-cli transcribe "$env:TEMP\\assemblyai-cli-input.mp3" --format text --output transcript.txt

Notes:

  • yt-dlp often requires ffmpeg to extract/convert audio.
  • Prefer downloading audio-only (smaller, faster, more reliable) over full video.

Troubleshoot

  • Missing API key (exit code 3): ask the user to run assemblyai-cli init (or set ASSEMBLYAI_API_KEY) and retry the same command.
  • 401 Unauthorized: API key is invalid; re-run assemblyai-cli init --yes or set ASSEMBLYAI_API_KEY to a valid key.
  • Video input fails: ensure ffmpeg is installed and on PATH.
  • Config not loaded: verify ~/.assemblyai-cli/config.json is valid JSON and has camelCase keys.