atonamy/images-to-webm-p

Convert a stack of image frames into sticker-ready VP9 WebM or animated WebP files. Built for Telegram/WhatsApp sticker pipelines with adjustable quality, frame rate, and output size.

Public
27 runs

Animated Sticker Pipeline (images-to-webm-p)

Turn sequential frame images into compact WebM or animated WebP loops. This model was built to streamline sticker creation workflows for chat platforms such as Telegram (WebM/VP9) and WhatsApp (animated WebP). If your own project needs quick image-to-video batching, you can use it the same way.

How It Works

Upload a stack of images and pick your output container. The predictor stitches the frames, enforces consistent sizing, and runs ffmpeg with tuned defaults to produce a sticker-ready animation. Alpha channels in PNG input frames are preserved in both formats.

Inputs

Name Type Default Range Description
manifest file (JSON) none none Optional manifest that lists frame paths. Use instead of images if you prefer a single upload.
images file[] none none Frames uploaded directly. Provide multiple images=@frame.png flags.
output_format string webm webm | webp Container/codec for the animation.
quality float 70 0-100 Higher values give better quality and larger files.
frame_rate int 16 1-30 Playback speed in frames per second.
size string 512x512 8x8-4096x4096 Target resolution. Frames are resized to this width x height.

Outputs

Returns a single animation file (.webm or .webp) ready for upload to sticker platforms or further processing.

Example Usage

CLI (Cog)

Assuming you have sequential PNG frames under frames/:

[
  "frames/out001.png",
  "frames/out002.png",
  "frames/out003.png"
]

Save this as frames.json, then run:

cog predict \
  -i manifest=@frames.json \
  -i output_format=webm \
  -i frame_rate=18 \
  -i quality=60 \
  -i size=512x512

Need animated WebP for WhatsApp at a different size and quality? Swap the parameters:

cog predict \
  -i manifest=@frames.json \
  -i output_format=webp \
  -i frame_rate=24 \
  -i quality=80 \
  -i size=512x512

HTTP API (Replicate)

curl -s -X POST https://api.replicate.com/v1/predictions \
  -H "Authorization: Token $REPLICATE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "version": "<latest-version-id>",
    "input": {
      "manifest": "data:application/json;base64,${BASE64_OF_FRAMES_JSON}",
      "output_format": "webp",
      "quality": 70,
      "frame_rate": 20,
      "size": "512x512"
    }
  }'

Download the result URL from the prediction output once it completes.

Tips for Stickers

  • Telegram expects transparent VP9 WebM: stick with output_format=webm, keep the resolution <= 512x512, and consider frame_rate=30 to stay smooth.
  • WhatsApp prefers animated WebP: use output_format=webp, keep size <= 512x512, and dial quality down (for example, 60) if the exported file is too large.
  • If your source frames are not square, resize first—this model enforces a single width x height.
  • Keep sequences short (Telegram and WhatsApp limit duration and file size); reduce frame_rate or crop the frame set to tighten loops.

Extensibility

Beyond stickers, you can reuse this pipeline for GIF replacements on the web, quick previews of animation frames, or any workflow that needs a deterministic image-to-video batch step. Adjust the defaults and parameters as needed for your format requirements.


Made with Cog and ffmpeg to bring repeatable sticker conversion to your pipeline.