Add meme reactions to your video app
If your users edit videos, they want memes in them: the shocked cat after the plot twist, the slow clap after the fail. The Green Screen Memes API is a meme API built for video: over 2,000 reaction meme clips (a shocked cat, a slow-clapping dog, a side-eyeing kid), each on a flat green, blue or red background, most with the meme's own sound, searchable by what happens in them. Not image templates: real clips that play over your own picture or video. This guide is the whole flow for an editor or clip tool: search, picker, live preview, final render.
How it fits together
- Your server holds the key and asks the API on your users' behalf. API calls don't send CORS headers, so a key can't leak from a front end by accident.
- The browser loads media straight from the API. Every result carries signed thumbnail and video links for your key; media responses do send CORS headers, so a canvas or WebGL can read the frames.
- The preview is keyed in the browser, over the user's own video or photo, while they place it.
- The export is rendered on your server with FFmpeg (or in your own WebCodecs pipeline), at full resolution, with the clip's sound.
1. A search route on your server
One fetch handler. It works as a Next.js route (export { GET }), in Hono and Workers, or in Express 5. The front end calls /api/memes?q=shocked and never sees the key.
// GET /api/memes?q=shocked: your server asks the API, your front end gets clips without ever seeing the key.
// A plain fetch handler: export it as GET in a Next.js route, or mount it in Hono, Workers or Express 5.
export async function GET(request) {
const q = new URL(request.url).searchParams.get('q') ?? '';
const upstream = new URL('https://api.greenscreenmemes.app/v1/memes');
upstream.search = new URLSearchParams({ q, limit: '24' }).toString();
const res = await fetch(upstream, { headers: { Authorization: `Bearer ${process.env.GSM_API_KEY}` } });
const body = await res.json();
if (!res.ok) return Response.json({ error: body.error?.message ?? 'Search failed' }, { status: res.status });
// Only what the picker needs. The media links are signed for your key and load straight from the API.
const clips = body.data.map(({ id, name, thumbnailUrl, videoUrl, chromaKeyColor, durationSeconds }) =>
({ id, name, thumbnailUrl, videoUrl, chromaKeyColor, durationSeconds }));
return Response.json({ clips, total: body.total }, { headers: { 'cache-control': 'private, max-age=300' } });
}Search works best with feelings and actions ("shocked", "slow clap", "crying", "happy dance"), not topics. For an empty search box, show GET /v1/trending: the clips people use most in the Green Screen Memes app right now, ranked.
2. The picker
Show the thumbnails in a grid and play the video only when someone picks a clip. A video link counts as one download the first time it's fetched; playing or seeking the same link again doesn't count again. Thumbnails never count. Links expire after about 6 hours. So a picker that autoplays on hover spends downloads on clips nobody chose; one that plays on tap spends them on real picks.
Look at the thumbnail before you trust a clip's framing: most are cut-outs that stand on the bottom edge, but a few are a framed video on green, or a head-and-shoulders shot.
3. A live keyed preview
A canvas over the user's video, with the clip's key color removed every frame. This runs in plain JavaScript; tested in Chrome on a 4K clip, scaled to 720 px wide, at 60 fps.
// Play a clip with its key color removed, on a canvas that sits over your own picture.
// Media links send CORS headers, so the canvas can read the frames.
export function playKeyed(canvas, clip) {
const video = Object.assign(document.createElement('video'), {
crossOrigin: 'anonymous', src: clip.videoUrl, loop: true, muted: true, playsInline: true,
});
const ctx = canvas.getContext('2d', { willReadFrequently: true });
const key = { red: 0, green: 1, blue: 2 }[clip.chromaKeyColor]; // undefined: show the clip as it is
const [a, b] = [0, 1, 2].filter(c => c !== key);
const draw = () => {
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
if (key !== undefined) {
const frame = ctx.getImageData(0, 0, canvas.width, canvas.height);
const d = frame.data;
for (let i = 0; i < d.length; i += 4) {
const spill = d[i + key] - Math.max(d[i + a], d[i + b]); // how much the key color dominates
d[i + 3] = 255 * Math.min(1, Math.max(0, (70 - spill) / 45)); // fully clear from 70 up
if (spill > 8) d[i + key] -= spill - 8; // take the green cast off the edges
}
ctx.putImageData(frame, 0, 0);
}
video.requestVideoFrameCallback(draw);
};
video.addEventListener('loadedmetadata', () => {
// A preview doesn't need 4K: keying fewer pixels keeps it smooth.
const scale = Math.min(1, 720 / video.videoWidth);
canvas.width = Math.round(video.videoWidth * scale);
canvas.height = Math.round(video.videoHeight * scale);
video.requestVideoFrameCallback(draw);
video.play();
});
return video; // unmute it on a tap to hear the clip's sound
}For full-resolution previews, move the same per-pixel math into a WebGL fragment shader. chromaKeyColor tells you which channel to key; a few clips have none and are meant to be shown as they are.
4. The final render
On your server, download the clip (keep the file, not the link) and key it over the user's video with FFmpeg. This keeps both soundtracks, the clip's on top:
ffmpeg -stream_loop -1 -i background.mp4 -i greenscreen.mp4 -filter_complex \
"[0:v]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,setsar=1[bg];\
[1:v]chromakey=0x00ff00:0.2:0.05,scale=1080:-2[fg];\
[bg][fg]overlay=(W-w)/2:H-h:shortest=1,format=yuv420p[v];\
[0:a]volume=0.35[bga];[1:a][bga]amix=inputs=2:duration=first:normalize=0[a]" \
-map "[v]" -map "[a]" -c:v libx264 -crf 20 -c:a aac meme.mp4The Node.js and Python guides wrap the same command in a script; the FFmpeg guide covers captions, placement and edge cleanup.
Staying in sync
- Catalog data (names, tags, descriptions) can be cached as long as you like.
GET /v1/memes?updatedSince=<ISO date>returns what was added or changed since. - Media links expire after about 6 hours. For a fresh one, ask for the clip again:
GET /v1/memes/{id}. - Removed clips: poll
GET /v1/removedand drop what it lists, from your picker and your cache.
Plans for an app
Downloads are what plans measure: count the clips your users actually pick in a month. Searches and thumbnails are calls, and calls are plentiful.
| Plan | Price | Video downloads / month | API calls / month | Requests / minute | For |
|---|---|---|---|---|---|
| Sandbox | Free | 50 total | 30k | 120 | For building and testing |
| Starter | $49/mo | 2k | 100k | 120 | Use in apps and published videos |
| Growth | $199/mo | 20k | 1M | 600 | Use in apps and published videos |
| Enterprise | from $999/mo | 200k | 10M | 600 | Custom terms and uptime commitment |
These are internet memes: Green Screen Memes makes the green screen versions, but the original footage isn't ours and isn't licensed with the clips, so how you use one is up to you. On Starter and up you can publish videos with them, for yourself or clients. Don't put clips of identifiable people in paid ads, sponsored posts or endorsements; animals, objects and cartoons are fine there. The terms have the details. Don't resell the library or let users download it in bulk.
Questions
Can the browser call the API directly?
Not with your key: API calls don't send CORS headers, so they go through your server. The media links in results do send them, so thumbnails and videos load straight into the page, a canvas or WebGL.
Do previews count as downloads?
A video link counts as one download the first time it's fetched; playing or seeking the same link again doesn't count again. Thumbnails never count. Links expire after about 6 hours.
Is there a free meme API key?
Yes. The Sandbox key is free: 50 video downloads to try (one time, not monthly) and 30,000 calls a month for searching and browsing. Paid plans start at $49 a month.
Is this an image meme generator?
No. It's a library of meme video clips with sound. For captioned image templates, an image meme API (Imgflip, memegen) is the better fit; the comparison has the differences.
Which memes are in it?
About 2,000 reaction memes, with new ones every day: GET /v1/trending ranks what people use most in the Green Screen Memes app right now, and GET /v1/tags shows what the library covers.
Get a free key
Sandbox: 50 free video downloads and 30,000 calls a month, for building and testing.