fix(ffmpeg): fix scale filter quote syntax for ico conversions
CO
7h ago+2+2+0123456789-2-2-0123456789
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 aftermininstead of before it ('min(256,ih)').- FFmpeg's filter expression parser treats
:minas 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_FILTERexpectation intests/converters/ffmpeg.test.ts.
Verification
- All unit test assertions in
tests/converters/ffmpeg.test.tspass 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.