Umbau mit cameraSwitch Fix Delay
This commit is contained in:
@@ -12,13 +12,16 @@ const LIVE_SIZE = process.env.LIVE_SIZE ?? '640x480';
|
||||
const LIVE_FPS = parseInt(process.env.LIVE_FPS ?? '30', 10);
|
||||
const HIRES_SIZE = process.env.HIRES_SIZE ?? '1280x960';
|
||||
const HIRES_FPS = parseInt(process.env.HIRES_FPS ?? '15', 10);
|
||||
const ENCODE_MODE = process.env.ENCODE_MODE ?? 'copybsf'; // 'copybsf' (niedrige CPU) | 'mjpeg' (Re-Encode-Fallback)
|
||||
const ON_DEMAND = (process.env.ON_DEMAND ?? 'true') !== 'false'; // Live nur bei Verbrauchern (spart idle-CPU)
|
||||
const IDLE_GRACE_MS = parseInt(process.env.IDLE_GRACE_MS ?? '15000', 10);
|
||||
|
||||
// ── Kameras: cam0 = erstes Gerät, cam1 = zweites … (DEV0/DEV1-Env überschreibt) ─
|
||||
const devices = detectDevices();
|
||||
const switches = {};
|
||||
devices.forEach((device, i) => {
|
||||
const id = `cam${i}`;
|
||||
switches[id] = new CameraSwitch({ id, device, liveSize: LIVE_SIZE, liveFps: LIVE_FPS, hiresSize: HIRES_SIZE, hiresFps: HIRES_FPS });
|
||||
switches[id] = new CameraSwitch({ id, device, liveSize: LIVE_SIZE, liveFps: LIVE_FPS, hiresSize: HIRES_SIZE, hiresFps: HIRES_FPS, encode: ENCODE_MODE, onDemand: ON_DEMAND, idleGraceMs: IDLE_GRACE_MS });
|
||||
});
|
||||
|
||||
const app = express();
|
||||
@@ -52,7 +55,7 @@ const server = http.createServer(app);
|
||||
server.listen(PORT, '0.0.0.0', () => {
|
||||
console.log(`AppRobotWebcam http://0.0.0.0:${PORT}`);
|
||||
console.log(` Kameras: ${Object.entries(switches).map(([id, sw]) => `${id}=${sw.device}`).join(', ')}`);
|
||||
console.log(` Live: ${LIVE_SIZE}@${LIVE_FPS} · HD-Grab: ${HIRES_SIZE}@${HIRES_FPS}`);
|
||||
console.log(` Live: ${LIVE_SIZE}@${LIVE_FPS} · HD-Grab: ${HIRES_SIZE}@${HIRES_FPS} · Encode: ${ENCODE_MODE} · On-Demand: ${ON_DEMAND}`);
|
||||
console.log(` Viewer: http://0.0.0.0:${PORT}/`);
|
||||
console.log(` Live-Stream: http://0.0.0.0:${PORT}/api/stream/cam0`);
|
||||
console.log(` Snapshot API: http://0.0.0.0:${PORT}/api/snapshot/cam0 (+ /hires)`);
|
||||
|
||||
Reference in New Issue
Block a user