mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Add metadata title field to exports (#16664)
This commit is contained in:
		
							parent
							
								
									f49a8009ec
								
							
						
					
					
						commit
						b6db97d313
					
				@ -80,8 +80,8 @@ class RecordingExporter(threading.Thread):
 | 
				
			|||||||
        Path(os.path.join(CLIPS_DIR, "export")).mkdir(exist_ok=True)
 | 
					        Path(os.path.join(CLIPS_DIR, "export")).mkdir(exist_ok=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_datetime_from_timestamp(self, timestamp: int) -> str:
 | 
					    def get_datetime_from_timestamp(self, timestamp: int) -> str:
 | 
				
			||||||
        """Convenience fun to get a simple date time from timestamp."""
 | 
					        # return in iso format
 | 
				
			||||||
        return datetime.datetime.fromtimestamp(timestamp).strftime("%Y/%m/%d %H:%M")
 | 
					        return datetime.datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def save_thumbnail(self, id: str) -> str:
 | 
					    def save_thumbnail(self, id: str) -> str:
 | 
				
			||||||
        thumb_path = os.path.join(CLIPS_DIR, f"export/{id}.webp")
 | 
					        thumb_path = os.path.join(CLIPS_DIR, f"export/{id}.webp")
 | 
				
			||||||
@ -236,6 +236,10 @@ class RecordingExporter(threading.Thread):
 | 
				
			|||||||
        if self.config.ffmpeg.apple_compatibility:
 | 
					        if self.config.ffmpeg.apple_compatibility:
 | 
				
			||||||
            ffmpeg_cmd += FFMPEG_HVC1_ARGS
 | 
					            ffmpeg_cmd += FFMPEG_HVC1_ARGS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # add metadata
 | 
				
			||||||
 | 
					        title = f"Frigate Recording for {self.camera}, {self.get_datetime_from_timestamp(self.start_time)} - {self.get_datetime_from_timestamp(self.end_time)}"
 | 
				
			||||||
 | 
					        ffmpeg_cmd.extend(["-metadata", f"title={title}"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ffmpeg_cmd.append(video_path)
 | 
					        ffmpeg_cmd.append(video_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return ffmpeg_cmd, playlist_lines
 | 
					        return ffmpeg_cmd, playlist_lines
 | 
				
			||||||
@ -323,6 +327,10 @@ class RecordingExporter(threading.Thread):
 | 
				
			|||||||
                )
 | 
					                )
 | 
				
			||||||
            ).split(" ")
 | 
					            ).split(" ")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # add metadata
 | 
				
			||||||
 | 
					        title = f"Frigate Preview for {self.camera}, {self.get_datetime_from_timestamp(self.start_time)} - {self.get_datetime_from_timestamp(self.end_time)}"
 | 
				
			||||||
 | 
					        ffmpeg_cmd.extend(["-metadata", f"title={title}"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return ffmpeg_cmd, playlist_lines
 | 
					        return ffmpeg_cmd, playlist_lines
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def run(self) -> None:
 | 
					    def run(self) -> None:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user