Use Bebas Neue and Inter fonts

This commit is contained in:
hbrain 2026-05-24 20:51:15 +00:00
parent ffc1974343
commit 0c1ee1c42a
2 changed files with 27 additions and 23 deletions

View file

@ -386,47 +386,58 @@ def build_video(
final_label = "vout"
title_label = "titled"
title_font = str(Path.home() / ".local/share/fonts/google/BebasNeue-Regular.ttf")
stamp_font = str(Path.home() / ".local/share/fonts/google/Montserrat%5Bwght%5D.ttf")
stamp_font = str(Path.home() / ".local/share/fonts/google/Inter%5Bopsz,wght%5D.ttf")
if title_lines:
title_font_size = max(44, height // 14)
title_font_size = max(50, height // 12)
subtitle_font_size = max(28, height // 24)
main_title = data.title or title_lines[0]
subtitle = " | ".join(x for x in [data.date, data.place] if x)
title_alpha = "if(lt(t\\,5)\\,1\\,if(lt(t\\,6)\\,6-t\\,0))"
if subtitle:
title_y = f"(h-text_h)/2-{title_font_size // 2}"
filters.append(
f"[{current}]drawtext=fontfile='{title_font}':text='{drawtext_escape(main_title)}':x=(w-text_w)/2:y=(h-text_h)/2-{title_font_size // 2}:"
f"fontsize={title_font_size}:fontcolor=white:borderw=3:bordercolor=black:"
f"[{current}]drawtext=fontfile='{title_font}':text='{drawtext_escape(main_title)}':x=(w-text_w)/2:y={title_y}:"
f"fontsize={title_font_size}:text_spacing=4:fontcolor=white:borderw=3:bordercolor=black:"
f"alpha='{title_alpha}':enable='between(t,0,6)'[title0]"
)
filters.append(
f"[title0]drawtext=fontfile='{title_font}':text='{drawtext_escape(subtitle)}':x=(w-text_w)/2:y=(h-text_h)/2+{subtitle_font_size}:"
f"[title0]drawtext=fontfile='{title_font}':text='{drawtext_escape(main_title)}':x=(w-text_w)/2+1:y={title_y}:"
f"fontsize={title_font_size}:text_spacing=4:fontcolor=white:borderw=3:bordercolor=black:"
f"alpha='{title_alpha}':enable='between(t,0,6)'[title0b]"
)
filters.append(
f"[title0b]drawtext=fontfile='{title_font}':text='{drawtext_escape(subtitle)}':x=(w-text_w)/2:y=(h-text_h)/2+{subtitle_font_size}:"
f"fontsize={subtitle_font_size}:fontcolor=white:borderw=3:bordercolor=black:"
f"alpha='{title_alpha}':enable='between(t,0,6)'[{title_label}]"
)
else:
filters.append(
f"[{current}]drawtext=fontfile='{title_font}':text='{drawtext_escape(main_title)}':x=(w-text_w)/2:y=(h-text_h)/2:"
f"fontsize={title_font_size}:fontcolor=white:borderw=3:bordercolor=black:"
f"fontsize={title_font_size}:text_spacing=4:fontcolor=white:borderw=3:bordercolor=black:"
f"alpha='{title_alpha}':enable='between(t,0,6)'[title0]"
)
filters.append(
f"[title0]drawtext=fontfile='{title_font}':text='{drawtext_escape(main_title)}':x=(w-text_w)/2+1:y=(h-text_h)/2:"
f"fontsize={title_font_size}:text_spacing=4:fontcolor=white:borderw=3:bordercolor=black:"
f"alpha='{title_alpha}':enable='between(t,0,6)'[{title_label}]"
)
else:
filters.append(f"[{current}]copy[{title_label}]")
stamp_size = max(14, height // 60)
stamp_size = max(11, height // 80)
stamp_lines = [x for x in [data.title, data.date, data.place] if x]
stamp_text = drawtext_escape(" | ".join(stamp_lines))
stamp_left_label = "stamp_left"
if stamp_text:
filters.append(
f"[{title_label}]drawtext=fontfile='{stamp_font}':text='{stamp_text}':x=24:y=h-text_h-18:"
f"fontsize={stamp_size}:fontcolor=white@0.92:borderw=2:bordercolor=black@0.85[{stamp_left_label}]"
f"fontsize={stamp_size}:fontcolor=white:borderw=3:bordercolor=black[{stamp_left_label}]"
)
else:
filters.append(f"[{title_label}]copy[{stamp_left_label}]")
filters.append(
f"[{stamp_left_label}]drawtext=fontfile='{stamp_font}':text='marijo@novosel.dk':x=w-text_w-24:y=h-text_h-18:"
f"fontsize={stamp_size}:fontcolor=white@0.92:borderw=2:bordercolor=black@0.85[{final_label}]"
f"[{stamp_left_label}]drawtext=fontfile='{stamp_font}':text='@bubulescu':x=w-text_w-24:y=h-text_h-18:"
f"fontsize={stamp_size}:fontcolor=white:borderw=3:bordercolor=black[{final_label}]"
)
cmd += ["-filter_complex", ";".join(filters), "-map", f"[{final_label}]"]