fix(author): improve DVD menu font fallback to prevent FFmpeg failures

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 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2026-01-10 01:22:05 -05:00
parent b6dbcde177
commit 743a6ab82f

View File

@ -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 {