grabbit 10fe6f95dd perf(vida): Phase 2-3 optimizations and FFmpeg hardware decode fallback
Performance optimizations:
- Frame accumulator: iterator-based loops, hot/cold path separation
- Morphology: dirty rect tracking for Zhang-Suen thinning
- Meteor detector: precomputed thresholds, sqrt elimination in centroid
- Async frame prefetch with producer-consumer pattern
- 2MB BufReader buffer to reduce syscalls

FFmpeg improvements:
- Hardware decoding with auto-fallback (VideoToolbox/VAAPI)
- 3-second timeout probe to detect unsupported codecs
- Automatic CPU fallback when hardware decode fails

Detection visualization:
- Draw fireball trajectories in red on maxpixel
- Draw meteor trajectories in green
- Save detection overlay as _detections.png

Test results (1024 frames @ 1080p):
- Detection processing: ~420ms/block (was ~987ms)
- AV1 video: auto-fallback to CPU decode
- H.264 video: uses hardware acceleration when available

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:23:18 +08:00
2026-01-07 00:14:11 +08:00
2025-12-20 00:08:01 +08:00
2026-01-07 00:14:11 +08:00
2025-12-20 00:08:01 +08:00

Meteor Fullstack - Distributed Monitoring Network

Overview

Meteor Fullstack 是一个覆盖边缘设备、云端 API、数据处理和 Web 前端的完整流星监测网络。采用 npm workspace 管理前后端,通过 Go、Rust 等多语言组件连接实时观测、事件验证和结果展示。

Key Features

  • Vida Detection Algorithm: 基于 Vida et al. 2016 论文的科学级流星检测
  • Advanced Memory Management: 零拷贝架构、分层帧池、自适应内存管理
  • Real-time Processing: ~100ms/block 处理延迟
  • Full Stack: 边缘客户端 → 后端 API → 前端展示完整链路

System Architecture

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│  Edge Client    │────▶│   Web Backend   │────▶│    Frontend     │
│     (Rust)      │     │    (NestJS)     │     │   (Next.js)     │
└────────┬────────┘     └────────┬────────┘     └─────────────────┘
         │                       │
         │                       ▼
         │              ┌─────────────────┐
         │              │ Compute Service │
         │              │      (Go)       │
         │              └────────┬────────┘
         │                       │
         ▼                       ▼
┌─────────────────┐     ┌─────────────────┐
│  Camera/Video   │     │   PostgreSQL    │
│     Input       │     │   + AWS (S3/SQS)│
└─────────────────┘     └─────────────────┘

Project Structure

目录 技术栈 说明
meteor-edge-client/ Rust, Tokio 边缘客户端,摄像头采集 + Vida 检测
meteor-web-backend/ NestJS, TypeORM Web API认证、设备、事件管理
meteor-frontend/ Next.js 15, React 19 前端应用,仪表盘、图库、分析
meteor-compute-service/ Go 1.24 事件处理服务SQS 消费者
infrastructure/ Terraform AWS 基础设施 (RDS, S3, SQS)

Quick Start

# 安装依赖
npm install

# 启动开发服务器 (前端 + 后端)
npm run dev

# 构建边缘客户端
cd meteor-edge-client && cargo build --release

# 测试 Vida 流星检测
./target/release/meteor-edge-client test-vida video.mp4

Vida Detection Algorithm

边缘客户端实现了 Vida 流星检测算法(与 RMS/克罗地亚流星网络兼容):

  • FTP 压缩: 256帧 → maxpixel, avepixel, stdpixel, maxframe
  • 双路径检测:
    • FireballDetector (K1=4): 检测明亮火球
    • MeteorDetector (K1=1.5): 检测普通流星
  • 形态学处理: 清理、桥接、闭合、Zhang-Suen 细化
  • Hough 变换: 2D 直线检测 + 3D 点云分析

详见 CLAUDE.md 中的完整文档。

Development Commands

Full Stack

npm run dev              # 启动前端和后端
npm run build            # 构建所有服务
npm run test:fullstack   # 运行完整测试套件
npm run lint             # 代码检查

Edge Client (Rust)

cd meteor-edge-client
cargo build --release
cargo test
./target/release/meteor-edge-client run --camera device:0    # 使用摄像头
./target/release/meteor-edge-client run --camera file:v.mp4  # 使用视频文件
./target/release/meteor-edge-client test-vida video.mp4      # 测试检测

Backend (NestJS)

cd meteor-web-backend
npm run start:dev        # 开发模式
npm run migrate:up       # 运行迁移
npm run test             # 单元测试
npm run test:integration # 集成测试

Frontend (Next.js)

cd meteor-frontend
npm run dev              # 开发服务器
npm run build            # 生产构建
npm run test             # Jest 测试
npm run test:e2e         # Playwright E2E

Testing

类型 命令 说明
单元测试 npm run test Jest (前端+后端)
集成测试 npm run test:integration 后端 API + 数据库
E2E 测试 npm run test:e2e Playwright
边缘客户端 cargo test Rust 单元测试
全栈测试 npm run test:fullstack 完整测试套件

测试环境需要 Docker: ./test-setup.sh

Documentation

  • CLAUDE.md - 完整技术文档和 Claude Code 指引
  • TESTING.md - 详细测试矩阵
  • docs/EDGE_DEVICE_REGISTRATION_COMPLETE.md - 设备注册规范
  • infrastructure/README.md - 基础设施部署

License

MIT

Description
No description provided
Readme 139 MiB
Languages
Rust 45.6%
TypeScript 37.5%
JavaScript 7.6%
Go 5.9%
HCL 2%
Other 1.4%