Add ?mp4 parameter support for BUBBLE streams in Frigate config

- Add buildRtspPath() helper method to conditionally append ?mp4
- Only BUBBLE stream types get ?mp4 suffix for proper recording
- Other stream types (RTSP, ONVIF, JPEG, etc.) remain unchanged
- Handles both single and dual-stream configurations correctly
This commit is contained in:
eduard256
2025-11-26 15:29:56 +03:00
parent eedce14731
commit e6828d8a22
@@ -252,6 +252,15 @@ export class FrigateGenerator {
return lines; return lines;
} }
/**
* Build RTSP path with optional ?mp4 suffix for BUBBLE streams
*/
static buildRtspPath(streamName, streamType) {
const basePath = `rtsp://127.0.0.1:8554/${streamName}`;
// Add ?mp4 parameter only for BUBBLE streams to enable recording in Frigate
return streamType === 'BUBBLE' ? `${basePath}?mp4` : basePath;
}
/** /**
* Generate camera lines for cameras section * Generate camera lines for cameras section
*/ */
@@ -264,11 +273,14 @@ export class FrigateGenerator {
if (cameraInfo.subStream) { if (cameraInfo.subStream) {
// Use sub for detect, main for record // Use sub for detect, main for record
lines.push(` - path: rtsp://127.0.0.1:8554/${cameraInfo.subStreamName}`); const subPath = this.buildRtspPath(cameraInfo.subStreamName, cameraInfo.subStream.type);
const mainPath = this.buildRtspPath(cameraInfo.mainStreamName, cameraInfo.mainStream.type);
lines.push(` - path: ${subPath}`);
lines.push(' input_args: preset-rtsp-restream'); lines.push(' input_args: preset-rtsp-restream');
lines.push(' roles:'); lines.push(' roles:');
lines.push(' - detect'); lines.push(' - detect');
lines.push(` - path: rtsp://127.0.0.1:8554/${cameraInfo.mainStreamName}`); lines.push(` - path: ${mainPath}`);
lines.push(' input_args: preset-rtsp-restream'); lines.push(' input_args: preset-rtsp-restream');
lines.push(' roles:'); lines.push(' roles:');
lines.push(' - record'); lines.push(' - record');
@@ -280,7 +292,9 @@ export class FrigateGenerator {
lines.push(` Sub Stream: ${cameraInfo.subStreamName} # Низкое разрешение (опционально)`); lines.push(` Sub Stream: ${cameraInfo.subStreamName} # Низкое разрешение (опционально)`);
} else { } else {
// Use main for both detect and record // Use main for both detect and record
lines.push(` - path: rtsp://127.0.0.1:8554/${cameraInfo.mainStreamName}`); const mainPath = this.buildRtspPath(cameraInfo.mainStreamName, cameraInfo.mainStream.type);
lines.push(` - path: ${mainPath}`);
lines.push(' input_args: preset-rtsp-restream'); lines.push(' input_args: preset-rtsp-restream');
lines.push(' roles:'); lines.push(' roles:');
lines.push(' - detect'); lines.push(' - detect');