π₯ Make videos programmatically with React
run over it with AI
Jonny Burger7aaf0e8757be
diff --git a/packages/skills/.prettierrc b/packages/skills/.prettierrcnew file mode 100644index 0000000000..37d5071748--- /dev/null+++ b/packages/skills/.prettierrc@@ -0,0 +1,5 @@+{+ "useTabs": false,+ "bracketSpacing": true,+ "tabWidth": 2+}diff --git a/packages/skills/skills/remotion/SKILL.md b/packages/skills/skills/remotion/SKILL.mdindex 78848d0a9d..b215feceeb 100644--- a/packages/skills/skills/remotion/SKILL.md+++ b/packages/skills/skills/remotion/SKILL.md@@ -39,7 +39,7 @@ Read individual rule files for detailed explanations and code examples:- [rules/timing.md](rules/timing.md) - Interpolation curves in Remotion - linear, easing, spring animations- [rules/transcribe-captions.md](rules/transcribe-captions.md) - Transcribing audio to generate captions in Remotion- [rules/transitions.md](rules/transitions.md) - Scene transition patterns for Remotion-- [rules/transparent-videos.md](rules/transparent-videos.md) - Rendering transparent videos with VP8, VP9, or ProRes codecs+- [rules/transparent-videos.md](rules/transparent-videos.md) - Rendering out a video with transparency- [rules/trimming.md](rules/trimming.md) - Trimming patterns for Remotion - cut the beginning or end of animations- [rules/videos.md](rules/videos.md) - Embedding videos in Remotion - trimming, volume, speed, looping, pitch- [rules/parameters.md](rules/parameters.md) - Make a video parametrizable by adding a Zod schemadiff --git a/packages/skills/skills/remotion/rules/transparent-videos.md b/packages/skills/skills/remotion/rules/transparent-videos.mdindex c7ad523b62..ccf412dcab 100644--- a/packages/skills/skills/remotion/rules/transparent-videos.md+++ b/packages/skills/skills/remotion/rules/transparent-videos.md@@ -1,105 +1,47 @@---name: transparent-videos-description: Rendering transparent videos in Remotion with VP8, VP9, or ProRes codecs+description: Rendering transparent videos in Remotionmetadata:- tags: transparent, alpha, codec, vp8, vp9, prores, webm, pixel-format+ tags: transparent, alpha, codec, vp9, prores, webm----# Rendering Transparent Videos in Remotion+# Rendering Transparent Videos-## What are transparent videos?+Remotion can render transparent videos in two ways: as a WebM video or as a ProRes video.-Transparent videos contain an alpha channel that allows parts of the video to be see-through, similar to PNG images with transparency. This is useful for overlaying videos on other content or creating videos with non-rectangular shapes.+## Transparent WebM (VP9)-**Browser support:** Chrome and Firefox support WebM videos (VP8/VP9) with alpha channels. Safari and other browsers do not support transparent WebM playback.+Ideal for when playing in a browser.-## Supported codecs+**CLI:**-Only specific codecs support alpha channels:--### VP8 or VP9 (WebM)--Best for web playback in Chrome/Firefox:--```tsx-import {renderMedia} from '@remotion/renderer';--await renderMedia({- composition,- codec: 'vp9', // or 'vp8'- imageFormat: 'png',- pixelFormat: 'yuva420p',- outputLocation: 'out/video-transparent.webm',-});-```--### ProRes (4444 or 4444-xq)--Best for video editing software (Final Cut Pro, Adobe Premiere, DaVinci Resolve):--```tsx-await renderMedia({- composition,- codec: 'prores',- proresProfile: '4444', // or '4444-xq'- imageFormat: 'png',- pixelFormat: 'yuva444p10le',- outputLocation: 'out/video-transparent.mov',-});-```--## Required settings--To render transparent videos, you **must** configure three settings:--1. **Image format:** `png` (JPEG doesn't support transparency)-2. **Codec:** `vp8`, `vp9`, or `prores`-3. **Pixel format:**- - `yuva420p` for VP8/VP9- - `yuva444p10le` for ProRes--### Using remotion.config.ts--```tsx-import {Config} from '@remotion/cli/config';--// For WebM (VP8/VP9)-Config.setVideoImageFormat('png');-Config.setPixelFormat('yuva420p');-Config.setCodec('vp9');--// For ProRes-Config.setVideoImageFormat('png');-Config.setPixelFormat('yuva444p10le');-Config.setCodec('prores');-Config.setProResProfile('4444');+```bash+npx remotion render --image-format=png --pixel-format=yuva420p --codec=vp9 MyComp out.webm```-### Using CLI flags+**Default in Studio** (restart Studio after changing):-```bash-# WebM-remotion render --image-format=png --pixel-format=yuva420p --codec=vp9 my-video out.webm+```ts+// remotion.config.ts+import { Config } from "@remotion/cli/config";-# ProRes-remotion render --image-format=png --pixel-format=yuva444p10le --codec=prores --prores-profile=4444 my-video out.mov+Config.setVideoImageFormat("png");+Config.setPixelFormat("yuva420p");+Config.setCodec("vp9");```-### Using calculateMetadata (recommended)--Set transparency as the default for a composition:+**Setting it as the default export settings for a composition** (using `calculateMetadata`):```tsx-import {CalculateMetadataFunction} from 'remotion';+import { CalculateMetadataFunction } from "remotion";-const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {+const calculateMetadata: CalculateMetadataFunction<Props> = async ({+ props,+}) => {return {- defaultCodec: 'vp9',- props: {- ...props,- imageFormat: 'png',- pixelFormat: 'yuva420p',- },+ defaultCodec: "vp8",+ defaultVideoImageFormat: "png",+ defaultPixelFormat: "yuva420p",};};@@ -111,110 +53,54 @@ const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {width={1920}height={1080}calculateMetadata={calculateMetadata}-/>+/>;```-## Transparent videos in your composition+## Transparent ProRes-Make sure your composition doesn't render an opaque background:--```tsx-export const MyVideo: React.FC<{transparent: boolean}> = ({transparent}) => {- return (- <div- style={{- flex: 1,- backgroundColor: transparent ? undefined : 'white',- }}- >- {/* Your content */}- </div>- );-};-```--Use the **checkerboard button** in Remotion Studio to verify your video is transparent.--## Enabling transparency for <OffthreadVideo>--When using `<OffthreadVideo>` in your composition, add the `transparent` prop:--```tsx-import {OffthreadVideo} from 'remotion';--<OffthreadVideo- src={staticFile('video.webm')}- transparent // Required for alpha channel during export-/>-```+Ideal for when importing into video editing software.-Without this prop, the video will be rendered as opaque even if it has an alpha channel.+**CLI:**-## Common pitfalls--### β H.264 does NOT support transparency--```tsx-// This will NOT work - H.264 doesn't support alpha-codec: 'h264',-pixelFormat: 'yuva420p', // Ignored+```bash+npx remotion render --image-format=png --pixel-format=yuva444p10le --codec=prores --prores-profile=4444 MyComp out.mov```-You must use VP8, VP9, or ProRes.+**Default in Studio** (restart Studio after changing):-### β Wrong pixel format+```ts+// remotion.config.ts+import { Config } from "@remotion/cli/config";-```tsx-// Wrong for VP9-codec: 'vp9',-pixelFormat: 'yuv420p', // Missing 'a' for alpha--// Wrong for ProRes-codec: 'prores',-pixelFormat: 'yuva420p', // Should be yuva444p10le+Config.setVideoImageFormat("png");+Config.setPixelFormat("yuva444p10le");+Config.setCodec("prores");+Config.setProResProfile("4444");```-### β Forgetting image format+**Setting it as the default export settings for a composition** (using `calculateMetadata`):```tsx-// Won't work - JPEG doesn't support transparency-imageFormat: 'jpeg',-codec: 'vp9',-pixelFormat: 'yuva420p',-```--Must use `imageFormat: 'png'`.--### β Opaque background in composition--```tsx-// This will render a white background-<div style={{backgroundColor: 'white'}}>- {/* Content */}-</div>-```--Remove or conditionally set the background color.--## Browser limitations--- **Chrome/Firefox:** Full support for WebM with alpha-- **Safari/Edge:** No support for transparent WebM playback-- **All browsers:** Can play transparent videos in `<video>` tags, but may not render transparency+import { CalculateMetadataFunction } from "remotion";-Consider creating fallback versions:+const calculateMetadata: CalculateMetadataFunction<Props> = async ({+ props,+}) => {+ return {+ defaultCodec: "prores",+ defaultVideoImageFormat: "png",+ defaultPixelFormat: "yuva444p10le",+ defaultProResProfile: "4444",+ };+};-```json-"scripts": {- "render": "remotion render my-video video.mp4",- "render-transparent": "remotion render --image-format=png --pixel-format=yuva420p --codec=vp9 my-video video-transparent.webm"-}+<Composition+ id="my-video"+ component={MyVideo}+ durationInFrames={150}+ fps={30}+ width={1920}+ height={1080}+ calculateMetadata={calculateMetadata}+/>;```--Use `<source>` elements or the `canplay` event to serve the appropriate version based on browser support.--## See also--- [Transparent videos documentation](https://www.remotion.dev/docs/transparent-videos)-- [renderMedia API](https://www.remotion.dev/docs/renderer/render-media)-- [CLI options](https://www.remotion.dev/docs/cli)