First VLAN camera in frigate
This commit is contained in:
		
							parent
							
								
									b32f6fa315
								
							
						
					
					
						commit
						0b3322afda
					
				@ -7,25 +7,12 @@ let
 | 
				
			|||||||
    ffmpeg = {
 | 
					    ffmpeg = {
 | 
				
			||||||
      input_args = "";
 | 
					      input_args = "";
 | 
				
			||||||
      inputs = [{
 | 
					      inputs = [{
 | 
				
			||||||
        path = address;
 | 
					        path = "http://${address}:8080";
 | 
				
			||||||
        roles = [ "detect" "record" ];
 | 
					        roles = [ "detect" "record" ];
 | 
				
			||||||
      }];
 | 
					      }];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      output_args.record = "-f segment -pix_fmt yuv420p -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -preset ultrafast -an ";
 | 
					      output_args.record = "-f segment -pix_fmt yuv420p -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -preset ultrafast -an ";
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    rtmp.enabled = false;
 | 
					 | 
				
			||||||
    snapshots = {
 | 
					 | 
				
			||||||
      enabled = true;
 | 
					 | 
				
			||||||
      bounding_box = true;
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    record = {
 | 
					 | 
				
			||||||
      enabled = true;
 | 
					 | 
				
			||||||
      retain.days = 10; # Keep video for 10 days
 | 
					 | 
				
			||||||
      events.retain = {
 | 
					 | 
				
			||||||
        default = 30; # Keep video with detections for 30 days
 | 
					 | 
				
			||||||
        mode = "active_objects";
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    detect = {
 | 
					    detect = {
 | 
				
			||||||
      enabled = true;
 | 
					      enabled = true;
 | 
				
			||||||
      width = 800;
 | 
					      width = 800;
 | 
				
			||||||
@ -36,6 +23,25 @@ let
 | 
				
			|||||||
      track = [ "person" ];
 | 
					      track = [ "person" ];
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  mkDahuaCam = address: {
 | 
				
			||||||
 | 
					    ffmpeg = {
 | 
				
			||||||
 | 
					      inputs = [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          path = "rtsp://admin:{FRIGATE_RTSP_PASSWORD}@${address}/cam/realmonitor?channel=1&subtype=0";
 | 
				
			||||||
 | 
					          roles = [ "record" ];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          path = "rtsp://admin:{FRIGATE_RTSP_PASSWORD}@${address}/cam/realmonitor?channel=1&subtype=1";
 | 
				
			||||||
 | 
					          roles = [ "detect" ];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      ];
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    detect.enabled = true;
 | 
				
			||||||
 | 
					    objects = {
 | 
				
			||||||
 | 
					      track = [ "person" "dog" ];
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
in
 | 
					in
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  networking.firewall.allowedTCPPorts = [
 | 
					  networking.firewall.allowedTCPPorts = [
 | 
				
			||||||
@ -50,8 +56,29 @@ in
 | 
				
			|||||||
        enabled = true;
 | 
					        enabled = true;
 | 
				
			||||||
        host = "localhost:1883";
 | 
					        host = "localhost:1883";
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					      rtmp.enabled = false;
 | 
				
			||||||
 | 
					      snapshots = {
 | 
				
			||||||
 | 
					        enabled = true;
 | 
				
			||||||
 | 
					        bounding_box = true;
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					      record = {
 | 
				
			||||||
 | 
					        enabled = true;
 | 
				
			||||||
 | 
					        # sync_recordings = true; # detect if recordings were deleted outside of frigate
 | 
				
			||||||
 | 
					        retain = {
 | 
				
			||||||
 | 
					          days = 2; # Keep video for 2 days
 | 
				
			||||||
 | 
					          mode = "motion";
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					        events = {
 | 
				
			||||||
 | 
					          retain = {
 | 
				
			||||||
 | 
					            default = 10; # Keep video with detections for 10 days
 | 
				
			||||||
 | 
					            mode = "motion";
 | 
				
			||||||
 | 
					            # mode = "active_objects";
 | 
				
			||||||
 | 
					          };
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
      cameras = {
 | 
					      cameras = {
 | 
				
			||||||
        dahlia-cam = mkEsp32Cam "http://dahlia-cam.lan:8080";
 | 
					        dahlia-cam = mkEsp32Cam "dahlia-cam.lan";
 | 
				
			||||||
 | 
					        dog-cam = mkDahuaCam "192.168.10.31";
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      # ffmpeg = {
 | 
					      # ffmpeg = {
 | 
				
			||||||
      #   hwaccel_args = "preset-vaapi";
 | 
					      #   hwaccel_args = "preset-vaapi";
 | 
				
			||||||
@ -63,6 +90,10 @@ in
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Pass in env file with secrets to frigate
 | 
				
			||||||
 | 
					  systemd.services.frigate.serviceConfig.EnvironmentFile = "/run/agenix/frigate-credentials";
 | 
				
			||||||
 | 
					  age.secrets.frigate-credentials.file = ../../../secrets/frigate-credentials.age;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # AMD GPU for vaapi
 | 
					  # AMD GPU for vaapi
 | 
				
			||||||
  systemd.services.frigate.environment.LIBVA_DRIVER_NAME = "radeonsi";
 | 
					  systemd.services.frigate.environment.LIBVA_DRIVER_NAME = "radeonsi";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -70,9 +101,7 @@ in
 | 
				
			|||||||
  services.udev.packages = [ pkgs.libedgetpu ];
 | 
					  services.udev.packages = [ pkgs.libedgetpu ];
 | 
				
			||||||
  users.groups.apex = { };
 | 
					  users.groups.apex = { };
 | 
				
			||||||
  systemd.services.frigate.environment.LD_LIBRARY_PATH = "${pkgs.libedgetpu}/lib";
 | 
					  systemd.services.frigate.environment.LD_LIBRARY_PATH = "${pkgs.libedgetpu}/lib";
 | 
				
			||||||
  systemd.services.frigate.serviceConfig = {
 | 
					  systemd.services.frigate.serviceConfig.SupplementaryGroups = "apex";
 | 
				
			||||||
    SupplementaryGroups = "apex";
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
  # Coral PCIe driver
 | 
					  # Coral PCIe driver
 | 
				
			||||||
  kernel.enableGasketKernelModule = true;
 | 
					  kernel.enableGasketKernelModule = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -11,6 +11,7 @@
 | 
				
			|||||||
    "pia"
 | 
					    "pia"
 | 
				
			||||||
    "binary-cache"
 | 
					    "binary-cache"
 | 
				
			||||||
    "gitea-actions-runner"
 | 
					    "gitea-actions-runner"
 | 
				
			||||||
 | 
					    "frigate"
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAwiXcUFtAvZCayhu4+AIcF+Ktrdgv9ee/mXSIhJbp4q";
 | 
					  hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAwiXcUFtAvZCayhu4+AIcF+Ktrdgv9ee/mXSIhJbp4q";
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										7
									
								
								secrets/frigate-credentials.age
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								secrets/frigate-credentials.age
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					age-encryption.org/v1
 | 
				
			||||||
 | 
					-> ssh-ed25519 hPp1nw Chke1ZtpXxN1c1+AnJ6Cd5kpM1KfQKTwymrfPW53QCA
 | 
				
			||||||
 | 
					jUcw8eitC7r0rwefjllndZjARIqpWoVqGCnefHfjQ6Y
 | 
				
			||||||
 | 
					-> ssh-ed25519 w3nu8g KY/5bU1B5uvmfGHF2d6qBL1NYy64qo324rdvkgnXoDA
 | 
				
			||||||
 | 
					OBvuFtzZXQ0RmmEXelyzHMMiVqZir7zQJMA36ZH2siE
 | 
				
			||||||
 | 
					--- CSd7lYSYQ2fCTjkJLPGdaNGL8eVpE9IBEyFo0LW907M
 | 
				
			||||||
 | 
					£³$šO†ÈIß/À//Êw*ƒ™õD¤@u5o[¼â:·äš¥t¾˜]Jñ쮸™@Ùhþu£Àk;?·XüÁHRº’ѰE5¥ÍçÜ9
 | 
				
			||||||
@ -54,4 +54,7 @@ with roles;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  # For ACME DNS Challenge
 | 
					  # For ACME DNS Challenge
 | 
				
			||||||
  "digitalocean-dns-credentials.age".publicKeys = server;
 | 
					  "digitalocean-dns-credentials.age".publicKeys = server;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Frigate (DVR)
 | 
				
			||||||
 | 
					  "frigate-credentials.age".publicKeys = frigate;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user