blob: 488d6797261a1b16e1533c1d0b44dc31075381f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
{ me, ... }:
let
ffmpegDevice =
device: format: resolution: hz:
"ffmpeg:device?video=${device}&input_format=${format}&video_size=${resolution}&framerate=${hz}#video=h264#hardware";
go2rtcPort = 1984;
webrtcPort = 8555;
in
{
services.go2rtc = {
enable = true;
settings = {
api = {
listen = "${me.tailscale.ip}:${toString go2rtcPort}";
base_path = "/webcam";
origin = "*"; # stop cors annoyance!
};
webrtc =
let
address = "${me.tailscale.ip}:${toString webrtcPort}";
in
{
listen = address;
candidates = [ address ];
};
streams = {
webcam = ffmpegDevice "/dev/video0" "yuyv422" "1280x720" "30";
};
};
};
foundation.tailnetServices = [ "go2rtc" ];
}
|