From 743a6ab82f0bdbc1ccb8f45db8ca45a8e0b5feda Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sat, 10 Jan 2026 01:22:05 -0500 Subject: [PATCH] fix(author): improve DVD menu font fallback to prevent FFmpeg failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The menu generation was failing because it tried to use "IBM Plex Mono" font which isn't universally available. FFmpeg's drawtext filter would fail silently when the font didn't exist. Changes: - Check if FontPath actually exists before using it (os.Stat check) - Only use FontName if it's a known universally available font - Whitelist of safe fonts: DejaVu, Liberation, Free fonts - Ultimate fallback: "monospace" (most universally available) Before: - Tried IBM Plex Mono (not installed) → FFmpeg fails → "ERROR: FFmpeg failed during DVD encoding" After: - Tries IBM Plex Mono font file → doesn't exist - Checks if "IBM Plex Mono" is in safe list → not in list - Falls back to "monospace" → works everywhere This fixes the cryptic "FFmpeg failed during DVD encoding" error that actually occurred during menu generation, not encoding. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- author_menu.go | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/author_menu.go b/author_menu.go index 919d4cd..0b305a0 100644 --- a/author_menu.go +++ b/author_menu.go @@ -544,13 +544,29 @@ func resolveMenuTheme(theme *MenuTheme) *MenuTheme { } func menuFontArg(theme *MenuTheme) string { + // Try FontPath first (specific font file) if theme != nil && theme.FontPath != "" { - return fmt.Sprintf("fontfile='%s'", theme.FontPath) + if _, err := os.Stat(theme.FontPath); err == nil { + return fmt.Sprintf("fontfile='%s'", theme.FontPath) + } } + // FontPath doesn't exist or is empty - use system-wide fonts + // Only use FontName if it's a known universally available font if theme != nil && theme.FontName != "" { - return fmt.Sprintf("font='%s'", theme.FontName) + safeFonts := map[string]bool{ + "DejaVu Sans Mono": true, + "DejaVu Sans": true, + "Liberation Mono": true, + "Liberation Sans": true, + "FreeMono": true, + "FreeSans": true, + } + if safeFonts[theme.FontName] { + return fmt.Sprintf("font='%s'", theme.FontName) + } } - return "font='DejaVu Sans Mono'" + // Fallback to most universally available monospace font on Linux + return "font='monospace'" } func resolveMenuLogoPath(logo menuLogoOptions) string {