asr-skill
by @lgwanai
This skill should be used when the user asks to "transcribe audio", "transcribe video", "convert speech to text", "generate subtitles", "create captions", "i...
clawhub install asr-skillsπ About This Skill
name: asr description: This skill should be used when the user asks to "transcribe audio", "transcribe video", "convert speech to text", "generate subtitles", "create captions", "identify speakers in audio", or mentions audio/video transcription needs. Provides local ASR transcription with speaker diarization using FunASR.
ASR Transcription Skill
Provide local audio/video transcription with speaker diarization, multiple output formats, and progress indication.
Purpose
Enable users to transcribe audio and video files to text with automatic speaker identification, supporting multiple subtitle formats while preserving privacy through local processing.
When to Use
This skill triggers when the user:
Quick Start
Basic Transcription
# Transcribe audio file (outputs TXT by default)
python3 skills/asr/scripts/transcribe.py path/to/audio.mp3Transcribe video file
python3 skills/asr/scripts/transcribe.py path/to/video.mp4
Output Formats
python3 skills/asr/scripts/transcribe.py audio.mp3 -f json # Structured JSON with metadata
python3 skills/asr/scripts/transcribe.py audio.mp3 -f srt # SubRip subtitles
python3 skills/asr/scripts/transcribe.py audio.mp3 -f ass # ASS/SSA subtitles with speaker styling
python3 skills/asr/scripts/transcribe.py audio.mp3 -f md # Markdown with speaker sections
Python API
from asr_skill import transcriberesult = transcribe("meeting.mp4", format="srt")
print(f"Output: {result['output_path']}")
print(f"Speakers: {result.get('speakers', [])}")
Asynchronous Execution (Recommended for Long Files)
Avoid timeouts by running transcription in the background:
# Start async task
python3 skills/asr/scripts/transcribe.py long_video.mp4 --async
Output: {"task_id": "a1b2c3d4", "status": "queued", ...}
Check status
python3 skills/asr/scripts/transcribe.py --status a1b2c3d4
Output: {"task_id": "a1b2c3d4", "status": "processing", "progress": 45, ...}
List recent tasks
python3 skills/asr/scripts/transcribe.py --list
Core Features
Speaker Diarization
Automatically identifies and labels different speakers:
Hardware Auto-Detection
Detects and uses the best available hardware:
Long Audio Support
Handles audio files longer than 1 hour:
Multiple Output Formats
| Format | Extension | Use Case | |--------|-----------|----------| | txt | .txt | Plain text with timestamps | | json | .json | Structured data with word-level info | | srt | .srt | Video subtitles | | ass | .ass | Styled subtitles | | md | .md | Documentation with speaker sections |
Implementation Details
Processing Pipeline
1. Input validation - Check file exists and format supported 2. Hardware detection - Auto-detect GPU/MPS/CPU 3. Video extraction - Extract audio from video files via FFmpeg 4. Audio preprocessing - Resample to 16kHz mono 5. Model loading - Load FunASR models (cached locally) 6. Transcription - Run ASR with speaker diarization 7. Formatting - Output in requested format 8. Cleanup - Remove temporary files
Model Components
File Locations
./models/Troubleshooting
Common Issues
"FFmpeg not found"
"CUDA out of memory"
"No speakers detected"
Additional Resources
Reference Files
For detailed format specifications:
references/output-formats.md - Complete format documentationScripts
Utility scripts for batch processing:
scripts/transcribe.py - Batch transcription scriptExamples
Working examples:
examples/basic_usage.py - Python API examplesexamples/cli_examples.sh - CLI usage examplesRequirements
Notes
β‘ When to Use
π‘ Examples
Working examples:
examples/basic_usage.py - Python API examplesexamples/cli_examples.sh - CLI usage examples