Overview
Call meitu video-to-gif to convert an existing video into a GIF animation, covering 2 types:
- Regular GIF:
api_video_to_gif, proportional GIF, long side ≤480px, suitable for WeChat memes and social animations - Transparent-background GIF:
api_convert_video_to_gif, fixed 240×240px transparent background, suitable for transparent stickers and floating emoji
Size cannot be customized. Not handled: image to GIF, GIF to video, GIF editing, video concatenation, video dubbing, video style transfer.
API Mapping
| Scenario | Backend API |
|---|---|
| Regular GIF | api_video_to_gif |
| Transparent-background GIF | api_convert_video_to_gif |
Dependencies
- meitu-cli:
>=2.0.6 - Credentials:CONFIG AKSK →
meitu tools update; EXEC AKSK → run command - Environment variables:
MEITU_OPENAPI_TOOL_TASK_MODE=command
Path alias:
$VISUAL={OPENCLAW_HOME}/workspace/visual/
Core Workflow
Preflight → Execute → Deliver
Preflight
meitu --version≥ 2.0.6;meitu auth verify --json- Confirm Config Phase has been run;
MEITU_OPENAPI_TOOL_TASK_MODE=command - output_dir resolution: openclaw.yaml →
./output/| else →$VISUAL/output/video-to-gif/;mkdir -p {output_dir}
Execute
Trigger signals/routing
Matched signal words:
api_video_to_gif(regular): to GIF, make a meme, animation, GIF conversion (no transparency requirement)api_convert_video_to_gif(transparent background): transparent-background GIF, transparent sticker, floating emoji, transparent-background GIF
Decision order:
- Agent recognizes the video content from the frames and generates
prompt(e.g. "a person making expressions in front of a solid-color background", "a cat running outdoors") - Branch by transparency requirement:
- Transparent background needed (user explicitly requests it + solid color/green screen/simple background) →
api_convert_video_to_gif - No / general →
api_video_to_gif(default)
- Transparent background needed (user explicitly requests it + solid color/green screen/simple background) →
Cannot determine → prompt write "general video" and use the default api_video_to_gif。
Parameter definitions
| Parameter | Type | Required | Description |
|---|---|---|---|
video_url |
STRING | Yes | Video URL; if missing → "Please provide a video link" |
prompt |
STRING | Yes | Agent's description of the video content, used to determine the GIF type |
API parameter mapping
Both API paths pass through directly video_url:
api_video_to_gif→ outputs a proportional GIF, long side ≤480pxapi_convert_video_to_gif→ outputs a 240×240px transparent-background GIF
Tool invocation
Regular GIF:
meitu video-to-gif \
--skill_name skill_video-to-gif \
--video_url {video_url} \
--prompt "{content_description}" \
--json --download-dir {output_dir}
Transparent-background GIF:
meitu video-to-gif \
--skill_name skill_video-to-gif \
--video_url {video_url} \
--prompt "{content_description}" \
--transparent true \
--json --download-dir {output_dir}
Error fallback
| Scenario | Handling |
|---|---|
video_url missing |
Prompt "Please provide a video link" |
video_url inaccessible |
Return an invalid error directly, do not retry |
| User wants a transparent background but the video has no alpha channel | Try calling the transparent API; if the result is poor, explain the limitation |
| User wants a GIF >480px | Inform that api_video_to_gif max is 480px |
| User wants a custom-size transparent background | Inform that api_convert_video_to_gif is fixed at 240×240px |
| Video duration is too long | Suggest trimming or lowering the quality and retrying |
api_convert_video_to_gif timeout |
Fall back to api_video_to_gif(give up transparency) and retry, informing that the transparent background is temporarily unavailable |
api_video_to_gif call failed |
Retry once; if it still fails, return an error |
| Content compliance interception | Return the compliance prompt directly without retrying |
| Image to GIF / GIF to video / GIF editing | Reject and state that it is outside the supported scope |
Deliver
Parse --json → downloaded_files[0].saved_path or media_urls[0]。
mv {file} {output_dir}/{YYYY-MM-DD}_{name}_{gif_type}.gif(gif_type = normal | transparent)
Output
- Format:GIF
- Normal: proportional, longest side ≤480px
- Transparent background: 240×240px transparent background
- Naming:
{YYYY-MM-DD}_{descriptive-name}_{normal|transparent}.gif - Location: Project →
./output/; one-time →$VISUAL/output/video-to-gif/
Baseline Task ID
t_mt1a3i5n7b1680836b-8e05-47d2-b6f0-3bd10eb0c5d3