Workflow
-
Confirm prerequisites. The user needs
genmedia(fal.ai CLI, configured with API key),ffmpeg(Homebrewffmpegwithhevc_videotoolbox— bundled on macOS), and a still image they want to animate. Check withgenmedia setup --statusandwhich ffmpeg. -
Pick the inputs. Ask the user (or infer from context) for:
- still image — local path or URL. Subject on transparent or solid background, ideally already isolated. If it's a complex scene with subject + environment, the loop will animate the whole frame.
- motion prompt — what subtle ambient motion to apply. Keep it small: "characters breathe gently, hand waves slowly, leaves rustle." Big camera motion or scene changes break the closed-loop seam.
- closed loop or open? — recommend closed for ambient UI loops; open is fine if the clip plays once or you don't mind a tiny seam.
- output path — where to save the final
.mov.
-
Run the orchestrator.
scripts/transparent-loop.shhandles the full pipeline. Recommended invocation for a closed UI loop:
```bash
scripts/transparent-loop.sh \
--image ./hero.png \
--prompt "Subtle ambient idle motion that returns to the starting pose. Static camera." \
--output ./hero_loop.mov \
--duration 5 \
--closed-loop
```
The script uploads the still to fal if it's a local path, runs SeedDance 2 fast image-to-video with end_image_url = image_url (closed-loop mode), splits frames with ffmpeg, processes each frame through BiRefNet v2 Matting in parallel (10 workers by default), then encodes HEVC alpha at 720×720 24fps.
-
Inspect the output before shipping. Open the
.movin QuickTime to verify: the loop is seamless, the alpha is clean (no halo, no missing characters), the file size is reasonable (1-3 MB for a 5s 720² clip). If a character disappeared, see the BiRefNet failure mode inreferences/troubleshooting.md— usually means the still had thin/translucent details the matting model can't recover. -
Wire into the target app. iOS uses
AVPlayerdirectly; the.movplays with alpha out of the box ifplayerLayer.pixelBufferAttributesis set tokCVPixelFormatType_32BGRA. Web uses<video>with the same.mov. Seereferences/playback.mdfor the per-platform integration snippet.
Reference
Read these in order when implementing or debugging:
references/pipeline.md— every command, every flag, what each step does, cost breakdown.references/troubleshooting.md— failure modes I hit and how to recognize them (hypervideo chroma-key trap, ProRes oversize trap, seam withoutend_image_url, halo withoutrefine_foreground).references/playback.md— minimal iOS / web / Android playback integration with alpha preserved.
Scope
This skill is for short transparent animation loops, typically 3–10 seconds. For longer videos, the per-frame BiRefNet cost scales linearly (~$0.005/frame, ~$0.60 for a 2-min clip at 24fps) and the resulting .mov grows quickly. For real-time effects, transparent live video, or scenes with complex semi-transparency (glass, smoke, hair on cluttered backgrounds), a dedicated VFX matting tool is better than this open-source pipeline.