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).
Fixed FFmpeg filter parsing error by removing unnecessary single quotes
from the scale expression in resolveMenuLogoScaleExpr.
The Bug:
FFmpeg command was failing with "Error parsing filterchain" because
the scale expression had quotes around the min() functions:
scale=w='min(iw*0.50,180)':h='min(ih*0.50,120)'
^^^^^^^^^^^^ ^^^^^^^^^^^^
FFmpeg's filter parser doesn't expect quotes here and treats them as
part of the option value, breaking the parsing.
The Fix:
Before: scale=w='min(iw*%.2f,%.0f)':h='min(ih*%.2f,%.0f)'
After: scale=w=min(iw*%.2f,%.0f):h=min(ih*%.2f,%.0f)
Error was:
[AVFilterGraph] No option name near ' I Fucked My Best…'
[AVFilterGraph] Error parsing filterchain around: ,180)':h='min...
exit status 234
Now the scale expression is parsed correctly and menu generation
should complete successfully.
Fixed menu generation logging by threading logFn parameter through all
menu building functions. Previously, all menu FFmpeg commands were
called with logFn=nil, so errors were never logged.
Functions updated to accept and pass logFn:
- buildMenuBackground
- buildDarkMenuBackground
- buildPosterMenuBackground
- buildMenuOverlays
- buildMenuOverlay (helper)
- buildMenuMPEG
All three menu templates now properly log:
- SimpleMenu.Generate() → buildMenuBackground → runCommandWithLogger
- DarkMenu.Generate() → buildDarkMenuBackground → runCommandWithLogger
- PosterMenu.Generate() → buildPosterMenuBackground → runCommandWithLogger
Before:
- Menu FFmpeg commands run silently (logFn=nil)
- Errors not logged → "ERROR: FFmpeg failed during DVD encoding"
- No way to diagnose what failed
After:
- >> /usr/bin/ffmpeg [full command with args]
- ERROR starting command: [error details]
- ERROR command failed: [error] (exit code: X)
Combined with the previous commit's enhanced runCommandWithLogger,
we now have complete visibility into menu generation 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.
- Fix unterminated string in author_menu.go line 418
- Fix invalid escape sequences in escapeDrawtextText function
- Remove orphaned code outside function body in main.go
- Fix extra parentheses causing syntax errors
- Ensure clean compilation for successful build
- Refactor author_menu.go to support multiple menu templates
- Add Simple, Dark, and Poster menu templates
- Add UI for selecting menu template and background image