make height optional

This commit is contained in:
Josh Hawkins 2024-09-04 08:36:39 -05:00
parent ccee0d9e2b
commit 1437ccedea
2 changed files with 3 additions and 3 deletions

View File

@ -275,7 +275,7 @@ def submit_recording_snapshot_to_plus(camera_name: str, frame_time: str):
try:
recording: Recordings = recording_query.get()
time_in_segment = frame_time - recording.start_time
image_data = get_image_from_recording(recording.path, time_in_segment, "png", 0)
image_data = get_image_from_recording(recording.path, time_in_segment, "png")
if not image_data:
return make_response(

View File

@ -765,7 +765,7 @@ def add_mask(mask: str, mask_img: np.ndarray):
def get_image_from_recording(
file_path: str, relative_frame_time: float, codec: str, height: int
file_path: str, relative_frame_time: float, codec: str, height: Optional[int] = None
) -> Optional[any]:
"""retrieve a frame from given time in recording file."""
@ -787,7 +787,7 @@ def get_image_from_recording(
"-",
]
if height:
if height is not None:
ffmpeg_cmd.insert(-3, "-vf")
ffmpeg_cmd.insert(-3, f"scale=-1:{height}")