fix(author): remove quotes from fontfile and font paths in FFmpeg filter

Fixed FFmpeg filter parsing error by removing single quotes from font
paths and properly escaping special characters instead.

The Bug:
FFmpeg's drawtext filter was failing because fontfile paths were wrapped
in single quotes, which conflicted with the filter expression parsing:
  drawtext=fontfile='/path/to/font.ttf':text='Some Text'
                    ^                ^      ^          ^
                    These quotes broke FFmpeg's parser!

Error was:
  [AVFilterGraph] No option name near ' I Fucked My Best…'
  Error parsing filterchain ... around:

The Fix:
Before: fontfile='/home/.../IBMPlexMono-Regular.ttf'
After:  fontfile=/home/.../IBMPlexMono-Regular.ttf (with : and ' escaped)

Now we:
1. Escape : as \: (FFmpeg filter requirement)
2. Escape ' as \' (FFmpeg filter requirement)
3. Don't wrap in quotes (FFmpeg doesn't need them)

Same fix applied to font= paths (system fonts).

🤖 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 02:02:59 -05:00
parent 7c4bae1e2a
commit 9afe4251df

View File

@ -547,7 +547,10 @@ func menuFontArg(theme *MenuTheme) string {
// Try FontPath first (specific font file)
if theme != nil && theme.FontPath != "" {
if _, err := os.Stat(theme.FontPath); err == nil {
return fmt.Sprintf("fontfile='%s'", theme.FontPath)
// Escape the font path for FFmpeg filter - replace : and ' with escaped versions
escapedPath := strings.ReplaceAll(theme.FontPath, ":", "\\:")
escapedPath = strings.ReplaceAll(escapedPath, "'", "\\'")
return fmt.Sprintf("fontfile=%s", escapedPath)
}
}
// FontPath doesn't exist or is empty - use system-wide fonts
@ -562,11 +565,11 @@ func menuFontArg(theme *MenuTheme) string {
"FreeSans": true,
}
if safeFonts[theme.FontName] {
return fmt.Sprintf("font='%s'", theme.FontName)
return fmt.Sprintf("font=%s", theme.FontName)
}
}
// Fallback to most universally available monospace font on Linux
return "font='monospace'"
return "font=monospace"
}
func resolveMenuLogoPath(logo menuLogoOptions) string {