summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2025-05-01 05:04:54 +0200
committerMel <mel@rnrd.eu>2025-05-01 05:04:54 +0200
commitd3ebb82f12969ffca03d4c6927330d8aa3b3de01 (patch)
tree52b05b041d796ba976380455d2a0defd0ee995ef /modules
parentcee18d9ba59b96087854f4c50474842c04b40105 (diff)
downloadnetwork-d3ebb82f12969ffca03d4c6927330d8aa3b3de01.tar.zst
network-d3ebb82f12969ffca03d4c6927330d8aa3b3de01.zip
Stream MJPEG webcam frames through go2rtc
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'modules')
-rw-r--r--modules/go2rtc.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/go2rtc.nix b/modules/go2rtc.nix
index 488d679..62d2531 100644
--- a/modules/go2rtc.nix
+++ b/modules/go2rtc.nix
@@ -2,8 +2,8 @@
 
 let
   ffmpegDevice =
-    device: format: resolution: hz:
-    "ffmpeg:device?video=${device}&input_format=${format}&video_size=${resolution}&framerate=${hz}#video=h264#hardware";
+    device: format: resolution: hz: options:
+    "ffmpeg:device?video=${device}&input_format=${format}&video_size=${resolution}&framerate=${hz}${options}";
 
   go2rtcPort = 1984;
   webrtcPort = 8555;
@@ -29,7 +29,10 @@ in
         };
 
       streams = {
-        webcam = ffmpegDevice "/dev/video0" "yuyv422" "1280x720" "30";
+        cam1-yuyv422 = ffmpegDevice "/dev/video0" "yuyv422" "1280x960" "30" "#video=h264#hardware";
+        # todo: i think ffmpeg still currently reencodes the mjpeg again,
+        # but with video=copy all i get back are corrupted frames.
+        cam1-mjpeg = ffmpegDevice "/dev/video0" "mjpeg" "1280x960" "30" "";
       };
     };
   };