Skip to content

fix(ffmpeg): fix scale filter quote syntax for ico conversions - #728

Open
codeCraft-Ritik wants to merge 1 commit into
C4illin:mainfrom
codeCraft-Ritik:fix/ffmpeg-ico-scale-filter
Open

codeCraft-Ritik wants to merge 1 commit into
C4illin:mainfrom
codeCraft-Ritik:fix/ffmpeg-ico-scale-filter

Conversation

@codeCraft-Ritik

@codeCraft-Ritik codeCraft-Ritik commented Nov 23, 2026 •

Copy link
Copy Markdown

Summary

Fixes a filter syntax error in src/converters/ffmpeg.ts where image-to-ICO conversions fail due to a misplaced single quote in the scale filter expression.


Problem & Root Cause

When converting an image to .ico, FFmpeg applies a video filter to scale down images that exceed 256×256 pixels:

extraArgs = [
  "-filter:v",
  "scale='min(256,iw)':min'(256,ih)':force_original_aspect_ratio=decrease",
];

In the height expression:

  • :min'(256,ih)': had the opening single quote placed after min instead of before it ('min(256,ih)').
  • FFmpeg's filter expression parser treats :min as an unrecognized filter option key and (256,ih) as an invalid token, throwing an [AVFilterGraph] Error initializing filter 'scale' runtime error.

Because tests/converters/ffmpeg.test.ts previously used a mock execFile that asserted against a string copy of the same typo, the unit tests passed without executing FFmpeg.


Solution

  • Corrected the quote placement in src/converters/ffmpeg.ts:
    scale='min(256,iw)':'min(256,ih)':force_original_aspect_ratio=decrease
  • Updated the matching ICO_FILTER expectation in tests/converters/ffmpeg.test.ts.

Verification

  • All unit test assertions in tests/converters/ffmpeg.test.ts pass cleanly.
  • Verified filter arguments are passed properly across formats.

Summary by cubic

Fixes ICO conversions that fail when FFmpeg parses the scale filter by correcting the quote placement around the height expression.

  • Updates the test expectation to match the corrected filter syntax.

Written for commit b1ab40c. Summary will update on new commits.

View guided diff

@github-actions github-actions Bot added the Fix label Nov 23, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

View guided diff | Re-trigger cubic

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant