feat(clip): font from selfdrive/assets (#35194)

* feat(clip): find font dynamically

* check font path as part of validating environment

* from testing

* use font from assets

* no mas
This commit is contained in:
Trey Moen
2025-05-12 19:49:37 -07:00
committed by GitHub
parent 51ab7ec8f5
commit 6b4436b980
2 changed files with 4 additions and 4 deletions
+4 -3
View File
@@ -28,6 +28,7 @@ RESOLUTION = '2160x1080'
SECONDS_TO_WARM = 2
PROC_WAIT_SECONDS = 30
OPENPILOT_FONT = str(Path(BASEDIR, 'selfdrive/assets/fonts/Inter-Regular.ttf').resolve())
REPLAY = str(Path(BASEDIR, 'tools/replay/replay').resolve())
UI = str(Path(BASEDIR, 'selfdrive/ui/ui').resolve())
@@ -169,12 +170,12 @@ def clip(data_dir: str | None, quality: Literal['low', 'high'], prefix: str, rou
meta_text = get_meta_text(route)
overlays = [
# metadata overlay
f"drawtext=text='{escape_ffmpeg_text(meta_text)}':fontfile=Inter.tff:fontcolor=white:fontsize=18:{box_style}:x=(w-text_w)/2:y=5.5:enable='between(t,1,5)'",
f"drawtext=text='{escape_ffmpeg_text(meta_text)}':fontfile={OPENPILOT_FONT}:fontcolor=white:fontsize=15:{box_style}:x=(w-text_w)/2:y=5.5:enable='between(t,1,5)'",
# route time overlay
f"drawtext=text='%{{eif\\:floor(({start}+t)/60)\\:d\\:2}}\\:%{{eif\\:mod({start}+t\\,60)\\:d\\:2}}':fontfile=Inter.tff:fontcolor=white:fontsize=24:{box_style}:x=w-text_w-38:y=38"
f"drawtext=text='%{{eif\\:floor(({start}+t)/60)\\:d\\:2}}\\:%{{eif\\:mod({start}+t\\,60)\\:d\\:2}}':fontfile={OPENPILOT_FONT}:fontcolor=white:fontsize=24:{box_style}:x=w-text_w-38:y=38"
]
if title:
overlays.append(f"drawtext=text='{escape_ffmpeg_text(title)}':fontfile=Inter.tff:fontcolor=white:fontsize=32:{box_style}:x=(w-text_w)/2:y=53")
overlays.append(f"drawtext=text='{escape_ffmpeg_text(title)}':fontfile={OPENPILOT_FONT}:fontcolor=white:fontsize=32:{box_style}:x=(w-text_w)/2:y=53")
ffmpeg_cmd = [
'ffmpeg', '-y',
-1
View File
@@ -33,7 +33,6 @@ function install_ubuntu_common_requirements() {
git \
git-lfs \
ffmpeg \
fonts-inter \
libavformat-dev \
libavcodec-dev \
libavdevice-dev \