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).
This commit is contained in:
parent
53a11819ec
commit
9dd6ddd1e5
|
|
@ -547,7 +547,10 @@ func menuFontArg(theme *MenuTheme) string {
|
||||||
// Try FontPath first (specific font file)
|
// Try FontPath first (specific font file)
|
||||||
if theme != nil && theme.FontPath != "" {
|
if theme != nil && theme.FontPath != "" {
|
||||||
if _, err := os.Stat(theme.FontPath); err == nil {
|
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
|
// FontPath doesn't exist or is empty - use system-wide fonts
|
||||||
|
|
@ -562,11 +565,11 @@ func menuFontArg(theme *MenuTheme) string {
|
||||||
"FreeSans": true,
|
"FreeSans": true,
|
||||||
}
|
}
|
||||||
if safeFonts[theme.FontName] {
|
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
|
// Fallback to most universally available monospace font on Linux
|
||||||
return "font='monospace'"
|
return "font=monospace"
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolveMenuLogoPath(logo menuLogoOptions) string {
|
func resolveMenuLogoPath(logo menuLogoOptions) string {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user