Repository navigation
Add video2gif extension - #26652
Add video2gif extension#26652stefan-imbesi wants to merge 4 commits into
Conversation
- Add Image Assets to gitignore - Add CHANGELOG and resize assets for Raycast store - Add README and screenshots - Initial commit: Video to GIF Raycast extension
|
Congratulations on your new Raycast extension! 🚀 We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days. Once the PR is approved and merged, the extension will be available on our Store. |
Form.Dropdown onChange passes string, but state setter expects 'loop' | 'none'. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Greptile SummaryThis PR adds a new
Confidence Score: 3/5
Important Files Changed
Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/video2gif/src/lib/ffmpeg.ts
Line: 51-83
Comment:
**`quality` setting is silently ignored during conversion**
`settings.quality` is accepted in `ConversionSettings`, exposed as a preference and a form field, and used in `estimateGifSize` — but it is never read inside `buildFilterChain`. Every conversion runs at the same color depth regardless of what the user selects, so the Quality preference has no effect at all.
FFmpeg's `palettegen` supports a `max_colors` argument (1–256, default 256) that maps naturally to a quality scale. For example:
```typescript
if (isForPalette) {
const maxColors = Math.round(2 + (settings.quality / 100) * 254); // 2–256
filters.push(`palettegen=stats_mode=diff:max_colors=${maxColors}`);
}
```
Without this (or an equivalent mapping), the quality knob is misleading and the size estimates are computed against a quality that is never actually applied.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: extensions/video2gif/package.json
Line: 117-120
Comment:
**`@raycast/utils` listed as a dependency but never imported**
`@raycast/utils` appears in `dependencies` but is not imported anywhere under `src/`. This bloats the bundle unnecessarily.
Either remove it from `package.json`, or replace manual `LocalStorage` usage in `history.ts` with `@raycast/utils` helpers (e.g. `useCachedState`) and add the missing import.
```suggestion
"dependencies": {
"@raycast/api": "^1.93.3",
"execa": "^8.0.1"
},
```
**Rule Used:** What: Every dependency listed in package.json must... ([source](https://app.greptile.com/review/custom-context?memory=bffc60eb-f9f2-4219-b804-76e29e267d43))
How can I resolve this? If you propose a fix, please make it concise.Reviews (2): Last reviewed commit: "Fix Prettier formatting for loopMode dro..." | Re-trigger Greptile |
| const ffmpeg = getFfmpegPath(); | ||
| const thumbPath = path.join(outputDir, `thumb_${Date.now()}.png`); | ||
|
|
||
| await execa(ffmpeg, ["-i", "--", filePath, "-vf", "thumbnail", "-frames:v", "1", "-y", thumbPath]); |
There was a problem hiding this comment.
Incorrect ffmpeg argument order in
extractThumbnail
The "-i", "--", filePath sequence passes "--" as the input filename to ffmpeg (since -i takes the immediately following argument). The actual filePath is then treated as an unrecognised positional argument, causing the command to always fail.
The -- end-of-options separator is also not meaningful here since execa doesn't invoke a shell — arguments are passed directly to the subprocess.
Although this function isn't currently called by any command, it is exported and the bug would surface immediately upon first use.
| await execa(ffmpeg, ["-i", "--", filePath, "-vf", "thumbnail", "-frames:v", "1", "-y", thumbPath]); | |
| await execa(ffmpeg, ["-y", "-i", filePath, "-vf", "thumbnail", "-frames:v", "1", thumbPath]); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/video2gif/src/lib/video-utils.ts
Line: 60
Comment:
**Incorrect ffmpeg argument order in `extractThumbnail`**
The `"-i", "--", filePath` sequence passes `"--"` as the input filename to ffmpeg (since `-i` takes the immediately following argument). The actual `filePath` is then treated as an unrecognised positional argument, causing the command to always fail.
The `--` end-of-options separator is also not meaningful here since `execa` doesn't invoke a shell — arguments are passed directly to the subprocess.
Although this function isn't currently called by any command, it is exported and the bug would surface immediately upon first use.
```suggestion
await execa(ffmpeg, ["-y", "-i", filePath, "-vf", "thumbnail", "-frames:v", "1", thumbPath]);
```
How can I resolve this? If you propose a fix, please make it concise.| export interface Preferences { | ||
| outputFolder: string; | ||
| defaultQuality: string; | ||
| defaultMaxWidth: string; | ||
| defaultFps: string; | ||
| defaultLoopMode: "loop" | "none"; | ||
| longVideoThreshold: string; | ||
| } |
There was a problem hiding this comment.
Manually-defined
Preferences interface should be removed
The Preferences interface is auto-generated in raycast-env.d.ts from the preferences array in package.json when the extension is built. Keeping a hand-written copy can silently drift out of sync — for example if a preference is renamed or its type changes — causing type mismatches at runtime.
Remove the manual Preferences interface from types.ts and use the auto-generated one everywhere:
// convert-to-gif.tsx / convert-to-gif-custom.tsx
import { getPreferenceValues } from "@raycast/api";
const prefs = getPreferenceValues<Preferences>(); // Preferences is globally available via raycast-env.d.tsThe same rule applies to the Preferences import in both command files.
Rule Used: What: Don't manually define Preferences for `get... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/video2gif/src/types.ts
Line: 35-42
Comment:
**Manually-defined `Preferences` interface should be removed**
The `Preferences` interface is auto-generated in `raycast-env.d.ts` from the `preferences` array in `package.json` when the extension is built. Keeping a hand-written copy can silently drift out of sync — for example if a preference is renamed or its type changes — causing type mismatches at runtime.
Remove the manual `Preferences` interface from `types.ts` and use the auto-generated one everywhere:
```typescript
// convert-to-gif.tsx / convert-to-gif-custom.tsx
import { getPreferenceValues } from "@raycast/api";
const prefs = getPreferenceValues<Preferences>(); // Preferences is globally available via raycast-env.d.ts
```
The same rule applies to the `Preferences` import in both command files.
**Rule Used:** What: Don't manually define `Preferences` for `get... ([source](https://app.greptile.com/review/custom-context?memory=d93fc9fb-a45d-4479-a6a4-b1b4af98ebc8))
How can I resolve this? If you propose a fix, please make it concise.| @@ -0,0 +1,14 @@ | |||
| # Video2Gif Changelog | |||
|
|
|||
| ## [1.0.0] - 2026-03-26 | |||
There was a problem hiding this comment.
Changelog must use
{PR_MERGE_DATE} placeholder
The date 2026-03-26 is hardcoded. Raycast's release pipeline populates the merge date automatically when the PR is merged; the placeholder must be left as-is. The heading convention for an initial release entry is also [Initial Release]:
| ## [1.0.0] - 2026-03-26 | |
| ## [Initial Release] - {PR_MERGE_DATE} |
Rule Used: What: Changelog entries must use {PR_MERGE_DATE}... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/video2gif/CHANGELOG.md
Line: 3
Comment:
**Changelog must use `{PR_MERGE_DATE}` placeholder**
The date `2026-03-26` is hardcoded. Raycast's release pipeline populates the merge date automatically when the PR is merged; the placeholder must be left as-is. The heading convention for an initial release entry is also `[Initial Release]`:
```suggestion
## [Initial Release] - {PR_MERGE_DATE}
```
**Rule Used:** What: Changelog entries must use `{PR_MERGE_DATE}`... ([source](https://app.greptile.com/review/custom-context?memory=c2214c11-df56-490a-b1c0-09a385df481a))
How can I resolve this? If you propose a fix, please make it concise.| - Estimated file size preview before conversion | ||
| - Automatic video file detection from Finder selection or clipboard | ||
| - Conversion history stored locally | ||
| - Configurable output folder, default quality, and long video threshold via preferences |
There was a problem hiding this comment.
CHANGELOG lists formats not present in
SUPPORTED_EXTENSIONS
The changelog entry claims support for FLV, WMV, M4V, 3GP, and MPEG, but SUPPORTED_EXTENSIONS in types.ts only includes .mp4 .mov .avi .mkv .webm .m4v. Files with .flv, .wmv, .3gp, or .mpeg extensions will be rejected by isSupportedVideo() even though the changelog advertises them. Either add the extensions to SUPPORTED_EXTENSIONS or correct the changelog entry to reflect the actual supported set.
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/video2gif/CHANGELOG.md
Line: 13
Comment:
**CHANGELOG lists formats not present in `SUPPORTED_EXTENSIONS`**
The changelog entry claims support for FLV, WMV, M4V, 3GP, and MPEG, but `SUPPORTED_EXTENSIONS` in `types.ts` only includes `.mp4 .mov .avi .mkv .webm .m4v`. Files with `.flv`, `.wmv`, `.3gp`, or `.mpeg` extensions will be rejected by `isSupportedVideo()` even though the changelog advertises them. Either add the extensions to `SUPPORTED_EXTENSIONS` or correct the changelog entry to reflect the actual supported set.
How can I resolve this? If you propose a fix, please make it concise.|
This pull request has been automatically marked as stale because it did not have any recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean 😊 |
|
All review feedback from Greptile has been addressed in the latest commits (changelog placeholder, Preferences interface removal, extractThumbnail fix, and format list correction). Ready for review! |
| function buildFilterChain(settings: ConversionSettings, isForPalette: boolean): string { | ||
| const filters: string[] = []; | ||
|
|
||
| if (settings.speed <= 0 || !Number.isFinite(settings.speed)) { | ||
| throw new Error(`Invalid speed value: ${settings.speed}`); | ||
| } | ||
| if (settings.fps <= 0 || !Number.isFinite(settings.fps) || settings.fps > 120) { | ||
| throw new Error(`Invalid FPS value: ${settings.fps}`); | ||
| } | ||
|
|
||
| // Speed adjustment | ||
| if (settings.speed !== 1) { | ||
| filters.push(`setpts=${(1 / settings.speed).toFixed(4)}*PTS`); | ||
| } | ||
|
|
||
| // FPS | ||
| filters.push(`fps=${settings.fps}`); | ||
|
|
||
| // Scale — validate maxWidth is a safe integer before interpolation | ||
| if (settings.maxWidth !== "original") { | ||
| const width = parseInt(settings.maxWidth, 10); | ||
| if (isNaN(width) || width <= 0 || width > 7680) { | ||
| throw new Error(`Invalid max width: ${settings.maxWidth}`); | ||
| } | ||
| filters.push(`scale=${width}:-2:flags=lanczos`); | ||
| } | ||
|
|
||
| if (isForPalette) { | ||
| filters.push("palettegen=stats_mode=diff"); | ||
| } | ||
|
|
||
| return filters.join(","); | ||
| } |
There was a problem hiding this comment.
quality setting is silently ignored during conversion
settings.quality is accepted in ConversionSettings, exposed as a preference and a form field, and used in estimateGifSize — but it is never read inside buildFilterChain. Every conversion runs at the same color depth regardless of what the user selects, so the Quality preference has no effect at all.
FFmpeg's palettegen supports a max_colors argument (1–256, default 256) that maps naturally to a quality scale. For example:
if (isForPalette) {
const maxColors = Math.round(2 + (settings.quality / 100) * 254); // 2–256
filters.push(`palettegen=stats_mode=diff:max_colors=${maxColors}`);
}Without this (or an equivalent mapping), the quality knob is misleading and the size estimates are computed against a quality that is never actually applied.
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/video2gif/src/lib/ffmpeg.ts
Line: 51-83
Comment:
**`quality` setting is silently ignored during conversion**
`settings.quality` is accepted in `ConversionSettings`, exposed as a preference and a form field, and used in `estimateGifSize` — but it is never read inside `buildFilterChain`. Every conversion runs at the same color depth regardless of what the user selects, so the Quality preference has no effect at all.
FFmpeg's `palettegen` supports a `max_colors` argument (1–256, default 256) that maps naturally to a quality scale. For example:
```typescript
if (isForPalette) {
const maxColors = Math.round(2 + (settings.quality / 100) * 254); // 2–256
filters.push(`palettegen=stats_mode=diff:max_colors=${maxColors}`);
}
```
Without this (or an equivalent mapping), the quality knob is misleading and the size estimates are computed against a quality that is never actually applied.
How can I resolve this? If you propose a fix, please make it concise.
0xdhrv
left a comment
There was a problem hiding this comment.
Thanks for your contribution {cursor} 🔥
We already have an extension in the Store that deals with this. Could we consider enhancing the existing extension below instead of creating another one?
- https://www.raycast.com/pablopunk/yafw by @pablopunk
If there are unique features or workflows you’re aiming to add, we’d love to hear them and see if they can be integrated into this to avoid duplication and improve discoverability.
This would help avoid duplication and keep related functionality consolidated in one place.
As mentioned in our extension guidelines here ↗
|
Thank you so much for the review and for pointing out yafw. I understand the preference for consolidating functionality into existing extensions rather than creating new ones. Before replying I did some research into yafw's codebase to understand where its GIF support stands today, and I wanted to share what I found:
I'd be happy to open a PR against yafw that fixes the palette bug and brings across the GIF-specific features from Video2Gif — quality control, configurable FPS, speed adjustment, loop mode, size estimation, and progress tracking. It's a decent chunk of work, but it would keep things consolidated in one place which I know is the preference. Would that be the right approach? And if so, would it be worth reaching out to @pablopunk first to make sure they're open to the scope of changes? |
Map settings.quality (1-100) to palettegen's max_colors parameter (2-256) so the quality preference actually affects GIF output color depth. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
This pull request has been automatically marked as stale because it did not have any recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean 😊 |
|
@0xdhrv bump 😄 |
|
This pull request has been automatically marked as stale because it did not have any recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean 😊 |
|
@0xdhrv bump 😄 |
|
This pull request has been automatically marked as stale because it did not have any recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean 😊 |
|
This pull request has been automatically closed due to inactivity. Feel free to comment in the thread when you're ready to continue working on it 🙂 You can also catch us in Slack if you want to discuss this. |
Yeah, it's alright to open a PR against yafw, since this seems like a good addition. I will prioritize its review and follow-up |
Apologies for late reply |
|
Closing in favor of #28532. Per the discussion above and @0xdhrv's go-ahead, I've consolidated the GIF functionality into the existing yafw extension rather than shipping a separate one. #28532 fixes yafw's two-pass palette bug (the generated palette was never applied) and adds configurable GIF quality, frame rate, speed, and loop. Thanks again for the review and for pointing me to yafw! cc @pablopunk @0xdhrv |
Description
Screencast
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare placed outside of themetadatafolder