Skip to content

fix: replace invalid FFmpeg fontweight param with bold=1 and fix fontfile set to name instead of path#1416

Open
abhinav-atul wants to merge 1 commit into
magic-peach:mainfrom
abhinav-atul:fix/drawtext-fontweight-fontfile-params
Open

fix: replace invalid FFmpeg fontweight param with bold=1 and fix fontfile set to name instead of path#1416
abhinav-atul wants to merge 1 commit into
magic-peach:mainfrom
abhinav-atul:fix/drawtext-fontweight-fontfile-params

Conversation

@abhinav-atul
Copy link
Copy Markdown
Contributor

Description

Fixes two bugs in buildTextFilter() in src/lib/text-overlay.ts that silently broke bold text rendering and custom font loading in all video exports.

Bug A — Invalid fontweight= parameter:
fontweight= is not a valid FFmpeg drawtext option. FFmpeg silently ignores unknown parameters, so bold text was never rendered bold in any export. Replaced :fontweight=${fontWeightParam} with :bold=1, appended only when fontWeightParam === "bold". Omitted entirely for normal weight.

Bug B — fontfile= set to font name instead of file path:
For any overlay with a fontFamily, the filter incorrectly appended fontfile='Arial' (a sanitized font name) instead of a filesystem path. FFmpeg expects a path here, not a name, causing it to silently fail. For custom fonts, getFFmpegFontArg then appended the real fontfile= path immediately after, producing a duplicate fontfile= key. Removed the block that set fontfile= to a sanitized name. System fonts now use font='FontFamily' (the correct FFmpeg option). Custom font paths via fontFileParam are appended only when present.

Before (broken):

drawtext=...:fontweight=bold:fontfile='Arial'

After (correct):

drawtext=...:bold=1:font='Arial'                  # system font, bold
drawtext=...:bold=1:fontfile=/tmp/MyFont.ttf       # custom font, bold
drawtext=...:font='Arial'                          # system font, normal weight

Related Issue

Closes #1414

Type of Contribution

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • GSSoC contribution

Participant Info

  • GitHub username: abhinav-atul
  • Contribution level (Beginner/Intermediate/Advanced): Intermediate

Screen Recording

This is a non-UI logic-only change in the FFmpeg filter string builder (src/lib/text-overlay.ts). No visual UI elements were added or modified. The fix corrects the generated FFmpeg command parameters which are only visible during video export processing.

Recording / Loom link: N/A (non-UI backend logic fix — no visual changes to record)

Checklist

  • I have read the contribution guidelines
  • My changes follow the project structure
  • I have tested my changes in Chrome, Firefox, and Safari
  • bun run lint passes (no ESLint errors)
  • bunx tsc --noEmit passes (no TypeScript errors)
  • New interactive elements have aria-label / accessible names
  • No console.log statements left in
  • This PR is related to a valid issue
  • Screen recording attached above (required for UI/feature/design changes)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

@abhinav-atul is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @abhinav-atul!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

🟠 GSSoC'26 PR detected — thanks for contributing under GirlScript Summer of Code 2026!

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

@github-actions
Copy link
Copy Markdown
Contributor

✅ PR Format Check Passed — @abhinav-atul

Basic format checks passed. A maintainer will review your code changes.

This does not mean the PR is approved — it just means the format is correct.

@github-actions github-actions Bot added level:beginner Beginner level - 20 pts type:bug Bug fix type:design UI/UX design type:docs Documentation type:feature New feature type:refactor Code refactor gssoc'26 GirlScript Summer of Code 2026 labels May 30, 2026
@abhinav-atul
Copy link
Copy Markdown
Contributor Author

@magic-peach Hi! The auto-label bot assigned level:beginner to this PR based on the diff size (17 lines), but I'd like to request a level:intermediate relabel. While the diff is small, this fix required:

  1. Understanding FFmpeg's drawtext filter API to identify that fontweight= is not a valid parameter and the correct replacement is bold=1
  2. Diagnosing a subtle bug where fontfile= was set to a font name instead of a filesystem path, causing silent failures
  3. Handling the distinction between system fonts (font=) vs custom uploaded fonts (fontfile=) to avoid duplicate keys in the filter string

The issue itself is also labeled as bug and type:bug, not good first issue. Could you consider relabeling this to level:intermediate? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc'26 GirlScript Summer of Code 2026 level:beginner Beginner level - 20 pts type:bug Bug fix type:design UI/UX design type:docs Documentation type:feature New feature type:refactor Code refactor

Projects

None yet

1 participant