vogel-video-analyzer 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vogel_video_analyzer-0.1.0/CHANGELOG.md +40 -0
- vogel_video_analyzer-0.1.0/LICENSE +21 -0
- vogel_video_analyzer-0.1.0/MANIFEST.in +4 -0
- vogel_video_analyzer-0.1.0/PKG-INFO +320 -0
- vogel_video_analyzer-0.1.0/README.md +280 -0
- vogel_video_analyzer-0.1.0/pyproject.toml +92 -0
- vogel_video_analyzer-0.1.0/setup.cfg +4 -0
- vogel_video_analyzer-0.1.0/src/vogel_video_analyzer/__init__.py +14 -0
- vogel_video_analyzer-0.1.0/src/vogel_video_analyzer/__main__.py +8 -0
- vogel_video_analyzer-0.1.0/src/vogel_video_analyzer/analyzer.py +255 -0
- vogel_video_analyzer-0.1.0/src/vogel_video_analyzer/cli.py +200 -0
- vogel_video_analyzer-0.1.0/src/vogel_video_analyzer.egg-info/PKG-INFO +320 -0
- vogel_video_analyzer-0.1.0/src/vogel_video_analyzer.egg-info/SOURCES.txt +15 -0
- vogel_video_analyzer-0.1.0/src/vogel_video_analyzer.egg-info/dependency_links.txt +1 -0
- vogel_video_analyzer-0.1.0/src/vogel_video_analyzer.egg-info/entry_points.txt +2 -0
- vogel_video_analyzer-0.1.0/src/vogel_video_analyzer.egg-info/requires.txt +10 -0
- vogel_video_analyzer-0.1.0/src/vogel_video_analyzer.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2025-11-06
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of vogel-video-analyzer
|
|
12
|
+
- YOLOv8-based bird detection in videos
|
|
13
|
+
- Command-line interface (`vogel-analyze`)
|
|
14
|
+
- Python library API (`VideoAnalyzer` class)
|
|
15
|
+
- Configurable sample rate for performance optimization
|
|
16
|
+
- Segment detection for continuous bird presence
|
|
17
|
+
- JSON export functionality
|
|
18
|
+
- Auto-delete feature for videos without bird content
|
|
19
|
+
- Structured logging support
|
|
20
|
+
- Model search in multiple directories
|
|
21
|
+
- Comprehensive documentation and examples
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
- Frame-by-frame video analysis
|
|
25
|
+
- Bird content percentage calculation
|
|
26
|
+
- Detailed statistics generation
|
|
27
|
+
- Multiple video batch processing
|
|
28
|
+
- Progress indicators
|
|
29
|
+
- Formatted console reports
|
|
30
|
+
|
|
31
|
+
### Technical
|
|
32
|
+
- Python 3.8+ support
|
|
33
|
+
- OpenCV integration
|
|
34
|
+
- Ultralytics YOLOv8 integration
|
|
35
|
+
- MIT License
|
|
36
|
+
- PyPI package structure with modern pyproject.toml
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
[0.1.0]: https://github.com/kamera-linux/vogel-video-analyzer/releases/tag/v0.1.0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Vogel-Kamera-Linux Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vogel-video-analyzer
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: YOLOv8-based video analysis tool for bird content detection
|
|
5
|
+
Author-email: Vogel-Kamera-Linux Team <info@vogel-kamera-linux.org>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/kamera-linux/vogel-video-analyzer
|
|
8
|
+
Project-URL: Documentation, https://github.com/kamera-linux/vogel-video-analyzer#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/kamera-linux/vogel-video-analyzer
|
|
10
|
+
Project-URL: Issues, https://github.com/kamera-linux/vogel-video-analyzer/issues
|
|
11
|
+
Project-URL: Parent Project, https://github.com/kamera-linux/vogel-kamera-linux
|
|
12
|
+
Keywords: video,analysis,bird,detection,yolov8,opencv,computer-vision,wildlife,ornithology
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Multimedia :: Video
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
27
|
+
Requires-Python: >=3.8
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: opencv-python>=4.8.0
|
|
31
|
+
Requires-Dist: ultralytics>=8.0.0
|
|
32
|
+
Requires-Dist: numpy>=1.24.0
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
37
|
+
Requires-Dist: flake8>=6.0; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# 🐦 Vogel Video Analyzer
|
|
42
|
+
|
|
43
|
+
[](https://badge.fury.io/py/vogel-video-analyzer)
|
|
44
|
+
[](https://pypi.org/project/vogel-video-analyzer/)
|
|
45
|
+
[](https://opensource.org/licenses/MIT)
|
|
46
|
+
[](https://pepy.tech/project/vogel-video-analyzer)
|
|
47
|
+
|
|
48
|
+
**YOLOv8-based video analysis tool for automated bird content detection and quantification.**
|
|
49
|
+
|
|
50
|
+
A powerful command-line tool and Python library for analyzing videos to detect and quantify bird presence using state-of-the-art YOLOv8 object detection.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## ✨ Features
|
|
55
|
+
|
|
56
|
+
- 🤖 **YOLOv8-powered Detection** - Accurate bird detection using pre-trained models
|
|
57
|
+
- 📊 **Detailed Statistics** - Frame-by-frame analysis with bird content percentage
|
|
58
|
+
- 🎯 **Segment Detection** - Identifies continuous time periods with bird presence
|
|
59
|
+
- ⚡ **Performance Optimized** - Configurable sample rate for faster processing
|
|
60
|
+
- 📄 **JSON Export** - Structured reports for archival and further analysis
|
|
61
|
+
- 🗑️ **Auto-Delete** - Automatically removes videos without bird content
|
|
62
|
+
- 📝 **Logging Support** - Structured logs for batch processing workflows
|
|
63
|
+
- 🐍 **Library & CLI** - Use as standalone tool or integrate into your Python projects
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 🚀 Quick Start
|
|
68
|
+
|
|
69
|
+
### Installation
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install vogel-video-analyzer
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Basic Usage
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Analyze a single video
|
|
79
|
+
vogel-analyze video.mp4
|
|
80
|
+
|
|
81
|
+
# Faster analysis (every 5th frame)
|
|
82
|
+
vogel-analyze --sample-rate 5 video.mp4
|
|
83
|
+
|
|
84
|
+
# Export to JSON
|
|
85
|
+
vogel-analyze --output report.json video.mp4
|
|
86
|
+
|
|
87
|
+
# Batch process directory
|
|
88
|
+
vogel-analyze ~/Videos/Birds/**/*.mp4
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 📖 Usage Examples
|
|
94
|
+
|
|
95
|
+
### Command Line Interface
|
|
96
|
+
|
|
97
|
+
#### Basic Analysis
|
|
98
|
+
```bash
|
|
99
|
+
# Analyze single video with default settings
|
|
100
|
+
vogel-analyze bird_video.mp4
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Output:**
|
|
104
|
+
```
|
|
105
|
+
🎬 Video Analysis Report
|
|
106
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
107
|
+
📁 File: /path/to/bird_video.mp4
|
|
108
|
+
📊 Total Frames: 450 (analyzed: 90)
|
|
109
|
+
⏱️ Duration: 15.0 seconds
|
|
110
|
+
🐦 Bird Frames: 72 (80.0%)
|
|
111
|
+
🎯 Bird Segments: 2
|
|
112
|
+
|
|
113
|
+
📍 Detected Segments:
|
|
114
|
+
┌ Segment 1: 00:00:02 - 00:00:08 (72% bird frames)
|
|
115
|
+
└ Segment 2: 00:00:11 - 00:00:14 (89% bird frames)
|
|
116
|
+
|
|
117
|
+
✅ Status: Significant bird activity detected
|
|
118
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### Advanced Options
|
|
122
|
+
```bash
|
|
123
|
+
# Custom threshold and sample rate
|
|
124
|
+
vogel-analyze --threshold 0.4 --sample-rate 10 video.mp4
|
|
125
|
+
|
|
126
|
+
# Batch processing with auto-delete
|
|
127
|
+
vogel-analyze --sample-rate 5 --delete ~/Videos/Birds/**/*.mp4
|
|
128
|
+
|
|
129
|
+
# Save JSON report and log
|
|
130
|
+
vogel-analyze --output report.json --log video.mp4
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Python Library
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
from vogel_video_analyzer import VideoAnalyzer
|
|
137
|
+
|
|
138
|
+
# Initialize analyzer
|
|
139
|
+
analyzer = VideoAnalyzer(
|
|
140
|
+
model_path="yolov8n.pt",
|
|
141
|
+
threshold=0.3
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
# Analyze video
|
|
145
|
+
stats = analyzer.analyze_video("bird_video.mp4", sample_rate=5)
|
|
146
|
+
|
|
147
|
+
# Print formatted report
|
|
148
|
+
analyzer.print_report(stats)
|
|
149
|
+
|
|
150
|
+
# Access statistics
|
|
151
|
+
print(f"Bird content: {stats['bird_percentage']:.1f}%")
|
|
152
|
+
print(f"Segments found: {len(stats['bird_segments'])}")
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 🎯 Use Cases
|
|
158
|
+
|
|
159
|
+
### 1. Quality Control for Bird Recordings
|
|
160
|
+
Automatically verify that recorded videos actually contain birds:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
vogel-analyze --threshold 0.5 --delete recordings/**/*.mp4
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 2. Archive Management
|
|
167
|
+
Identify and remove videos without bird content to save storage:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Find videos with 0% bird content
|
|
171
|
+
vogel-analyze --output stats.json archive/**/*.mp4
|
|
172
|
+
|
|
173
|
+
# Delete empty videos
|
|
174
|
+
vogel-analyze --delete archive/**/*.mp4
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 3. Batch Analysis for Research
|
|
178
|
+
Process large video collections and generate structured reports:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Analyze all videos and save individual reports
|
|
182
|
+
for video in research_data/**/*.mp4; do
|
|
183
|
+
vogel-analyze --sample-rate 10 --output "${video%.mp4}_report.json" "$video"
|
|
184
|
+
done
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 4. Integration in Automation Workflows
|
|
188
|
+
Use as part of automated recording pipelines:
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
from vogel_video_analyzer import VideoAnalyzer
|
|
192
|
+
|
|
193
|
+
analyzer = VideoAnalyzer(threshold=0.3)
|
|
194
|
+
stats = analyzer.analyze_video("latest_recording.mp4", sample_rate=5)
|
|
195
|
+
|
|
196
|
+
# Only keep videos with significant bird content
|
|
197
|
+
if stats['bird_percentage'] < 10:
|
|
198
|
+
print("Insufficient bird content, deleting...")
|
|
199
|
+
# Handle deletion
|
|
200
|
+
else:
|
|
201
|
+
print(f"✅ Quality video: {stats['bird_percentage']:.1f}% bird content")
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## ⚙️ Configuration Options
|
|
207
|
+
|
|
208
|
+
| Option | Description | Default | Values |
|
|
209
|
+
|--------|-------------|---------|--------|
|
|
210
|
+
| `--model` | YOLO model to use | `yolov8n.pt` | Any YOLO model |
|
|
211
|
+
| `--threshold` | Confidence threshold | `0.3` | `0.0` - `1.0` |
|
|
212
|
+
| `--sample-rate` | Analyze every Nth frame | `5` | `1` - `∞` |
|
|
213
|
+
| `--output` | Save JSON report | - | File path |
|
|
214
|
+
| `--delete` | Auto-delete 0% videos | `False` | Flag |
|
|
215
|
+
| `--log` | Enable logging | `False` | Flag |
|
|
216
|
+
|
|
217
|
+
### Sample Rate Recommendations
|
|
218
|
+
|
|
219
|
+
| Video FPS | Sample Rate | Frames Analyzed | Performance |
|
|
220
|
+
|-----------|-------------|----------------|-------------|
|
|
221
|
+
| 30 fps | 1 | 100% (all frames) | Slow, highest precision |
|
|
222
|
+
| 30 fps | 5 | 20% | ⭐ **Recommended** - Good balance |
|
|
223
|
+
| 30 fps | 10 | 10% | Fast, sufficient |
|
|
224
|
+
| 30 fps | 20 | 5% | Very fast, basic check |
|
|
225
|
+
|
|
226
|
+
### Threshold Values
|
|
227
|
+
|
|
228
|
+
| Threshold | Description | Use Case |
|
|
229
|
+
|-----------|-------------|----------|
|
|
230
|
+
| 0.2 | Very sensitive | Detects distant/partially obscured birds |
|
|
231
|
+
| 0.3 | **Standard** | Balanced detection |
|
|
232
|
+
| 0.5 | Conservative | Only clearly visible birds |
|
|
233
|
+
| 0.7 | Very strict | Only perfect detections |
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 🔍 Technical Details
|
|
238
|
+
|
|
239
|
+
### Model Search Hierarchy
|
|
240
|
+
|
|
241
|
+
The analyzer searches for YOLOv8 models in this order:
|
|
242
|
+
|
|
243
|
+
1. `models/` directory (local)
|
|
244
|
+
2. `config/models/` directory
|
|
245
|
+
3. Current directory
|
|
246
|
+
4. Auto-download from Ultralytics (fallback)
|
|
247
|
+
|
|
248
|
+
### Detection Algorithm
|
|
249
|
+
|
|
250
|
+
- **Target Class:** Bird (COCO class 14)
|
|
251
|
+
- **Inference:** Frame-by-frame YOLOv8 detection
|
|
252
|
+
- **Segment Detection:** Groups consecutive bird frames with max 2-second gaps
|
|
253
|
+
- **Performance:** ~5x speedup with sample-rate=5 on 30fps videos
|
|
254
|
+
|
|
255
|
+
### Output Format
|
|
256
|
+
|
|
257
|
+
JSON reports include:
|
|
258
|
+
```json
|
|
259
|
+
{
|
|
260
|
+
"video_file": "bird_video.mp4",
|
|
261
|
+
"duration_seconds": 15.0,
|
|
262
|
+
"total_frames": 450,
|
|
263
|
+
"frames_analyzed": 90,
|
|
264
|
+
"bird_percentage": 80.0,
|
|
265
|
+
"bird_segments": [
|
|
266
|
+
{
|
|
267
|
+
"start": 2.0,
|
|
268
|
+
"end": 8.0,
|
|
269
|
+
"detections": 36
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 📚 Documentation
|
|
278
|
+
|
|
279
|
+
- **GitHub Repository:** [vogel-video-analyzer](https://github.com/kamera-linux/vogel-video-analyzer)
|
|
280
|
+
- **Parent Project:** [vogel-kamera-linux](https://github.com/kamera-linux/vogel-kamera-linux)
|
|
281
|
+
- **Issue Tracker:** [GitHub Issues](https://github.com/kamera-linux/vogel-video-analyzer/issues)
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## 🤝 Contributing
|
|
286
|
+
|
|
287
|
+
Contributions are welcome! We appreciate bug reports, feature suggestions, documentation improvements, and code contributions.
|
|
288
|
+
|
|
289
|
+
Please read our [Contributing Guide](CONTRIBUTING.md) for details on:
|
|
290
|
+
- How to set up your development environment
|
|
291
|
+
- Our code style and guidelines
|
|
292
|
+
- The pull request process
|
|
293
|
+
- How to report bugs and suggest features
|
|
294
|
+
|
|
295
|
+
For security vulnerabilities, please see our [Security Policy](SECURITY.md).
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## 📄 License
|
|
300
|
+
|
|
301
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 🙏 Acknowledgments
|
|
306
|
+
|
|
307
|
+
- **Ultralytics YOLOv8** - Powerful object detection framework
|
|
308
|
+
- **OpenCV** - Computer vision library
|
|
309
|
+
- **Vogel-Kamera-Linux** - Parent project for automated bird observation
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## 📞 Support
|
|
314
|
+
|
|
315
|
+
- **Issues:** [GitHub Issues](https://github.com/kamera-linux/vogel-video-analyzer/issues)
|
|
316
|
+
- **Discussions:** [GitHub Discussions](https://github.com/kamera-linux/vogel-video-analyzer/discussions)
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
**Made with ❤️ by the Vogel-Kamera-Linux Team**
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# 🐦 Vogel Video Analyzer
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/vogel-video-analyzer)
|
|
4
|
+
[](https://pypi.org/project/vogel-video-analyzer/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://pepy.tech/project/vogel-video-analyzer)
|
|
7
|
+
|
|
8
|
+
**YOLOv8-based video analysis tool for automated bird content detection and quantification.**
|
|
9
|
+
|
|
10
|
+
A powerful command-line tool and Python library for analyzing videos to detect and quantify bird presence using state-of-the-art YOLOv8 object detection.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## ✨ Features
|
|
15
|
+
|
|
16
|
+
- 🤖 **YOLOv8-powered Detection** - Accurate bird detection using pre-trained models
|
|
17
|
+
- 📊 **Detailed Statistics** - Frame-by-frame analysis with bird content percentage
|
|
18
|
+
- 🎯 **Segment Detection** - Identifies continuous time periods with bird presence
|
|
19
|
+
- ⚡ **Performance Optimized** - Configurable sample rate for faster processing
|
|
20
|
+
- 📄 **JSON Export** - Structured reports for archival and further analysis
|
|
21
|
+
- 🗑️ **Auto-Delete** - Automatically removes videos without bird content
|
|
22
|
+
- 📝 **Logging Support** - Structured logs for batch processing workflows
|
|
23
|
+
- 🐍 **Library & CLI** - Use as standalone tool or integrate into your Python projects
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 🚀 Quick Start
|
|
28
|
+
|
|
29
|
+
### Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install vogel-video-analyzer
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Basic Usage
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Analyze a single video
|
|
39
|
+
vogel-analyze video.mp4
|
|
40
|
+
|
|
41
|
+
# Faster analysis (every 5th frame)
|
|
42
|
+
vogel-analyze --sample-rate 5 video.mp4
|
|
43
|
+
|
|
44
|
+
# Export to JSON
|
|
45
|
+
vogel-analyze --output report.json video.mp4
|
|
46
|
+
|
|
47
|
+
# Batch process directory
|
|
48
|
+
vogel-analyze ~/Videos/Birds/**/*.mp4
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 📖 Usage Examples
|
|
54
|
+
|
|
55
|
+
### Command Line Interface
|
|
56
|
+
|
|
57
|
+
#### Basic Analysis
|
|
58
|
+
```bash
|
|
59
|
+
# Analyze single video with default settings
|
|
60
|
+
vogel-analyze bird_video.mp4
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Output:**
|
|
64
|
+
```
|
|
65
|
+
🎬 Video Analysis Report
|
|
66
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
67
|
+
📁 File: /path/to/bird_video.mp4
|
|
68
|
+
📊 Total Frames: 450 (analyzed: 90)
|
|
69
|
+
⏱️ Duration: 15.0 seconds
|
|
70
|
+
🐦 Bird Frames: 72 (80.0%)
|
|
71
|
+
🎯 Bird Segments: 2
|
|
72
|
+
|
|
73
|
+
📍 Detected Segments:
|
|
74
|
+
┌ Segment 1: 00:00:02 - 00:00:08 (72% bird frames)
|
|
75
|
+
└ Segment 2: 00:00:11 - 00:00:14 (89% bird frames)
|
|
76
|
+
|
|
77
|
+
✅ Status: Significant bird activity detected
|
|
78
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### Advanced Options
|
|
82
|
+
```bash
|
|
83
|
+
# Custom threshold and sample rate
|
|
84
|
+
vogel-analyze --threshold 0.4 --sample-rate 10 video.mp4
|
|
85
|
+
|
|
86
|
+
# Batch processing with auto-delete
|
|
87
|
+
vogel-analyze --sample-rate 5 --delete ~/Videos/Birds/**/*.mp4
|
|
88
|
+
|
|
89
|
+
# Save JSON report and log
|
|
90
|
+
vogel-analyze --output report.json --log video.mp4
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Python Library
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from vogel_video_analyzer import VideoAnalyzer
|
|
97
|
+
|
|
98
|
+
# Initialize analyzer
|
|
99
|
+
analyzer = VideoAnalyzer(
|
|
100
|
+
model_path="yolov8n.pt",
|
|
101
|
+
threshold=0.3
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
# Analyze video
|
|
105
|
+
stats = analyzer.analyze_video("bird_video.mp4", sample_rate=5)
|
|
106
|
+
|
|
107
|
+
# Print formatted report
|
|
108
|
+
analyzer.print_report(stats)
|
|
109
|
+
|
|
110
|
+
# Access statistics
|
|
111
|
+
print(f"Bird content: {stats['bird_percentage']:.1f}%")
|
|
112
|
+
print(f"Segments found: {len(stats['bird_segments'])}")
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 🎯 Use Cases
|
|
118
|
+
|
|
119
|
+
### 1. Quality Control for Bird Recordings
|
|
120
|
+
Automatically verify that recorded videos actually contain birds:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
vogel-analyze --threshold 0.5 --delete recordings/**/*.mp4
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 2. Archive Management
|
|
127
|
+
Identify and remove videos without bird content to save storage:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Find videos with 0% bird content
|
|
131
|
+
vogel-analyze --output stats.json archive/**/*.mp4
|
|
132
|
+
|
|
133
|
+
# Delete empty videos
|
|
134
|
+
vogel-analyze --delete archive/**/*.mp4
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 3. Batch Analysis for Research
|
|
138
|
+
Process large video collections and generate structured reports:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Analyze all videos and save individual reports
|
|
142
|
+
for video in research_data/**/*.mp4; do
|
|
143
|
+
vogel-analyze --sample-rate 10 --output "${video%.mp4}_report.json" "$video"
|
|
144
|
+
done
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 4. Integration in Automation Workflows
|
|
148
|
+
Use as part of automated recording pipelines:
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
from vogel_video_analyzer import VideoAnalyzer
|
|
152
|
+
|
|
153
|
+
analyzer = VideoAnalyzer(threshold=0.3)
|
|
154
|
+
stats = analyzer.analyze_video("latest_recording.mp4", sample_rate=5)
|
|
155
|
+
|
|
156
|
+
# Only keep videos with significant bird content
|
|
157
|
+
if stats['bird_percentage'] < 10:
|
|
158
|
+
print("Insufficient bird content, deleting...")
|
|
159
|
+
# Handle deletion
|
|
160
|
+
else:
|
|
161
|
+
print(f"✅ Quality video: {stats['bird_percentage']:.1f}% bird content")
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## ⚙️ Configuration Options
|
|
167
|
+
|
|
168
|
+
| Option | Description | Default | Values |
|
|
169
|
+
|--------|-------------|---------|--------|
|
|
170
|
+
| `--model` | YOLO model to use | `yolov8n.pt` | Any YOLO model |
|
|
171
|
+
| `--threshold` | Confidence threshold | `0.3` | `0.0` - `1.0` |
|
|
172
|
+
| `--sample-rate` | Analyze every Nth frame | `5` | `1` - `∞` |
|
|
173
|
+
| `--output` | Save JSON report | - | File path |
|
|
174
|
+
| `--delete` | Auto-delete 0% videos | `False` | Flag |
|
|
175
|
+
| `--log` | Enable logging | `False` | Flag |
|
|
176
|
+
|
|
177
|
+
### Sample Rate Recommendations
|
|
178
|
+
|
|
179
|
+
| Video FPS | Sample Rate | Frames Analyzed | Performance |
|
|
180
|
+
|-----------|-------------|----------------|-------------|
|
|
181
|
+
| 30 fps | 1 | 100% (all frames) | Slow, highest precision |
|
|
182
|
+
| 30 fps | 5 | 20% | ⭐ **Recommended** - Good balance |
|
|
183
|
+
| 30 fps | 10 | 10% | Fast, sufficient |
|
|
184
|
+
| 30 fps | 20 | 5% | Very fast, basic check |
|
|
185
|
+
|
|
186
|
+
### Threshold Values
|
|
187
|
+
|
|
188
|
+
| Threshold | Description | Use Case |
|
|
189
|
+
|-----------|-------------|----------|
|
|
190
|
+
| 0.2 | Very sensitive | Detects distant/partially obscured birds |
|
|
191
|
+
| 0.3 | **Standard** | Balanced detection |
|
|
192
|
+
| 0.5 | Conservative | Only clearly visible birds |
|
|
193
|
+
| 0.7 | Very strict | Only perfect detections |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 🔍 Technical Details
|
|
198
|
+
|
|
199
|
+
### Model Search Hierarchy
|
|
200
|
+
|
|
201
|
+
The analyzer searches for YOLOv8 models in this order:
|
|
202
|
+
|
|
203
|
+
1. `models/` directory (local)
|
|
204
|
+
2. `config/models/` directory
|
|
205
|
+
3. Current directory
|
|
206
|
+
4. Auto-download from Ultralytics (fallback)
|
|
207
|
+
|
|
208
|
+
### Detection Algorithm
|
|
209
|
+
|
|
210
|
+
- **Target Class:** Bird (COCO class 14)
|
|
211
|
+
- **Inference:** Frame-by-frame YOLOv8 detection
|
|
212
|
+
- **Segment Detection:** Groups consecutive bird frames with max 2-second gaps
|
|
213
|
+
- **Performance:** ~5x speedup with sample-rate=5 on 30fps videos
|
|
214
|
+
|
|
215
|
+
### Output Format
|
|
216
|
+
|
|
217
|
+
JSON reports include:
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"video_file": "bird_video.mp4",
|
|
221
|
+
"duration_seconds": 15.0,
|
|
222
|
+
"total_frames": 450,
|
|
223
|
+
"frames_analyzed": 90,
|
|
224
|
+
"bird_percentage": 80.0,
|
|
225
|
+
"bird_segments": [
|
|
226
|
+
{
|
|
227
|
+
"start": 2.0,
|
|
228
|
+
"end": 8.0,
|
|
229
|
+
"detections": 36
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 📚 Documentation
|
|
238
|
+
|
|
239
|
+
- **GitHub Repository:** [vogel-video-analyzer](https://github.com/kamera-linux/vogel-video-analyzer)
|
|
240
|
+
- **Parent Project:** [vogel-kamera-linux](https://github.com/kamera-linux/vogel-kamera-linux)
|
|
241
|
+
- **Issue Tracker:** [GitHub Issues](https://github.com/kamera-linux/vogel-video-analyzer/issues)
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 🤝 Contributing
|
|
246
|
+
|
|
247
|
+
Contributions are welcome! We appreciate bug reports, feature suggestions, documentation improvements, and code contributions.
|
|
248
|
+
|
|
249
|
+
Please read our [Contributing Guide](CONTRIBUTING.md) for details on:
|
|
250
|
+
- How to set up your development environment
|
|
251
|
+
- Our code style and guidelines
|
|
252
|
+
- The pull request process
|
|
253
|
+
- How to report bugs and suggest features
|
|
254
|
+
|
|
255
|
+
For security vulnerabilities, please see our [Security Policy](SECURITY.md).
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## 📄 License
|
|
260
|
+
|
|
261
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## 🙏 Acknowledgments
|
|
266
|
+
|
|
267
|
+
- **Ultralytics YOLOv8** - Powerful object detection framework
|
|
268
|
+
- **OpenCV** - Computer vision library
|
|
269
|
+
- **Vogel-Kamera-Linux** - Parent project for automated bird observation
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## 📞 Support
|
|
274
|
+
|
|
275
|
+
- **Issues:** [GitHub Issues](https://github.com/kamera-linux/vogel-video-analyzer/issues)
|
|
276
|
+
- **Discussions:** [GitHub Discussions](https://github.com/kamera-linux/vogel-video-analyzer/discussions)
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
**Made with ❤️ by the Vogel-Kamera-Linux Team**
|