Communitygithub.com

FilippTrigub/abra

通过文本提示编辑视频中的指定区域(背景或矩形区域),基于 Wan2.1-VACE 修复模型。支持两种模式:背景(通过 rembg 自动分割)或区域(通过分数定义矩形)。需要至少 8 GB 空闲显存的 CUDA GPU。

abra 是什么?

cutlab(即 abra 技能)使开发者能够通过简单的文本提示对整个视频中指定区域进行智能修复编辑。它基于 Wan2.1-VACE-1.3B 扩散模型,支持两种核心遮罩模式:`background` 模式利用 rembg 自动分割并替换人物背景;`region` 模式则允许用户指定矩形区域(例如天空、屏幕)进行精准修改。该技能适用于改变视频环境、替换发言人背景或编辑局部画面,同时保持视频其余部分和音频不变。它要求 CUDA GPU 配备至少 8 GB 空闲显存,并已针对 Cursor、Claude Code 等 AI 代理工具设计,提供了清晰的配置流程、参数调节(如强度、推理步数)以及完善的错误处理(含显存不足提醒)。适合视频内容创作、演示录制或自动化视频后期处理等场景。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/FilippTrigub/abra/tree/HEAD/skills/video-editor

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

cutlab — AI 视频区域编辑

使用 Wan2.1-VACE-1.3B 扩散模型编辑视频每一帧的遮罩区域。通过文本提示描述期望的结果;模型将修复遮罩区域,同时保持其余部分不变。音频得以保留。

技能目录(该 SKILL.md 所在位置)在下文中称为 $SKILL_DIR。

需要 GPU。 需要 CUDA GPU,且空闲显存不低于 8 GB。 运行前请暂停 LLM 上下文以释放显存。


何时使用

当用户希望执行以下操作时使用此技能:

  • 替换讲话者视频的背景为不同场景
  • 编辑视频的矩形区域(天空、标志、屏幕等)
  • 改变环境细节同时保留主体

环境设置(仅在首次运行时)

cd "$SKILL_DIR" && uv sync

Wan2.1-VACE-1.3B 模型权重将在首次运行时从 HuggingFace 下载(约 3 GB)。rembg 模型权重也会在首次使用背景模式时下载。


代理工作流程

1. 询问用户

在编辑视频之前,我需要了解以下信息:

💬 提示词(必填)
   描述编辑后的区域应呈现的效果,例如:
   "现代办公室,落地窗,可看到城市景观"

🎭 遮罩模式
  - background  — 自动检测并替换背景  [默认]
  - region      — 编辑一个矩形区域(x1,y1,x2,y2 为 0.0–1.0 之间的分数)

📐 如果 mode=region:mask_region
   格式:"x1,y1,x2,y2" 例如 "0.0,0.0,1.0,0.3" 表示帧的上 30%

⚙️ 强度(0.0–1.0,默认 0.85)
   编辑的应用强度。值越低越忠实于原图。

📁 输入/输出目录(默认:./input 和 ./output)

等待用户回复后再继续。

2. 编辑 config.json

根据用户的选择写入或更新 $SKILL_DIR/config.json。

3. 运行

cd "$SKILL_DIR" && uv run python scripts/vace.py --config config.json

4. 报告结果

告知用户输出文件路径、使用的遮罩模式以及应用的提示词。


配置参考

键值默认值描述
input_dir路径./input包含输入视频的文件夹
output_dir路径./output输出文件夹
prompt字符串(必填)期望编辑区域的描述
negative_prompt字符串"worst quality, blurry, distorted"要避免的内容
maskbackground, regionbackground遮罩策略
mask_region"x1,y1,x2,y2"(如果为 region 则必填)以分数表示的矩形
strength浮点数 (0, 1]0.85修复强度
num_inference_steps整数30扩散步数
guidance_scale浮点数5.0提示词遵循程度
batch_size整数8每次推理批次处理的帧数(降低可减少显存占用)
max_proc_dim整数384修复前的最大帧尺寸(降低可减少显存占用)
modelHuggingFace IDWan-AI/Wan2.1-VACE-1.3B-diffusers使用的模型

常见用法

# 自动替换背景
cd "$SKILL_DIR" && uv run python scripts/vace.py \
  --prompt "日落时分的宁静山湖"

# 编辑矩形区域(帧的上三分之一 = 替换天空)
cd "$SKILL_DIR" && uv run python scripts/vace.py \
  --mask region --mask-region "0.0,0.0,1.0,0.33" \
  --prompt "晴朗蓝天,点缀着几朵云"

# 更轻量的编辑(保留更多原始细节)
cd "$SKILL_DIR" && uv run python scripts/vace.py \
  --prompt "舒适的家庭办公室" --strength 0.6

# 自定义目录
cd "$SKILL_DIR" && uv run python scripts/vace.py \
  --input /path/to/videos --output /path/to/edited \
  --prompt "未来都市景观"

输出

每个输入视频在 output_dir 中生成一个同名的 .mp4 文件。原始音频会重新合成进去。


错误处理

  • 显存不足 → 打印所需 vs 可用 GB,提供释放显存的建议,退出
  • 无 CUDA GPU → 清晰错误信息,退出
  • input_dir 中无视频 → 清晰提示,退出
  • mask_region 格式无效 → 显示预期格式的清晰错误,退出
  • 单个视频错误 → 记录日志;其他视频继续处理

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

FilippTrigub/abra

>- Animate a still image into a short video clip using fal.ai's LTX-2.3 Fast image-to-video model in the cloud. No GPU required - runs entirely on fal.ai serverless infrastructure.

FilippTrigub/abra

>- Auto-describe and caption images using a local vision-language model. Writes a JSON sidecar per image containing a one-sentence description, a suggested Instagram caption with hashtags, and detected content tags.

FilippTrigub/abra

>- Animated caption pipeline. Use this skill when the user wants to burn word-by-word animated captions into videos — using Whisper for transcription and pycaps for rendering. Supports default minimalist style or a futuristic CSS theme with alternating gold/magenta glowing words.

FilippTrigub/abra

>- Cut videos into segments, rearrange them, and produce an output video with a specific cuts-per-second rate. Uses MoviePy for video manipulation. Prioritizes audio transcription for timestamped cutting, falls back to adaptive scene detection.

FilippTrigub/abra

>- Video enhancement pipeline. Use this skill when the user wants to sharpen, colour grade, warm, or normalise the audio of videos — including presets for natural, cinematic, or vivid looks.

FilippTrigub/abra

Generate videos from text or images using Higgsfield's multi-model cloud platform. Supports kling, seedance, dop, and dop-preview models. Uses a small preset layer for common creative styles. Auto-detects text-to-video or image-to-video based on input. No GPU required.

FilippTrigub/abra

>- Remove the background from every frame of a video using AI (BiRefNet-general via rembg). Outputs transparent-background video or composites onto a solid colour or image. Requires a CUDA GPU with at least 3 GB free VRAM.

相关技能