From cf80de2dbc95ca3ab9a7662bef40189d4440f2c2 Mon Sep 17 00:00:00 2001 From: Nelson Chen Date: Fri, 4 Oct 2024 21:41:27 -0700 Subject: [PATCH] Add auto as the default for file format. --- predict.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/predict.py b/predict.py index bd10566..e3c2d24 100644 --- a/predict.py +++ b/predict.py @@ -79,12 +79,13 @@ def predict( description="Rough size of clip output in MB.", ge=10, le=200, default=25 ), fileFormat: str = Input( - description="H.264 or HEVC (HEVC is 50-60 percent higher quality for its filesize but may not be compatible with all web browsers or devices).", + description="Auto, H.264, or HEVC (HEVC is 50-60 percent higher quality for its filesize but may not be compatible with all web browsers or devices). Auto, which is recommended, will choose HEVC for 360 renders and H.264 for all other renders.", choices=[ + "auto", "h264", "hevc", ], - default="h264", + default="auto", ), jwtToken: str = Input( description='Optional JWT Token from https://jwt.comma.ai for non-"Public access" routes. ⚠️ DO NOT SHARE THIS TOKEN WITH ANYONE as https://jwt.comma.ai generates JWT tokens valid for 90 days and they are irrevocable. Please use the safer, optionally temporary, more granular, and revocable "Public Access" toggle option on comma connect if possible. For more info, please see https://github.com/nelsonjchen/op-replay-clipper#jwt-token-input .', @@ -136,6 +137,13 @@ def predict( # Partition the data dir by the dongle ID from the route data_dir = os.path.join("./shared/data_dir", dongleID) + # If the file format is auto, set it to HEVC if the render type is 360 + if fileFormat == "auto": + if renderType == "360" or renderType == "360_forward_upon_wide": + fileFormat = "hevc" + else: + fileFormat = "h264" + if renderType == "ui": # Download the route data downloader.downloadSegments(