The birda clip command extracts audio segments from recordings based on BirdNET detection results. It automatically organizes clips by species and intelligently merges overlapping detections.
# Extract all detections from a results file
birda clip recording.BirdNET.results.csv
# Filter by confidence threshold (70%)
birda clip recording.BirdNET.results.csv -c 0.7
# Process multiple files
birda clip *.BirdNET.results.csv -c 0.8- Parse detection files - Reads BirdNET CSV results with columns: Start (s), End (s), Scientific name, Common name, Confidence
- Filter by confidence - Only processes detections above the threshold
- Group by species - Clusters detections by scientific name
- Merge overlapping clips - Combines adjacent detections (with padding) into single clips
- Extract audio - Seeks to each time range and writes 16-bit WAV files
- Organize output - Creates species subdirectories with descriptive filenames
| Option | Default | Description |
|---|---|---|
-o, --output |
clips |
Output directory for extracted clips |
-c, --confidence |
0.0 |
Minimum confidence threshold (0.0-1.0) |
--pre |
5.0 |
Seconds of audio before each detection |
--post |
5.0 |
Seconds of audio after each detection |
-a, --audio |
auto | Explicit source audio file path |
--base-dir |
- | Base directory for resolving audio paths |
The clipper automatically finds the source audio file based on the detection filename:
- Direct match:
recording.wav.BirdNET.results.csv→recording.wav - Extension fallback: If original not found, tries
.wav,.flac,.mp3,.ogg,.m4a - Explicit override: Use
-a path/to/audio.wavto specify manually
When audio files are in a different location than detection files:
# Detection files in ./results, audio in ./recordings
birda clip results/*.csv --base-dir ./recordingsclips/
├── Parus major/
│ ├── Parus major_92p_10.5-18.5.wav
│ └── Parus major_85p_45.0-53.0.wav
├── Turdus merula/
│ └── Turdus merula_88p_120.0-128.0.wav
└── Dendrocopos major/
└── Dendrocopos major_76p_200.0-211.0.wav
{Scientific name}_{confidence}p_{start}-{end}.wav
- Scientific name: Species identifier (filesystem-safe)
- confidence: Detection confidence as percentage (e.g.,
92p= 92%) - start-end: Time range in seconds from source audio
Adjacent or overlapping detections for the same species are merged into single clips. This prevents duplicate extractions and creates more natural listening segments.
Given these detections for "Parus major":
- Detection 1: 10.0s - 13.0s (85%)
- Detection 2: 15.0s - 18.0s (92%)
With default padding (5s pre, 5s post):
- Range 1: 5.0s - 18.0s
- Range 2: 10.0s - 23.0s
These overlap, so they merge into a single clip:
- Merged: 5.0s - 23.0s (max confidence: 92%)
Output files are:
- Format: WAV (RIFF)
- Channels: Mono
- Bit depth: 16-bit signed integer
- Sample rate: Same as source audio
# Extract all detections
birda clip recording.BirdNET.results.csv# Only extract detections with 80%+ confidence
birda clip recording.BirdNET.results.csv -c 0.8# Shorter clips: 2s before, 3s after each detection
birda clip recording.BirdNET.results.csv --pre 2 --post 3# Process all CSV files in a directory
birda clip /path/to/results/*.csv -o /path/to/clips -c 0.7# When audio file is in a different location
birda clip results.csv -a /recordings/2024-06-15_dawn.flac# Analyze recordings, then extract best clips
birda analyze recordings/ -o detections/
birda clip detections/*.csv -c 0.85 -o best_clips/- Streaming extraction: Audio is read and written in chunks, not loaded entirely into memory
- Efficient seeking: Uses format-native seeking when available (WAV, FLAC)
- Progress indication: Shows extraction progress with time estimates
The clipper couldn't locate the audio file. Solutions:
- Ensure the audio file exists in the same directory as the CSV
- Use
-ato specify the audio file path explicitly - Use
--base-dirif audio files are in a different directory
All detections in the file are below your threshold. Try:
- Lower the confidence threshold with
-c 0.5 - Check the CSV file to see what confidence values are present
If no clips are extracted:
- Verify the CSV file contains valid detections
- Check that confidence values are in the expected 0.0-1.0 range
- Ensure the audio file is readable and not corrupted
Input (source audio):
- WAV (recommended for fastest seeking)
- FLAC
- MP3
- M4A/AAC
Output: WAV only (for maximum compatibility)