Overview
Many pages on this site open with a short looping video. I generate those loops myself with ComfyUI running on Praxis, my homelab, prompted from the content of the page they sit on. The goal was a header that loops without a visible jump, and a record that lets me trace any clip back to the prompt and models that produced it.
Context
Before this, headers were stock footage or the same few photos reused across many pages. Stock loops did not describe the page, and the reused photos made different pages look the same. I already had GPUs in the homelab for local model work, so the question was whether I could produce page-specific loops at the quality the site needs, and do it in a way I could repeat and audit later.
The second requirement came from a mistake. A scratch folder holding several batches’ prompts, approved seeds and finished clips was emptied in the middle of a run. I rebuilt the work from each ComfyUI instance’s job history, but that history is a cache, not an archive. After that, every batch had to leave a durable record of its own.
The System
If terms like model server, workflow or GPU instance are new to you, How my AI stack fits together explains how the parts relate.
The pipeline has two generation steps and one finishing step:
- Still image. Z-Image Turbo renders a still from a prompt written from the page’s content.
- Video. Wan 2.2 generates a first/last-frame video with the same still at both ends, so the clip starts and ends on the same image.
- Seam. A finishing step crossfades the final frames into frame 0, encodes the clip without audio, and writes a matching poster image. The crossfade is what makes the wrap-around invisible; without it there is a small but noticeable jump when the loop restarts.
Before any GPU time goes to video, there is a stills-only review pass. I look at a contact sheet of the candidate stills cropped to the header shape and approve or reject them. Video generation is the expensive step, so rejecting a weak composition at the still stage is the cheapest place to do it.
Batches are declarative. Each run has a spec that lists its purpose, base workflow, fixed settings and the prompts and seeds to vary. One runner turns the spec into jobs and writes a provenance record at submit time: repository commit, workflow file hashes, the model files each graph loads, per-job settings, seed and output paths. A review log per run records which outputs were approved, rejected or reworked, and where an approved clip is used.
On the site side, every placement is recorded in data/generated-media.yaml: the page, the run the clip came from, and the header it replaced. Finished clips are backed up to Google Drive and uploaded to S3 with the rest of the site’s media. The colophon discloses that these headers are generated and that they illustrate a page’s subject rather than document a real event.
ComfyUI runs as one instance per GPU, each pinned to the VM that holds that card, so I can send a job to a specific GPU based on what is already loaded there. Models and outputs live on Ceph storage shared by all instances. Along the way I also tried other model families, including FLUX, LTX and HunyuanVideo.
Components and Why I Chose Them
| Component | What it does here | Why I chose it |
|---|---|---|
| ComfyUI (tool page) | Runs the still and video workflows, one instance per GPU | Workflows are node graphs saved as files, so they can be versioned in a repository and submitted as jobs through an API. It is now the only image and video path in the homelab: I retired a separate Stable Diffusion WebUI Forge stack because it duplicated what ComfyUI does, competed with it for the same GPU, and needed exceptions to my storage and placement rules. |
| Z-Image Turbo | Renders the still that starts and ends each loop | Fast enough to generate many candidate stills for review, and it follows long, detailed prompts well. |
| Wan 2.2 | Generates the video between a first and last frame | It supports first/last-frame generation, so I can give it the same image at both ends, and ComfyUI supports it natively. |
| Ceph (tool page) | Holds the shared model files and the run outputs for every instance | One copy of each model serves every GPU, and outputs survive when a container is recreated. The Docker VMs mount it with the native CephFS kernel client. That replaced a virtiofs passthrough from the host, which broke the file locking that databases on the same storage need. |
| Docker Compose and Portainer (Compose, Portainer) | Define and deploy the ComfyUI services | The service definitions live in the repository, and Portainer redeploys them from it, so a change to the stack is a reviewed commit. |
| Python (tool page) | The batch runner, provenance records and loop finishing step | One runner turns a declarative spec into jobs and writes the record; the same code covers prompt lists and settings sweeps. |
| Amazon S3 (tool page) | Serves the finished clips with the rest of the site’s media | Media is kept out of Git and served from the same buckets as the site. |
Outcomes
The site now has page-specific headers instead of reused stock and photos, and each one can be traced from the page to the run, the prompt and the models. Proposals I reviewed and declined are recorded too, so later passes do not propose them again. The process is written down in the site’s media runbook, so adding a loop to a new page follows the same steps every time.
Example Configuration
This is a simplified batch spec with placeholder values. It shows the fields a spec records; the runner multiplies the prompts and seeds into jobs and writes the provenance record when it submits them.
{
"run": "example-header-loops",
"purpose": "Header loops for a set of site pages",
"base_workflow": "workflows/loop-first-last-frame.json",
"models": {
"still": "example-image-model",
"video": "example-video-model",
"loras": ["example-speed-lora"]
},
"fixed": {
"width": 1024,
"height": 576,
"audio": false
},
"stages": ["still-review", "video", "finish"],
"variations": {
"prompts": [
{ "name": "example-page-loop-v1", "text": "Prompt written from the page's content" }
],
"seeds": [12345, 67890]
},
"outputs": {
"folder": "runs/example-header-loops/",
"video": "{name}.mp4",
"poster": "{name}-poster.jpg"
}
}
Patterns Worth Reusing
Put the human review where it is cheapest. A still costs far less to generate than a video, and most rejections are about composition, which the still already shows.
Treat job history as a cache. If a generated asset will be published, write its provenance at submit time to storage you control, and keep the record next to the output.
Record placement where the site is built, not only where the media is made. The generation repository knows how a clip was made; the site repository has to know where it is used and what it replaced.