remotion
Rendering
bun /root/code/render-video-modal.ts \
--entry-file src/index.ts \
--composition <CompositionId> \
--output output/video.mp4 \
--props '{"key": "value"}'
The script automatically:
-
Bundles the Remotion project locally
-
Uploads the bundle to R2
-
Submits to Modal GPU for rendering
-
Polls until complete, then copies the result back
-
Reuse the existing project — don't re-scaffold The Remotion project lives at /root/code/src/ with node_modules already installed. For new videos, write new compositions there directly. Never run npm install or bun install unless dependencies are actually missing.
-
Edit in-place for style changes When a user asks for a color/style tweak (like gold instead of purple), only edit the composition .tsx file and re-render. Do not recreate the project or modify index.ts unless the composition ID or structure changes.
-
Use the GPU render command directly
bun /root/code/render-video-modal.ts
--entry-file src/index.ts
--composition
--output output/video.mp4
Always offload to Modal GPU — never attempt local rendering first.
-
Output path discipline: Render directly to the session directory output path. Call yield_output with changeType: "new" on first render and changeType: "updated" on revisions — not "new" each time.
-
Confirm render complete before reporting done: Don't report the video as finished until the render script has exited successfully. Check the output file exists before calling yield_output.
-
Keep compositions short and self-contained: For simple animations (text, transitions), keep everything in one .tsx file. Avoid splitting into multiple components unless the user requests complexity.
Captions
When dealing with captions or subtitles, load the ./rules/subtitles.md file for more information.
Using FFmpeg
For some video operations, such as trimming videos or detecting silence, FFmpeg should be used. Load the ./rules/ffmpeg.md file for more information.
Audio visualization
When needing to visualize audio (spectrum bars, waveforms, bass-reactive effects), load the ./rules/audio-visualization.md file for more information.
Sound effects
When needing to use sound effects, load the ./rules/sound-effects.md file for more information.
How to use
Read individual rule files for detailed explanations and code examples:
- rules/3d.md - 3D content in Remotion using Three.js and React Three Fiber
- rules/animations.md - Fundamental animation skills for Remotion
- rules/assets.md - Importing images, videos, audio, and fonts into Remotion
- rules/audio.md - Using audio and sound in Remotion - importing, trimming, volume, speed, pitch
- rules/calculate-metadata.md - Dynamically set composition duration, dimensions, and props
- rules/can-decode.md - Check if a video can be decoded by the browser using Mediabunny
- rules/charts.md - Chart and data visualization patterns for Remotion (bar, pie, line, stock charts)
- rules/compositions.md - Defining compositions, stills, folders, default props and dynamic metadata
- rules/extract-frames.md - Extract frames from videos at specific timestamps using Mediabunny
- rules/fonts.md - Loading Google Fonts and local fonts in Remotion
- rules/get-audio-duration.md - Getting the duration of an audio file in seconds with Mediabunny
- rules/get-video-dimensions.md - Getting the width and height of a video file with Mediabunny
- rules/get-video-duration.md - Getting the duration of a video file in seconds with Mediabunny
- rules/gifs.md - Displaying GIFs synchronized with Remotion's timeline
- rules/images.md - Embedding images in Remotion using the Img component
- rules/light-leaks.md - Light leak overlay effects using @remotion/light-leaks
- rules/lottie.md - Embedding Lottie animations in Remotion
- rules/measuring-dom-nodes.md - Measuring DOM element dimensions in Remotion
- rules/measuring-text.md - Measuring text dimensions, fitting text to containers, and checking overflow
- rules/sequencing.md - Sequencing patterns for Remotion - delay, trim, limit duration of items
- rules/tailwind.md - Using TailwindCSS in Remotion
- rules/text-animations.md - Typography and text animation patterns for Remotion
- rules/timing.md - Interpolation curves in Remotion - linear, easing, spring animations
- rules/transitions.md - Scene transition patterns for Remotion
- rules/transparent-videos.md - Rendering out a video with transparency
- rules/trimming.md - Trimming patterns for Remotion - cut the beginning or end of animations
- rules/videos.md - Embedding videos in Remotion - trimming, volume, speed, looping, pitch
- rules/parameters.md - Make a video parametrizable by adding a Zod schema
- rules/maps.md - Add a map using Mapbox and animate it
- rules/voiceover.md - Adding AI-generated voiceover to Remotion compositions using ElevenLabs TTS