Files
video_player/README.md

87 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Video Player
一個使用 OpenCV 和 YOLO 物體檢測的視頻播放器,支持實時檢測和預掃描數據顯示。
## 功能特點
- 視頻播放(使用 OpenCV
- YOLO 物體檢測覆蓋層
- 實時檢測(藍色框)
- 預掃描數據顯示(綠色框)
- 三個窗口布局
- 原始視頻窗口
- YOLO 檢測窗口
- 命令窗口
- 時間碼和幀信息狀態欄
- 音頻播放控制
## 系統需求
- Python 3.7+
- OpenCV (cv2)
- NumPy
- Ultralytics YOLO
- ffplay用於音頻播放
## 安裝
```bash
pip install opencv-python numpy ultralytics
```
確保已安裝 `ffplay`macOS: `brew install ffmpeg`, Ubuntu: `sudo apt-get install ffmpeg`
## 使用方法
```bash
python video_player.py <video_path> <yolo_model_path>
```
### 示例
```bash
python video_player.py video.mp4 yolov8n.pt
```
## 快捷鍵
| 按鍵 | 功能 |
|------|------|
| `y` / `Y` | 切換實時 YOLO 檢測(藍框) |
| `p` / `P` | 切換預掃描 YOLO 數據(綠框) |
| `Space` | 暫停/恢復 |
| `s` / `S` | 切換聲音 |
| `b` / `B` | 切換狀態欄顯示 |
| `h` / `H` | 隱藏當前窗口 |
| `1` | 切換原始視頻窗口 |
| `2` | 切換 YOLO 檢測窗口 |
| `3` | 切換命令窗口 |
| `←` / `→` | 快進/快退 ±5 秒 |
| `Shift + ←` / `Shift + →` | 快進/快退 ±30 秒 |
| `q` / `ESC` | 退出 |
## 命令輸入
在命令窗口中可輸入:
- **幀號**:直接輸入數字跳轉到指定幀
- **時間格式**`hh:mm:ss.ff` 跳轉到指定時間
- **相對跳轉**`+10``-5`
- **探針信息**:輸入 `i` 顯示視頻詳細信息
## 相關文件
播放器會嘗試加載以下輔助文件(與視頻同名):
- `.probe.json` - 視頻探針信息
- `.yolo.json` - 預掃描的 YOLO 檢測數據
## 版本信息
- 版本2.0.0
- 構建時間2026-03-06
## 許可證
MIT License