Route live recording through ffmpeg MP4 segments and the 5.15 batch subprocess, remove simulated RTSP chain 2, purge expired slices on startup and hourly, and expose TTL settings to the demo client. Co-authored-by: Cursor <cursoragent@cursor.com>
111 lines
5.5 KiB
Plaintext
Executable File
111 lines
5.5 KiB
Plaintext
Executable File
# 复制为 `backend/.env` 并按环境填写。在 `backend/` 目录执行:`docker compose up -d --build`
|
||
# 详细说明见 docs/Docker部署.md 与 docs/video-backends.md。
|
||
# 算法、管线、归档路径、视觉/语音日志等非部署项见 `app/baked/algorithm.py` 与 `app/baked/pipeline.py`。
|
||
#
|
||
# 5-6 ActionFormer 实时算法(默认开启):
|
||
# - app/resources/actionformer_epoch_045.pth.tar 必须存在(离线下发,~110MB,未入 git)。
|
||
# - VideoSwin Swin3D-T 走 torchvision Kinetics-400 预训练,**首次运行需联网下载**;
|
||
# 可设 TORCH_HOME 指向持久化目录(容器中已默认 /root/.cache/torch),或将权重
|
||
# 提前预热到该目录避免开录时拉取。
|
||
# - Linux GPU 机:镜像内 torch / torchvision / torchaudio 为 cu130 wheel;
|
||
# 宿主机需 NVIDIA 驱动 + NVIDIA Container Toolkit;`api` 服务已配置 `gpus: all`。
|
||
# 启动后可验证:docker compose exec api python -c "import torch; print(torch.cuda.is_available())"
|
||
|
||
# --- PostgreSQL ---
|
||
POSTGRES_USER=postgres
|
||
POSTGRES_PASSWORD=postgres
|
||
POSTGRES_DB=operation_room
|
||
# 以下两项供宿主机工具连库调试;API 容器内使用 POSTGRES_HOST=db、POSTGRES_PORT=5432(由 compose 注入)。
|
||
POSTGRES_HOST=localhost
|
||
POSTGRES_PORT=45432
|
||
# 可选:整串 async DSN(会覆盖与默认一致的 POSTGRES_* 组合时的逻辑,见 Settings)
|
||
# DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:45432/operation_room
|
||
# 可选:映射 PostgreSQL 到宿主机端口(默认 45432),仅 DBA/调试用途
|
||
# DOCKER_POSTGRES_PUBLISH_PORT=45432
|
||
|
||
# --- HTTP(API 对外端口)---
|
||
# 局域网语音确认终端 / Demo 客户端访问 API 时,填写
|
||
# http://<GPU服务器局域网IP>:38080 作为服务端 Base URL。
|
||
# API_PORT=38080
|
||
|
||
# --- GPU 推理(可选覆盖,默认自动选 cuda:0)---
|
||
# CONSUMABLE_CLASSIFIER_DEVICE=cuda:0
|
||
# HAND_DETECTION_DEVICE=cuda:0
|
||
|
||
# --- Video:RTSP 与按路后端(须与客户端 camera_ids 一致)---
|
||
# 单路 RTSP 首次打开超时(秒);四路须在「该值 + 5」秒内全部就绪,穿透/公网链路可调大(默认 45)。
|
||
# VIDEO_OPEN_TIMEOUT_SEC=45
|
||
# VIDEO_DEFAULT_BACKEND=rtsp
|
||
# VIDEO_CAMERA_BACKEND_OVERRIDES_JSON={"or-cam-01":"rtsp","or-cam-02":"hikvision_sdk"}
|
||
# 站点 JSON:术间↔摄像头↔语音终端只在这里维护(voice_or_room_bindings);须同时含 video_rtsp_urls;可为 []。
|
||
# 见 app/resources/or_site_config.sample.json
|
||
# OR_SITE_CONFIG_JSON_FILE=app/resources/or_site_config.sample.json
|
||
# VIDEO_RTSP_URL_TEMPLATE=rtsp://user:pass@host:554/path/{camera_id}
|
||
#
|
||
# 语音终端 ID 在站点 JSON 的 voice_or_room_bindings 中配置;浏览器语音确认页(clients/voice-confirmation/)在页面内填写本机终端 ID。
|
||
#
|
||
# API 在 Docker 内访问宿主机 RTSP 时使用 host.docker.internal(compose 已配置 extra_hosts)。
|
||
# OpenCV/FFmpeg 拉 RTSP 默认使用 TCP;仅当必须让 FFmpeg 自选传输时在 .env 中设空覆盖:
|
||
# OPENCV_FFMPEG_CAPTURE_OPTIONS=
|
||
|
||
# --- 海康 SDK(Linux x86_64;二进制勿提交仓库)---
|
||
# HIKVISION_LIB_DIR=/opt/hikvision/lib
|
||
# 可选:单一路径,见 app/services/video/hikvision_runtime.py 直读 HIKVISION_LIB_PATH
|
||
# HIKVISION_LIB_PATH=
|
||
# HIKVISION_SDK_ENABLED=false
|
||
# HIKVISION_DEVICE_IP=
|
||
# HIKVISION_USER=
|
||
# HIKVISION_PASSWORD=
|
||
# HIKVISION_CHANNEL=1
|
||
# HIKVISION_PREVIEW_RTSP_TEMPLATE=rtsp://{user}:{password}@{ip}:554/Streaming/Channels/101
|
||
# HIKVISION_CAMERA_RTSP_URLS_JSON={}
|
||
# HIKVISION_SDK_FALLBACK_TO_RTSP=true
|
||
|
||
# --- 百度(语音:短语音识别 AipSpeech + 在线合成;控制台开通对应能力)---
|
||
# BAIDU_APP_ID=
|
||
# BAIDU_API_KEY=
|
||
# BAIDU_SECRET_KEY=
|
||
# 可选
|
||
# BAIDU_CONNECTION_TIMEOUT_MS=
|
||
# BAIDU_SOCKET_TIMEOUT_MS=
|
||
# BAIDU_ASR_DEV_PID=1537
|
||
|
||
# --- MinIO(语音 WAV)---
|
||
# 容器内 API 默认通过 DOCKER_MINIO_ENDPOINT=minio:9000 访问;以下为 compose 默认值。
|
||
# MINIO_ENDPOINT=127.0.0.1:19000
|
||
# MINIO_ACCESS_KEY=minioadmin
|
||
# MINIO_SECRET_KEY=minioadmin
|
||
# MINIO_BUCKET=operation-room-voice
|
||
# MINIO_SECURE=false
|
||
# MINIO_REGION=
|
||
# MINIO_PORT=19000
|
||
# MINIO_CONSOLE_PORT=19001
|
||
|
||
# --- 视频:RTSP 切片 + batch(链路 1)---
|
||
# RTSP_PRIMARY_CAMERA_ID=or-cam-03
|
||
# RTSP_RECORD_ALL_CAMERAS=false
|
||
# RTSP_SEGMENT_DURATION_SEC=120
|
||
# RTSP_SEGMENT_MIN_SEC=10
|
||
# RTSP_SEGMENT_TTL_HOURS=24
|
||
# RTSP_SLICE_BATCH_MAX_CONCURRENT=1
|
||
# RTSP_SLICE_BATCH_DRAIN_TIMEOUT_SEC=900
|
||
|
||
# --- Demo 客户端 / 语音确认客户端 ---
|
||
# 独立部署的 Demo 客户端 / 语音确认页访问 API 时需放行 CORS;正式部署建议收窄 origins。
|
||
# DEMO_CORS_ENABLED=true
|
||
# 跨主机语音页访问 API 时,可先用 * 联调;生产建议改成具体语音页来源,如 http://192.168.1.100:8080
|
||
# DEMO_CORS_ORIGINS=*
|
||
# 链路 3(离线 batch)Demo 需开启;链路 1 真 RTSP 开录不依赖此项
|
||
# DEMO_ORCHESTRATOR_ENABLED=false
|
||
# 联调台 HLS(Compose:先 docker compose up -d mediamtx-hls api)
|
||
# Compose 内 api 反代侧车:DEMO_HLS_PREVIEW_UPSTREAM=http://mediamtx-hls:8888
|
||
# 本机 uvicorn 直连 published 端口:DEMO_HLS_PREVIEW_UPSTREAM=http://127.0.0.1:18888
|
||
# 本机 uvicorn 且无 mediamtx-hls 侧车时改为:DEMO_HLS_PREVIEW_UPSTREAM=ephemeral
|
||
# DEMO_HLS_PREVIEW_PORT=18888
|
||
# HLS 预览 MediaMTX 镜像(Compose mediamtx-hls 与 ensure 临时容器共用)
|
||
# MEDIAMTX_DOCKER_IMAGE=m.daocloud.io/docker.io/bluenviron/mediamtx:latest
|
||
|
||
# --- 语音确认静态页(clients/voice-confirmation/start.sh)---
|
||
# 默认 0.0.0.0 供局域网内语音终端访问;仅本机调试时可设 127.0.0.1
|
||
# VOCH_HTTP_BIND=0.0.0.0
|