Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: security camera
kapishdima1dece3cd1a05
diff --git a/components/docs/examples/index.tsx b/components/docs/examples/index.tsxindex f5d91c9d..2ce17029 100644--- a/components/docs/examples/index.tsx+++ b/components/docs/examples/index.tsx@@ -66,6 +66,11 @@ import {ResizableExampleScene,resizableExampleCode,} from "./resizable-example";+import {+ SecurityBitrateExampleScene,+ SecurityColdOpenExampleScene,+ SecurityFeedExampleScene,+} from "./security-cam-recipes";import { SelectExampleScene, selectExampleCode } from "./select-example";import {SharedAxisYExampleScene,@@ -529,6 +534,35 @@ export const examples: Record<string, ExampleEntry> = {height: H,previewBackdrop: { type: "color", value: "#0a0a0a" },},+ "security-cold-open-example": {+ Component: SecurityColdOpenExampleScene,+ code: "<SecurityCam intensity={intensity} />",+ // Surveillance holds, cuts to the clean scene at 44, returns so the loop closes.+ durationInFrames: 90,+ fps: FPS,+ width: W,+ height: H,+ previewBackdrop: { type: "color", value: "#0a0a0a" },+ },+ "security-feed-example": {+ Component: SecurityFeedExampleScene,+ code: "<SecurityCam><Scene /><CameraOsd /></SecurityCam>",+ durationInFrames: 120,+ fps: FPS,+ width: W,+ height: H,+ previewBackdrop: { type: "color", value: "#0a0a0a" },+ },+ "security-bitrate-example": {+ Component: SecurityBitrateExampleScene,+ code: "<SecurityCam compression={starve} blockSize={block} />",+ // Bitrate collapses by frame 36, holds, then recovers for the loop.+ durationInFrames: 96,+ fps: FPS,+ width: W,+ height: H,+ previewBackdrop: { type: "color", value: "#0a0a0a" },+ },"lens-handheld-example": {Component: LensHandheldExampleScene,code: "<CameraLens><Drift grow={0.06} /></CameraLens>",diff --git a/components/docs/examples/security-cam-example.tsx b/components/docs/examples/security-cam-example.tsxnew file mode 100644index 00000000..bf43d5b5--- /dev/null+++ b/components/docs/examples/security-cam-example.tsx@@ -0,0 +1,50 @@+"use client";++import { CanvasSceneB } from "@/components/docs/examples/canvas-scenes";+import { SecurityCam } from "@/registry/remocn/security-cam";++interface SecurityCamExampleProps {+ compression?: number;+ blockSize?: number;+ noise?: number;+ intensity?: number;+}++export function SecurityCamExampleScene({+ compression,+ blockSize,+ noise,+ intensity,+}: SecurityCamExampleProps) {+ return (+ <SecurityCam+ compression={compression}+ blockSize={blockSize}+ noise={noise}+ intensity={intensity}+ >+ <CanvasSceneB />+ </SecurityCam>+ );+}++export const securityCamExampleCode = (+ values: Record<string, unknown>,+): string => {+ const compression = (values.compression as number) ?? 0.7;+ const blockSize = (values.blockSize as number) ?? 10;+ const noise = (values.noise as number) ?? 0.6;+ const intensity = (values.intensity as number) ?? 1;+ return `import { SecurityCam } from "@/components/remocn/security-cam";++export const MyScene = () => (+ <SecurityCam+ compression={${compression}}+ blockSize={${blockSize}}+ noise={${noise}}+ intensity={${intensity}}+ >+ <Scene />+ </SecurityCam>+);`;+};diff --git a/components/docs/examples/security-cam-recipes.tsx b/components/docs/examples/security-cam-recipes.tsxnew file mode 100644index 00000000..004728be--- /dev/null+++ b/components/docs/examples/security-cam-recipes.tsx@@ -0,0 +1,91 @@+"use client";++import type React from "react";+import { AbsoluteFill, interpolate, useCurrentFrame } from "remotion";+import {+ CanvasSceneA,+ CanvasSceneB,+} from "@/components/docs/examples/canvas-scenes";+import { SecurityCam } from "@/registry/remocn/security-cam";++const MONO =+ "var(--font-geist-mono), ui-monospace, SFMono-Regular, Menlo, monospace";++const OSD: React.CSSProperties = {+ position: "absolute",+ fontFamily: MONO,+ fontSize: 30,+ letterSpacing: "0.04em",+ color: "#e8ece8",+};++function CameraOsd() {+ const frame = useCurrentFrame();+ const seconds = 14 + Math.floor(frame / 30);+ const stamp = `2026-08-02 09:41:${String(seconds).padStart(2, "0")}`;+ const recording = frame % 30 < 20;++ return (+ <AbsoluteFill>+ <span style={{ ...OSD, left: 48, top: 40 }}>CAM 03 — LOBBY</span>+ <span style={{ ...OSD, right: 48, top: 40 }}>{stamp}</span>+ <div+ style={{+ ...OSD,+ left: 48,+ bottom: 40,+ display: "flex",+ alignItems: "center",+ gap: 14,+ }}+ >+ <span+ style={{+ width: 18,+ height: 18,+ borderRadius: "50%",+ background: "#e5484d",+ opacity: recording ? 1 : 0.15,+ }}+ />+ REC+ </div>+ </AbsoluteFill>+ );+}++export function SecurityColdOpenExampleScene() {+ const frame = useCurrentFrame();+ const intensity = interpolate(frame, [0, 40, 44, 84, 90], [1, 1, 0, 0, 1], {+ extrapolateRight: "clamp",+ });++ return (+ <SecurityCam intensity={intensity}>+ <CanvasSceneA />+ </SecurityCam>+ );+}++export function SecurityFeedExampleScene() {+ return (+ <SecurityCam>+ <AbsoluteFill>+ <CanvasSceneB />+ <CameraOsd />+ </AbsoluteFill>+ </SecurityCam>+ );+}++export function SecurityBitrateExampleScene() {+ const frame = useCurrentFrame();+ const starve = interpolate(frame, [0, 36, 62, 96], [0.15, 1, 1, 0.15]);+ const block = interpolate(frame, [0, 36, 62, 96], [6, 26, 26, 6]);++ return (+ <SecurityCam compression={starve} blockSize={block}>+ <CanvasSceneB />+ </SecurityCam>+ );+}diff --git a/content/changelog/2026-08-02-filters-optics.mdx b/content/changelog/2026-08-02-filters-optics.mdxindex d2c828b1..a2ef44c7 100644--- a/content/changelog/2026-08-02-filters-optics.mdx+++ b/content/changelog/2026-08-02-filters-optics.mdx@@ -11,6 +11,8 @@ The first seven filters were looks you put on a scene deliberately — tape, a t- [Camera Lens](/docs/filters/components/camera-lens) — a scene put behind real glass. Resolution falls off toward the corners while the middle stays fully sharp, highlights bloom out into what surrounds them, colour fringes where the channels stop agreeing at the edges, and light drops away on the cos⁴ curve real optics follow. The obvious way to build a lens is to bend the frame, but bending is what a tube does — what separates glass from a display is light, not geometry, so `distortion` starts near zero and the defaults are made of softness and bloom. Quiet enough to leave running under a whole demo; you notice it by switching it off.+- [Security Cam](/docs/filters/components/security-cam) — a scene run through a cheap recorder. Macroblocks flatten where the bitrate could not keep up, colour collapses onto blocks twice the size of the brightness blocks, blacks crush, the exposure hunts and noise crawls in the shadows. The obvious build was a fisheye plus desaturation and it was a trap: bending the frame is what a tube does, and a filter whose identity is a warp reads as `crt-screen` with the scanlines missing. What makes footage look like surveillance is the codec, not the lens — so that is what this is, and `camera-lens` still has a `distortion` prop if you want the wide-angle bow feeding it.+### Improvements- The filters that could be mistaken for each other are now split by what they are, not by how they look. `crt-screen` is a tube you watch — uniformly sharp behind a mask. `camera-lens` is glass you shoot through — sharp in one place and losing resolution everywhere else. `vhs-filter` is the signal arriving. Each one's `avoidWhen` names the others, so an agent picking a treatment cannot stack two that tell the same story.diff --git a/content/docs/filters/components/camera-lens.mdx b/content/docs/filters/components/camera-lens.mdxindex 7c1d0389..1b19d882 100644--- a/content/docs/filters/components/camera-lens.mdx+++ b/content/docs/filters/components/camera-lens.mdx@@ -11,6 +11,7 @@ useWhen:avoidWhen:- "The story is a tube being watched — use `crt-screen`, which is uniformly sharp behind a phosphor mask and scanlines."- "The story is a worn signal rather than the optics carrying it — use `vhs-filter`."+ - "The story is the recorder the shot was written to rather than the glass it came through — use `security-cam`."- "You want a band of the frame sharp and the rest thrown out — that is depth of field, not lens character."---diff --git a/content/docs/filters/components/meta.json b/content/docs/filters/components/meta.jsonindex 0c5fa541..954ffb7f 100644--- a/content/docs/filters/components/meta.json+++ b/content/docs/filters/components/meta.json@@ -3,6 +3,7 @@"collapsible": false,"pages": ["camera-lens",+ "security-cam","vhs-filter","crt-screen","sustained-glitch",diff --git a/content/docs/filters/components/security-cam.mdx b/content/docs/filters/components/security-cam.mdxnew file mode 100644index 00000000..01c20189--- /dev/null+++ b/content/docs/filters/components/security-cam.mdx@@ -0,0 +1,178 @@+---+title: Security Cam+description: Run a scene through a cheap recorder — macroblocks, collapsed colour, crushed blacks, crawling noise+component: security-cam+vibe: tech+length: sustained+useWhen:+ - "A beat should play as surveillance footage — a cold open, a 'meanwhile, in production' aside, anything that wants to read as captured rather than presented."+ - "You want the scene to arrive as a recording and then snap to the real thing — interpolate intensity to 0 on a hard cut."+ - "The story is about a feed degrading — drive compression up and the picture falls apart into blocks the way a starved stream does."+avoidWhen:+ - "The story is the glass a shot was taken through rather than the recorder it was written to — use `camera-lens`."+ - "The story is a tube being watched — use `crt-screen`, which is a display rather than a codec."+ - "You want analog wear — tape smears colour sideways along the scanline; this quantizes it into blocks, which is a different century."+---++<ComponentPreview name="security-cam" />++<CanvasFilterNote />++## Installation++<InstallBlock name="security-cam" />++## Usage++`SecurityCam` is a wrapper. Put a scene inside it and it comes back as something+that went through a cheap recorder: the picture flattens into macroblocks where+the bitrate could not keep up, colour resolution collapses to half the detail of+brightness, blacks crush, the exposure hunts slightly, and noise crawls in the+shadows.++```tsx+import { SecurityCam } from "@/components/remocn/security-cam";++export const MyScene = () => (+ <SecurityCam>+ <Scene />+ </SecurityCam>+);+```++## Why there is no fisheye here++The obvious build is a wide bow plus desaturation, and it is a trap: bending the+frame is what `crt-screen` does, and a filter whose identity is a warp ends up+reading as a curved display with the scanlines missing. `camera-lens` already+covers optics, and it has a `distortion` prop if you want a wide-angle bow —+nest the two and you get a wide lens feeding a cheap recorder.++What makes footage look like surveillance is not the lens, it is the **codec**.+So that is what this is: macroblocking and chroma subsampling, the two artifacts+every starved video stream has and no display ever produces.++## What to reach for it for++### Open cold, then cut to the truth++The strongest use. The scene plays as a recording, and on a hard cut the+surveillance drops away and the real interface is underneath — the same shot,+suddenly clean.++<ComponentExample name="security-cold-open" />++```tsx+import { interpolate, useCurrentFrame } from "remotion";+import { SecurityCam } from "@/components/remocn/security-cam";++export const Opening = () => {+ const frame = useCurrentFrame();+ const intensity = interpolate(frame, [0, 40, 44], [1, 1, 0], {+ extrapolateRight: "clamp",+ });++ return (+ <SecurityCam intensity={intensity}>+ <Scene />+ </SecurityCam>+ );+};+```++Cut, do not fade. A recording that dissolves into a clean render is a+crossfade; one that switches in a single frame is an edit.++### Give it an OSD++The wrapper adds nothing of its own — no timestamp, no camera label, no+recording dot. Those belong to your scene, and putting them **inside** the+wrapper is what sells it: burned-in overlays get compressed along with+everything else, exactly as a real recorder writes them.++<ComponentExample name="security-feed" />++```tsx+<SecurityCam>+ <AbsoluteFill>+ <Scene />+ <CameraOsd />+ </AbsoluteFill>+</SecurityCam>+```++### Starve the bitrate++Drive `compression` and `blockSize` together and the feed collapses: detail+dissolves into flat squares, colour smears across blocks twice their size, and+the picture becomes something you can only just read. Good for a moment of+things going wrong.++<ComponentExample name="security-bitrate" />++```tsx+const starve = interpolate(frame, [0, 36], [0.15, 1], {+ extrapolateRight: "clamp",+});+const block = interpolate(frame, [0, 36], [6, 26], {+ extrapolateRight: "clamp",+});+```++## Props++<PropsTable+ rows={[+ {+ name: "compression",+ type: "number",+ default: "0.7",+ description:+ "How hard the codec is squeezing. Pulls each block toward its own average, coarsens the brightness quantizer, and collapses colour onto blocks twice the size. At 0 the picture keeps its detail and only the tone and noise remain.",+ },+ {+ name: "blockSize",+ type: "number",+ default: "10",+ description:+ "Macroblock edge in composition units. Colour is always sampled on blocks twice this size, which is what makes the result read as video rather than as a mosaic.",+ },+ {+ name: "noise",+ type: "number",+ default: "0.6",+ description:+ "Sensor grain, weighted toward the shadows the way a small sensor at high gain behaves. Bright areas stay comparatively clean.",+ },+ {+ name: "intensity",+ type: "number",+ default: "1",+ description:+ "Master amount. Read every frame, so cutting it to 0 hands the clean scene back in a single frame. At 0 the scene passes through exactly as it was.",+ },+ {+ name: "children",+ type: "React.ReactNode",+ description: "The scene the filter wraps and re-reads every frame.",+ },+ ]}+/>++## Notes++Colour is sampled on blocks twice the size of the brightness blocks, which is the+detail doing most of the work. Real video codecs throw away colour resolution+first because the eye barely notices — until it does, and a red badge bleeds+across a square it does not belong to. That mismatch between sharp brightness and+blocky colour is what the eye reads as "compressed", and it is a genuinely+different artifact from the sideways chroma smear of `vhs-filter`.++The only motion is a slow exposure pump on a 90-frame cycle and the shadow noise,+which is reseeded per frame from a 64-frame clock. Both are pure functions of the+frame number, so parallel renders match and nothing drifts.++In browsers without html-in-canvas the scene keeps the wash and the vignette but+not the blocking. Quantizing a frame into macroblocks is not something a+stylesheet can do, and a plain blur pretending to be compression would be a+different artifact wearing this one's name.diff --git a/registry-artifacts/registry.json b/registry-artifacts/registry.jsonindex 700351f4..8417356c 100644--- a/registry-artifacts/registry.json+++ b/registry-artifacts/registry.json@@ -1674,6 +1674,21 @@],"type": "registry:component"},+ {+ "name": "security-cam",+ "title": "Security Cam",+ "description": "Run a scene through a cheap recorder: macroblocks flatten under a starved bitrate, colour resolution collapses to half the luma, blacks crush and shadows crawl with sensor noise.",+ "dependencies": ["remotion"],+ "registryDependencies": ["@remocn/canvas-presentation"],+ "files": [+ {+ "path": "registry/remocn/security-cam/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/security-cam.tsx"+ }+ ],+ "type": "registry:component"+ },{"name": "camera-lens","title": "Camera Lens",diff --git a/registry-artifacts/security-cam.json b/registry-artifacts/security-cam.jsonnew file mode 100644index 00000000..2edca738--- /dev/null+++ b/registry-artifacts/security-cam.json@@ -0,0 +1,17 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "security-cam",+ "title": "Security Cam",+ "description": "Run a scene through a cheap recorder: macroblocks flatten under a starved bitrate, colour resolution collapses to half the luma, blacks crush and shadows crawl with sensor noise.",+ "dependencies": ["remotion"],+ "registryDependencies": ["@remocn/canvas-presentation"],+ "files": [+ {+ "path": "registry/remocn/security-cam/index.tsx",+ "content": "\"use client\";\n\nimport type React from \"react\";\nimport { AbsoluteFill, useVideoConfig } from \"remotion\";\nimport {\n type CanvasFilterProps,\n makeCanvasFilter,\n makeFilterShader,\n} from \"@/lib/remocn/canvas-presentation\";\n\nexport type SecurityCamProps = {\n compression?: number;\n blockSize?: number;\n noise?: number;\n intensity?: number;\n};\n\nconst DEFAULTS = {\n compression: 0.7,\n blockSize: 10,\n noise: 0.6,\n intensity: 1,\n};\n\ntype NormalizedProps = {\n compression: number;\n cellX: number;\n cellY: number;\n noise: number;\n intensity: number;\n};\n\nconst FRAGMENT_SHADER = `#version 300 es\nprecision highp float;\n\nuniform sampler2D u_scene;\nuniform float u_frame;\nuniform vec2 u_cell;\nuniform float u_compression;\nuniform float u_noise;\nuniform float u_intensity;\n\nin vec2 v_uv;\nout vec4 outColor;\n\nconst float PI = 3.141592653589793;\n\nfloat hash(vec2 p) {\n return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453123);\n}\n\nfloat lumaOf(vec3 c) {\n return dot(c, vec3(0.299, 0.587, 0.114));\n}\n\nvec2 chromaOf(vec3 c) {\n return vec2(c.b - lumaOf(c), c.r - lumaOf(c));\n}\n\nvec3 fromLumaChroma(float y, vec2 cbcr) {\n return vec3(y + cbcr.y, y - 0.194 * cbcr.x - 0.509 * cbcr.y, y + cbcr.x);\n}\n\nvec3 blockMean(vec2 origin, vec2 cell) {\n vec3 total = vec3(0.0);\n for (int y = 0; y < 2; y++) {\n for (int x = 0; x < 2; x++) {\n vec2 at = origin + (vec2(float(x), float(y)) + 0.5) * cell * 0.5;\n total += texture(u_scene, at).rgb;\n }\n }\n return total * 0.25;\n}\n\nvoid main() {\n vec4 src = texture(u_scene, v_uv);\n float amount = clamp(u_intensity, 0.0, 1.0);\n\n if (!(amount > 0.001)) {\n outColor = src;\n return;\n }\n\n vec2 cell = max(u_cell, vec2(0.0008));\n vec2 wide = cell * 2.0;\n\n vec3 lumaBlock = blockMean(floor(v_uv / cell) * cell, cell);\n vec3 chromaBlock = blockMean(floor(v_uv / wide) * wide, wide);\n\n float squeeze = clamp(u_compression, 0.0, 1.0) * amount;\n\n float y = mix(lumaOf(src.rgb), lumaOf(lumaBlock), squeeze * 0.8);\n float levels = mix(255.0, 20.0, squeeze);\n y = floor(y * levels + 0.5) / levels;\n\n vec2 cbcr = mix(chromaOf(src.rgb), chromaOf(chromaBlock), squeeze);\n cbcr *= mix(1.0, 0.62, amount);\n\n vec3 color = fromLumaChroma(y, cbcr);\n\n float pump = 1.0 + 0.03 * sin(u_frame * PI / 45.0) * amount;\n color = clamp((color * pump - 0.05 * amount) / (1.0 - 0.14 * amount), 0.0, 1.0);\n\n float clock = mod(u_frame, 64.0);\n float shadow = 1.0 - smoothstep(0.0, 0.55, y);\n float grain =\n hash(v_uv + vec2(clock * 0.017, clock * 0.029)) - 0.5;\n color += grain * 0.16 * u_noise * amount * (0.25 + shadow);\n\n outColor = vec4(clamp(color, 0.0, 1.0), src.a);\n}`;\n\nconst shader = makeFilterShader<NormalizedProps>(\n FRAGMENT_SHADER,\n ({ gl, uniform, passedProps }) => {\n const { compression, cellX, cellY, noise, intensity } = passedProps;\n gl.uniform1f(uniform(\"u_compression\"), compression);\n gl.uniform2f(uniform(\"u_cell\"), cellX, cellY);\n gl.uniform1f(uniform(\"u_noise\"), noise);\n gl.uniform1f(uniform(\"u_intensity\"), intensity);\n },\n);\n\nconst SecurityCamFallback: React.FC<NormalizedProps & CanvasFilterProps> = ({\n children,\n intensity,\n}) => (\n <AbsoluteFill>\n <AbsoluteFill\n style={{\n filter: `saturate(${1 - 0.38 * intensity}) contrast(${1 + 0.22 * intensity}) brightness(${1 - 0.05 * intensity})`,\n }}\n >\n {children}\n </AbsoluteFill>\n <AbsoluteFill\n style={{\n background:\n \"radial-gradient(ellipse 82% 80% at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.55) 100%)\",\n opacity: intensity,\n }}\n />\n </AbsoluteFill>\n);\n\nconst SecurityCamCanvas = makeCanvasFilter<NormalizedProps>({\n shader,\n fallback: SecurityCamFallback,\n});\n\nexport const SecurityCam: React.FC<SecurityCamProps & CanvasFilterProps> = ({\n compression = DEFAULTS.compression,\n blockSize = DEFAULTS.blockSize,\n noise = DEFAULTS.noise,\n intensity = DEFAULTS.intensity,\n children,\n}) => {\n const { width, height } = useVideoConfig();\n\n return (\n <SecurityCamCanvas\n compression={compression}\n cellX={Math.max(blockSize, 1) / width}\n cellY={Math.max(blockSize, 1) / height}\n noise={noise}\n intensity={intensity}\n >\n {children}\n </SecurityCamCanvas>\n );\n};\n",+ "type": "registry:component",+ "target": "components/remocn/security-cam.tsx"+ }+ ],+ "type": "registry:component"+}diff --git a/registry/__index__.tsx b/registry/__index__.tsxindex 7c35b59f..bc07a89f 100644--- a/registry/__index__.tsx+++ b/registry/__index__.tsx@@ -72,6 +72,7 @@ import { rollingNumberConfig } from "@/registry/remocn/rolling-number/config";import { rolodexFlipConfig } from "@/registry/remocn/rolodex-flip/config";import { scaleDownFadeConfig } from "@/registry/remocn/scale-down-fade/config";import { scribbleCircleConfig } from "@/registry/remocn/scribble-circle/config";+import { securityCamConfig } from "@/registry/remocn/security-cam/config";import { shaderCausticsConfig } from "@/registry/remocn/shader-caustics/config";import { shaderColorPanelsConfig } from "@/registry/remocn/shader-color-panels/config";import { shaderDitheringConfig } from "@/registry/remocn/shader-dithering/config";@@ -1521,6 +1522,13 @@ const registry: Record<string, RegistryEntry> = {})),config: cameraLensConfig,},+ "security-cam": {+ load: () =>+ import("@/components/docs/examples/security-cam-example").then((m) => ({+ default: m.SecurityCamExampleScene,+ })),+ config: securityCamConfig,+ },"slide-swap": {load: () =>import("@/components/docs/examples/slide-swap-example").then((m) => ({diff --git a/registry/remocn/registry.json b/registry/remocn/registry.jsonindex 569d698c..5e02978e 100644--- a/registry/remocn/registry.json+++ b/registry/remocn/registry.json@@ -1674,6 +1674,21 @@}]},+ {+ "name": "security-cam",+ "type": "registry:component",+ "title": "Security Cam",+ "description": "Run a scene through a cheap recorder: macroblocks flatten under a starved bitrate, colour resolution collapses to half the luma, blacks crush and shadows crawl with sensor noise.",+ "dependencies": ["remotion"],+ "registryDependencies": ["@remocn/canvas-presentation"],+ "files": [+ {+ "path": "security-cam/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/security-cam.tsx"+ }+ ]+ },{"name": "camera-lens","type": "registry:component",diff --git a/registry/remocn/security-cam/config.ts b/registry/remocn/security-cam/config.tsnew file mode 100644index 00000000..7e374e42--- /dev/null+++ b/registry/remocn/security-cam/config.ts@@ -0,0 +1,47 @@+import { securityCamExampleCode } from "@/components/docs/examples/security-cam-example";+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";++export const securityCamConfig: ComponentConfig = {+ componentName: "SecurityCam",+ importPath: "@/components/remocn/security-cam",+ controls: {+ compression: {+ type: "number",+ default: 0.7,+ min: 0,+ max: 1,+ step: 0.05,+ label: "Compression",+ },+ blockSize: {+ type: "number",+ default: 10,+ min: 4,+ max: 32,+ step: 1,+ label: "Macroblock",+ },+ noise: {+ type: "number",+ default: 0.6,+ min: 0,+ max: 2,+ step: 0.05,+ label: "Sensor noise",+ },+ intensity: {+ type: "number",+ default: 1,+ min: 0,+ max: 1,+ step: 0.05,+ label: "Intensity",+ },+ },+ durationInFrames: 90,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+ previewBackdrop: { type: "color", value: "#0a0a0a" },+ snippet: securityCamExampleCode,+};diff --git a/registry/remocn/security-cam/index.tsx b/registry/remocn/security-cam/index.tsxnew file mode 100644index 00000000..f455bfa7--- /dev/null+++ b/registry/remocn/security-cam/index.tsx@@ -0,0 +1,171 @@+"use client";++import type React from "react";+import { AbsoluteFill, useVideoConfig } from "remotion";+import {+ type CanvasFilterProps,+ makeCanvasFilter,+ makeFilterShader,+} from "@/lib/remocn/canvas-presentation";++export type SecurityCamProps = {+ compression?: number;+ blockSize?: number;+ noise?: number;+ intensity?: number;+};++const DEFAULTS = {+ compression: 0.7,+ blockSize: 10,+ noise: 0.6,+ intensity: 1,+};++type NormalizedProps = {+ compression: number;+ cellX: number;+ cellY: number;+ noise: number;+ intensity: number;+};++const FRAGMENT_SHADER = `#version 300 es+precision highp float;++uniform sampler2D u_scene;+uniform float u_frame;+uniform vec2 u_cell;+uniform float u_compression;+uniform float u_noise;+uniform float u_intensity;++in vec2 v_uv;+out vec4 outColor;++const float PI = 3.141592653589793;++float hash(vec2 p) {+ return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453123);+}++float lumaOf(vec3 c) {+ return dot(c, vec3(0.299, 0.587, 0.114));+}++vec2 chromaOf(vec3 c) {+ return vec2(c.b - lumaOf(c), c.r - lumaOf(c));+}++vec3 fromLumaChroma(float y, vec2 cbcr) {+ return vec3(y + cbcr.y, y - 0.194 * cbcr.x - 0.509 * cbcr.y, y + cbcr.x);+}++vec3 blockMean(vec2 origin, vec2 cell) {+ vec3 total = vec3(0.0);+ for (int y = 0; y < 2; y++) {+ for (int x = 0; x < 2; x++) {+ vec2 at = origin + (vec2(float(x), float(y)) + 0.5) * cell * 0.5;+ total += texture(u_scene, at).rgb;+ }+ }+ return total * 0.25;+}++void main() {+ vec4 src = texture(u_scene, v_uv);+ float amount = clamp(u_intensity, 0.0, 1.0);++ if (!(amount > 0.001)) {+ outColor = src;+ return;+ }++ vec2 cell = max(u_cell, vec2(0.0008));+ vec2 wide = cell * 2.0;++ vec3 lumaBlock = blockMean(floor(v_uv / cell) * cell, cell);+ vec3 chromaBlock = blockMean(floor(v_uv / wide) * wide, wide);++ float squeeze = clamp(u_compression, 0.0, 1.0) * amount;++ float y = mix(lumaOf(src.rgb), lumaOf(lumaBlock), squeeze * 0.8);+ float levels = mix(255.0, 20.0, squeeze);+ y = floor(y * levels + 0.5) / levels;++ vec2 cbcr = mix(chromaOf(src.rgb), chromaOf(chromaBlock), squeeze);+ cbcr *= mix(1.0, 0.62, amount);++ vec3 color = fromLumaChroma(y, cbcr);++ float pump = 1.0 + 0.03 * sin(u_frame * PI / 45.0) * amount;+ color = clamp((color * pump - 0.05 * amount) / (1.0 - 0.14 * amount), 0.0, 1.0);++ float clock = mod(u_frame, 64.0);+ float shadow = 1.0 - smoothstep(0.0, 0.55, y);+ float grain =+ hash(v_uv + vec2(clock * 0.017, clock * 0.029)) - 0.5;+ color += grain * 0.16 * u_noise * amount * (0.25 + shadow);++ outColor = vec4(clamp(color, 0.0, 1.0), src.a);+}`;++const shader = makeFilterShader<NormalizedProps>(+ FRAGMENT_SHADER,+ ({ gl, uniform, passedProps }) => {+ const { compression, cellX, cellY, noise, intensity } = passedProps;+ gl.uniform1f(uniform("u_compression"), compression);+ gl.uniform2f(uniform("u_cell"), cellX, cellY);+ gl.uniform1f(uniform("u_noise"), noise);+ gl.uniform1f(uniform("u_intensity"), intensity);+ },+);++const SecurityCamFallback: React.FC<NormalizedProps & CanvasFilterProps> = ({+ children,+ intensity,+}) => (+ <AbsoluteFill>+ <AbsoluteFill+ style={{+ filter: `saturate(${1 - 0.38 * intensity}) contrast(${1 + 0.22 * intensity}) brightness(${1 - 0.05 * intensity})`,+ }}+ >+ {children}+ </AbsoluteFill>+ <AbsoluteFill+ style={{+ background:+ "radial-gradient(ellipse 82% 80% at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.55) 100%)",+ opacity: intensity,+ }}+ />+ </AbsoluteFill>+);++const SecurityCamCanvas = makeCanvasFilter<NormalizedProps>({+ shader,+ fallback: SecurityCamFallback,+});++export const SecurityCam: React.FC<SecurityCamProps & CanvasFilterProps> = ({+ compression = DEFAULTS.compression,+ blockSize = DEFAULTS.blockSize,+ noise = DEFAULTS.noise,+ intensity = DEFAULTS.intensity,+ children,+}) => {+ const { width, height } = useVideoConfig();++ return (+ <SecurityCamCanvas+ compression={compression}+ cellX={Math.max(blockSize, 1) / width}+ cellY={Math.max(blockSize, 1) / height}+ noise={noise}+ intensity={intensity}+ >+ {children}+ </SecurityCamCanvas>+ );+};diff --git a/src/remotion/canvas-spike-root.tsx b/src/remotion/canvas-spike-root.tsxindex 75834de7..ff4acaef 100644--- a/src/remotion/canvas-spike-root.tsx+++ b/src/remotion/canvas-spike-root.tsx@@ -16,6 +16,7 @@ import { GridWaveExampleScene } from "@/components/docs/examples/grid-wave-exampimport { HalftonePrintExampleScene } from "@/components/docs/examples/halftone-print-example";import { ParticleDissolveExampleScene } from "@/components/docs/examples/particle-dissolve-example";import { PixelateRegionExampleScene } from "@/components/docs/examples/pixelate-region-example";+import { SecurityCamExampleScene } from "@/components/docs/examples/security-cam-example";import { SustainedGlitchExampleScene } from "@/components/docs/examples/sustained-glitch-example";import { UnderwaterRippleExampleScene } from "@/components/docs/examples/underwater-ripple-example";import { VhsFilterExampleScene } from "@/components/docs/examples/vhs-filter-example";@@ -30,6 +31,7 @@ import { gridWaveConfig } from "@/registry/remocn/grid-wave/config";import { halftonePrintConfig } from "@/registry/remocn/halftone-print/config";import { particleDissolveConfig } from "@/registry/remocn/particle-dissolve/config";import { pixelateRegionConfig } from "@/registry/remocn/pixelate-region/config";+import { securityCamConfig } from "@/registry/remocn/security-cam/config";import { sustainedGlitchConfig } from "@/registry/remocn/sustained-glitch/config";import { underwaterRippleConfig } from "@/registry/remocn/underwater-ripple/config";import { vhsFilterConfig } from "@/registry/remocn/vhs-filter/config";@@ -78,6 +80,7 @@ const SCENES: Record<config: underwaterRippleConfig,},"camera-lens": { Scene: CameraLensExampleScene, config: cameraLensConfig },+ "security-cam": { Scene: SecurityCamExampleScene, config: securityCamConfig },};function makeStage(Scene: ComponentType) {