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
pull/33601/merge
Trey Moen 1 week ago committed by GitHub
parent 51ab7ec8f5
commit 6b4436b980
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      tools/clip/run.py
  2. 1
      tools/install_ubuntu_dependencies.sh

@ -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',

@ -33,7 +33,6 @@ function install_ubuntu_common_requirements() {
git \
git-lfs \
ffmpeg \
fonts-inter \
libavformat-dev \
libavcodec-dev \
libavdevice-dev \

Loading…
Cancel
Save