Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion server/src/cameras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ export function go2rtcSources(c: CameraRecord, ffmpegAvailable: boolean, eufySou
for (const e of c.caps.extra ?? []) main.push(e);
if (ffmpegAvailable) {
if (c.kind === "http") main.push(`ffmpeg:${c.streamKey}#video=h264`);
else main.push(`ffmpeg:${c.streamKey}#audio=aac`, `ffmpeg:${c.streamKey}#video=mjpeg`);
// Opus lets WebRTC carry the camera audio. Without it the player's WebRTC stream has video only and
// video-rtc.js drops it in favour of MSE (H.264+AAC scores higher), so live view never gets WebRTC latency.
// go2rtc only starts these transcoders when a consumer asks for that codec.
else main.push(`ffmpeg:${c.streamKey}#audio=aac`, `ffmpeg:${c.streamKey}#audio=opus`, `ffmpeg:${c.streamKey}#video=mjpeg`);
}
out.push({ name: c.streamKey, sources: main });
if (c.subUrl) out.push({ name: `${c.streamKey}_sub`, sources: [c.subUrl] });
Expand Down
2 changes: 1 addition & 1 deletion server/test/brands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe("go2rtc sources", () => {
test("main + sub with ffmpeg helpers", () => {
const s = go2rtcSources(base, true);
expect(s[0]!.name).toBe("c1");
expect(s[0]!.sources).toEqual(["rtsp://a/1", "ffmpeg:c1#audio=aac", "ffmpeg:c1#video=mjpeg"]);
expect(s[0]!.sources).toEqual(["rtsp://a/1", "ffmpeg:c1#audio=aac", "ffmpeg:c1#audio=opus", "ffmpeg:c1#video=mjpeg"]);
expect(s[1]).toEqual({ name: "c1_sub", sources: ["rtsp://a/2"] });
});
test("push camera has no source", () => {
Expand Down