remotion-claude-agent-demo 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +160 -0
  2. package/apps/web/README.md +36 -0
  3. package/apps/web/env.example +20 -0
  4. package/apps/web/eslint.config.mjs +18 -0
  5. package/apps/web/next.config.ts +7 -0
  6. package/apps/web/package-lock.json +10348 -0
  7. package/apps/web/package.json +35 -0
  8. package/apps/web/postcss.config.mjs +7 -0
  9. package/apps/web/public/file.svg +1 -0
  10. package/apps/web/public/globe.svg +1 -0
  11. package/apps/web/public/next.svg +1 -0
  12. package/apps/web/public/vercel.svg +1 -0
  13. package/apps/web/public/window.svg +1 -0
  14. package/apps/web/src/app/.well-known/agent-card.json/route.ts +50 -0
  15. package/apps/web/src/app/background-tasks/[jobId]/cancel/route.ts +29 -0
  16. package/apps/web/src/app/events/stream/route.ts +58 -0
  17. package/apps/web/src/app/favicon.ico +0 -0
  18. package/apps/web/src/app/globals.css +174 -0
  19. package/apps/web/src/app/layout.tsx +34 -0
  20. package/apps/web/src/app/messages/answer/route.ts +57 -0
  21. package/apps/web/src/app/messages/stream/route.ts +381 -0
  22. package/apps/web/src/app/page.tsx +358 -0
  23. package/apps/web/src/app/tasks/[taskId]/cancel/route.ts +24 -0
  24. package/apps/web/src/app/tasks/[taskId]/route.ts +24 -0
  25. package/apps/web/src/app/tasks/route.ts +13 -0
  26. package/apps/web/src/components/chat/agent-blocks.tsx +111 -0
  27. package/apps/web/src/components/chat/ask-user-question-panel.tsx +172 -0
  28. package/apps/web/src/components/chat/session-sidebar.tsx +222 -0
  29. package/apps/web/src/components/chat/subagent-activity-sidebar.tsx +248 -0
  30. package/apps/web/src/components/chat/tool-blocks.tsx +550 -0
  31. package/apps/web/src/lib/a2a/activity-store.ts +150 -0
  32. package/apps/web/src/lib/a2a/client.ts +357 -0
  33. package/apps/web/src/lib/a2a/sse.ts +19 -0
  34. package/apps/web/src/lib/a2a/task-store.ts +111 -0
  35. package/apps/web/src/lib/a2a/types.ts +216 -0
  36. package/apps/web/src/lib/agent/answer-store.ts +109 -0
  37. package/apps/web/src/lib/agent/background-delivery.ts +343 -0
  38. package/apps/web/src/lib/agent/background-tool.ts +78 -0
  39. package/apps/web/src/lib/agent/background.ts +452 -0
  40. package/apps/web/src/lib/agent/chat.ts +543 -0
  41. package/apps/web/src/lib/agent/session-store.ts +26 -0
  42. package/apps/web/src/lib/chat/types.ts +44 -0
  43. package/apps/web/src/lib/env.ts +31 -0
  44. package/apps/web/src/lib/hooks/useA2AChat.ts +863 -0
  45. package/apps/web/src/lib/state/chat-atoms.ts +52 -0
  46. package/apps/web/src/lib/workspace.ts +9 -0
  47. package/apps/web/tsconfig.json +35 -0
  48. package/bin/remotion-agent.js +451 -0
  49. package/package.json +34 -0
  50. package/templates/.claude/CLAUDE.md +95 -0
  51. package/templates/.claude/README.md +129 -0
  52. package/templates/.claude/agents/composer-agent.md +188 -0
  53. package/templates/.claude/agents/crafter.md +181 -0
  54. package/templates/.claude/agents/creator.md +134 -0
  55. package/templates/.claude/agents/perceiver.md +92 -0
  56. package/templates/.claude/settings.json +36 -0
  57. package/templates/.claude/settings.local.json +39 -0
  58. package/templates/.claude/skills/agent-browser/SKILL.md +349 -0
  59. package/templates/.claude/skills/agent-browser/references/authentication.md +188 -0
  60. package/templates/.claude/skills/agent-browser/references/proxy-support.md +175 -0
  61. package/templates/.claude/skills/agent-browser/references/session-management.md +181 -0
  62. package/templates/.claude/skills/agent-browser/references/snapshot-refs.md +186 -0
  63. package/templates/.claude/skills/agent-browser/references/video-recording.md +162 -0
  64. package/templates/.claude/skills/agent-browser/templates/authenticated-session.sh +91 -0
  65. package/templates/.claude/skills/agent-browser/templates/capture-workflow.sh +68 -0
  66. package/templates/.claude/skills/agent-browser/templates/form-automation.sh +64 -0
  67. package/templates/.claude/skills/algorithmic-art/LICENSE.txt +202 -0
  68. package/templates/.claude/skills/algorithmic-art/SKILL.md +405 -0
  69. package/templates/.claude/skills/algorithmic-art/templates/generator_template.js +223 -0
  70. package/templates/.claude/skills/algorithmic-art/templates/viewer.html +599 -0
  71. package/templates/.claude/skills/asset-validator/SKILL.md +376 -0
  72. package/templates/.claude/skills/audio-video-sync/SKILL.md +219 -0
  73. package/templates/.claude/skills/bgm-manager/SKILL.md +334 -0
  74. package/templates/.claude/skills/remotion-best-practices/SKILL.md +45 -0
  75. package/templates/.claude/skills/remotion-best-practices/rules/3d.md +86 -0
  76. package/templates/.claude/skills/remotion-best-practices/rules/animations.md +29 -0
  77. package/templates/.claude/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
  78. package/templates/.claude/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
  79. package/templates/.claude/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +108 -0
  80. package/templates/.claude/skills/remotion-best-practices/rules/assets.md +78 -0
  81. package/templates/.claude/skills/remotion-best-practices/rules/audio.md +172 -0
  82. package/templates/.claude/skills/remotion-best-practices/rules/calculate-metadata.md +104 -0
  83. package/templates/.claude/skills/remotion-best-practices/rules/can-decode.md +75 -0
  84. package/templates/.claude/skills/remotion-best-practices/rules/charts.md +58 -0
  85. package/templates/.claude/skills/remotion-best-practices/rules/compositions.md +141 -0
  86. package/templates/.claude/skills/remotion-best-practices/rules/display-captions.md +126 -0
  87. package/templates/.claude/skills/remotion-best-practices/rules/extract-frames.md +229 -0
  88. package/templates/.claude/skills/remotion-best-practices/rules/fonts.md +152 -0
  89. package/templates/.claude/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
  90. package/templates/.claude/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
  91. package/templates/.claude/skills/remotion-best-practices/rules/get-video-duration.md +58 -0
  92. package/templates/.claude/skills/remotion-best-practices/rules/gifs.md +138 -0
  93. package/templates/.claude/skills/remotion-best-practices/rules/images.md +130 -0
  94. package/templates/.claude/skills/remotion-best-practices/rules/import-srt-captions.md +67 -0
  95. package/templates/.claude/skills/remotion-best-practices/rules/lottie.md +68 -0
  96. package/templates/.claude/skills/remotion-best-practices/rules/maps.md +403 -0
  97. package/templates/.claude/skills/remotion-best-practices/rules/measuring-dom-nodes.md +35 -0
  98. package/templates/.claude/skills/remotion-best-practices/rules/measuring-text.md +143 -0
  99. package/templates/.claude/skills/remotion-best-practices/rules/parameters.md +98 -0
  100. package/templates/.claude/skills/remotion-best-practices/rules/sequencing.md +118 -0
  101. package/templates/.claude/skills/remotion-best-practices/rules/tailwind.md +11 -0
  102. package/templates/.claude/skills/remotion-best-practices/rules/text-animations.md +20 -0
  103. package/templates/.claude/skills/remotion-best-practices/rules/timing.md +179 -0
  104. package/templates/.claude/skills/remotion-best-practices/rules/transcribe-captions.md +19 -0
  105. package/templates/.claude/skills/remotion-best-practices/rules/transitions.md +122 -0
  106. package/templates/.claude/skills/remotion-best-practices/rules/trimming.md +53 -0
  107. package/templates/.claude/skills/remotion-best-practices/rules/videos.md +171 -0
  108. package/templates/.claude/skills/remotion-components/SKILL.md +453 -0
  109. package/templates/.claude/skills/render-config/SKILL.md +290 -0
  110. package/templates/.claude/skills/script-writer/SKILL.md +59 -0
  111. package/templates/.claude/skills/style-director/script-writer/SKILL.md +82 -0
  112. package/templates/.claude/skills/style-director/style-director/SKILL.md +287 -0
  113. package/templates/.claude/skills/style-director/style-director/references/audience-and-scenarios.md +43 -0
  114. package/templates/.claude/skills/style-director/style-director/references/interaction-innovation.md +26 -0
  115. package/templates/.claude/skills/style-director/style-director/references/motion-grammar.md +66 -0
  116. package/templates/.claude/skills/style-director/style-director/references/quality-checklist.md +29 -0
  117. package/templates/.claude/skills/style-director/style-director/references/scene-recipes.md +38 -0
  118. package/templates/.claude/skills/style-director/style-director/references/visual-style-system.md +148 -0
  119. package/templates/.claude/skills/subtitle-composer/SKILL.md +304 -0
  120. package/templates/.claude/skills/subtitle-processor/SKILL.md +308 -0
  121. package/templates/.claude/skills/timeline-generator/SKILL.md +253 -0
  122. package/templates/.claude/skills/video-preflight-check/SKILL.md +353 -0
  123. package/templates/.claude/skills/voice-synthesizer/SKILL.md +296 -0
  124. package/templates/.claude/skills/voice-synthesizer/scripts/synthesize_voice.py +315 -0
  125. package/templates/.claude/skills/voice-synthesizer/scripts/tts_cli.py +142 -0
  126. package/templates/.claude/skills/web-design-guidelines/SKILL.md +36 -0
  127. package/templates/.claude/skills/youtube-downloader/SKILL.md +99 -0
  128. package/templates/.claude/skills/youtube-downloader/scripts/download_video.py +145 -0
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: sequencing
3
+ description: Sequencing patterns for Remotion - delay, trim, limit duration of items
4
+ metadata:
5
+ tags: sequence, series, timing, delay, trim
6
+ ---
7
+
8
+ Use `<Sequence>` to delay when an element appears in the timeline.
9
+
10
+ ```tsx
11
+ import { Sequence } from "remotion";
12
+
13
+ const {fps} = useVideoConfig();
14
+
15
+ <Sequence from={1 * fps} durationInFrames={2 * fps} premountFor={1 * fps}>
16
+ <Title />
17
+ </Sequence>
18
+ <Sequence from={2 * fps} durationInFrames={2 * fps} premountFor={1 * fps}>
19
+ <Subtitle />
20
+ </Sequence>
21
+ ```
22
+
23
+ This will by default wrap the component in an absolute fill element.
24
+ If the items should not be wrapped, use the `layout` prop:
25
+
26
+ ```tsx
27
+ <Sequence layout="none">
28
+ <Title />
29
+ </Sequence>
30
+ ```
31
+
32
+ ## Premounting
33
+
34
+ This loads the component in the timeline before it is actually played.
35
+ Always premount any `<Sequence>`!
36
+
37
+ ```tsx
38
+ <Sequence premountFor={1 * fps}>
39
+ <Title />
40
+ </Sequence>
41
+ ```
42
+
43
+ ## Series
44
+
45
+ Use `<Series>` when elements should play one after another without overlap.
46
+
47
+ ```tsx
48
+ import {Series} from 'remotion';
49
+
50
+ <Series>
51
+ <Series.Sequence durationInFrames={45}>
52
+ <Intro />
53
+ </Series.Sequence>
54
+ <Series.Sequence durationInFrames={60}>
55
+ <MainContent />
56
+ </Series.Sequence>
57
+ <Series.Sequence durationInFrames={30}>
58
+ <Outro />
59
+ </Series.Sequence>
60
+ </Series>;
61
+ ```
62
+
63
+ Same as with `<Sequence>`, the items will be wrapped in an absolute fill element by default when using `<Series.Sequence>`, unless the `layout` prop is set to `none`.
64
+
65
+ ### Series with overlaps
66
+
67
+ Use negative offset for overlapping sequences:
68
+
69
+ ```tsx
70
+ <Series>
71
+ <Series.Sequence durationInFrames={60}>
72
+ <SceneA />
73
+ </Series.Sequence>
74
+ <Series.Sequence offset={-15} durationInFrames={60}>
75
+ {/* Starts 15 frames before SceneA ends */}
76
+ <SceneB />
77
+ </Series.Sequence>
78
+ </Series>
79
+ ```
80
+
81
+ ## Frame References Inside Sequences
82
+
83
+ Inside a Sequence, `useCurrentFrame()` returns the local frame (starting from 0):
84
+
85
+ ```tsx
86
+ <Sequence from={60} durationInFrames={30}>
87
+ <MyComponent />
88
+ {/* Inside MyComponent, useCurrentFrame() returns 0-29, not 60-89 */}
89
+ </Sequence>
90
+ ```
91
+
92
+ ## Nested Sequences
93
+
94
+ Sequences can be nested for complex timing:
95
+
96
+ ```tsx
97
+ <Sequence from={0} durationInFrames={120}>
98
+ <Background />
99
+ <Sequence from={15} durationInFrames={90} layout="none">
100
+ <Title />
101
+ </Sequence>
102
+ <Sequence from={45} durationInFrames={60} layout="none">
103
+ <Subtitle />
104
+ </Sequence>
105
+ </Sequence>
106
+ ```
107
+
108
+ ## Nesting compositions within another
109
+
110
+ To add a composition within another composition, you can use the `<Sequence>` component with a `width` and `height` prop to specify the size of the composition.
111
+
112
+ ```tsx
113
+ <AbsoluteFill>
114
+ <Sequence width={COMPOSITION_WIDTH} height={COMPOSITION_HEIGHT}>
115
+ <CompositionComponent />
116
+ </Sequence>
117
+ </AbsoluteFill>
118
+ ```
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: tailwind
3
+ description: Using TailwindCSS in Remotion.
4
+ metadata:
5
+ ---
6
+
7
+ You can and should use TailwindCSS in Remotion, if TailwindCSS is installed in the project.
8
+
9
+ Don't use `transition-*` or `animate-*` classes - always animate using the `useCurrentFrame()` hook.
10
+
11
+ Tailwind must be installed and enabled first in a Remotion project - fetch https://www.remotion.dev/docs/tailwind using WebFetch for instructions.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: text-animations
3
+ description: Typography and text animation patterns for Remotion.
4
+ metadata:
5
+ tags: typography, text, typewriter, highlighter ken
6
+ ---
7
+
8
+ ## Text animations
9
+
10
+ Based on `useCurrentFrame()`, reduce the string character by character to create a typewriter effect.
11
+
12
+ ## Typewriter Effect
13
+
14
+ See [Typewriter](assets/text-animations-typewriter.tsx) for an advanced example with a blinking cursor and a pause after the first sentence.
15
+
16
+ Always use string slicing for typewriter effects. Never use per-character opacity.
17
+
18
+ ## Word Highlighting
19
+
20
+ See [Word Highlight](assets/text-animations-word-highlight.tsx) for an example for how a word highlight is animated, like with a highlighter pen.
@@ -0,0 +1,179 @@
1
+ ---
2
+ name: timing
3
+ description: Interpolation curves in Remotion - linear, easing, spring animations
4
+ metadata:
5
+ tags: spring, bounce, easing, interpolation
6
+ ---
7
+
8
+ A simple linear interpolation is done using the `interpolate` function.
9
+
10
+ ```ts title="Going from 0 to 1 over 100 frames"
11
+ import {interpolate} from 'remotion';
12
+
13
+ const opacity = interpolate(frame, [0, 100], [0, 1]);
14
+ ```
15
+
16
+ By default, the values are not clamped, so the value can go outside the range [0, 1].
17
+ Here is how they can be clamped:
18
+
19
+ ```ts title="Going from 0 to 1 over 100 frames with extrapolation"
20
+ const opacity = interpolate(frame, [0, 100], [0, 1], {
21
+ extrapolateRight: 'clamp',
22
+ extrapolateLeft: 'clamp',
23
+ });
24
+ ```
25
+
26
+ ## Spring animations
27
+
28
+ Spring animations have a more natural motion.
29
+ They go from 0 to 1 over time.
30
+
31
+ ```ts title="Spring animation from 0 to 1 over 100 frames"
32
+ import {spring, useCurrentFrame, useVideoConfig} from 'remotion';
33
+
34
+ const frame = useCurrentFrame();
35
+ const {fps} = useVideoConfig();
36
+
37
+ const scale = spring({
38
+ frame,
39
+ fps,
40
+ });
41
+ ```
42
+
43
+ ### Physical properties
44
+
45
+ The default configuration is: `mass: 1, damping: 10, stiffness: 100`.
46
+ This leads to the animation having a bit of bounce before it settles.
47
+
48
+ The config can be overwritten like this:
49
+
50
+ ```ts
51
+ const scale = spring({
52
+ frame,
53
+ fps,
54
+ config: {damping: 200},
55
+ });
56
+ ```
57
+
58
+ The recommended configuration for a natural motion without a bounce is: `{ damping: 200 }`.
59
+
60
+ Here are some common configurations:
61
+
62
+ ```tsx
63
+ const smooth = {damping: 200}; // Smooth, no bounce (subtle reveals)
64
+ const snappy = {damping: 20, stiffness: 200}; // Snappy, minimal bounce (UI elements)
65
+ const bouncy = {damping: 8}; // Bouncy entrance (playful animations)
66
+ const heavy = {damping: 15, stiffness: 80, mass: 2}; // Heavy, slow, small bounce
67
+ ```
68
+
69
+ ### Delay
70
+
71
+ The animation starts immediately by default.
72
+ Use the `delay` parameter to delay the animation by a number of frames.
73
+
74
+ ```tsx
75
+ const entrance = spring({
76
+ frame: frame - ENTRANCE_DELAY,
77
+ fps,
78
+ delay: 20,
79
+ });
80
+ ```
81
+
82
+ ### Duration
83
+
84
+ A `spring()` has a natural duration based on the physical properties.
85
+ To stretch the animation to a specific duration, use the `durationInFrames` parameter.
86
+
87
+ ```tsx
88
+ const spring = spring({
89
+ frame,
90
+ fps,
91
+ durationInFrames: 40,
92
+ });
93
+ ```
94
+
95
+ ### Combining spring() with interpolate()
96
+
97
+ Map spring output (0-1) to custom ranges:
98
+
99
+ ```tsx
100
+ const springProgress = spring({
101
+ frame,
102
+ fps,
103
+ });
104
+
105
+ // Map to rotation
106
+ const rotation = interpolate(springProgress, [0, 1], [0, 360]);
107
+
108
+ <div style={{rotate: rotation + 'deg'}} />;
109
+ ```
110
+
111
+ ### Adding springs
112
+
113
+ Springs return just numbers, so math can be performed:
114
+
115
+ ```tsx
116
+ const frame = useCurrentFrame();
117
+ const {fps, durationInFrames} = useVideoConfig();
118
+
119
+ const inAnimation = spring({
120
+ frame,
121
+ fps,
122
+ });
123
+ const outAnimation = spring({
124
+ frame,
125
+ fps,
126
+ durationInFrames: 1 * fps,
127
+ delay: durationInFrames - 1 * fps,
128
+ });
129
+
130
+ const scale = inAnimation - outAnimation;
131
+ ```
132
+
133
+ ## Easing
134
+
135
+ Easing can be added to the `interpolate` function:
136
+
137
+ ```ts
138
+ import {interpolate, Easing} from 'remotion';
139
+
140
+ const value1 = interpolate(frame, [0, 100], [0, 1], {
141
+ easing: Easing.inOut(Easing.quad),
142
+ extrapolateLeft: 'clamp',
143
+ extrapolateRight: 'clamp',
144
+ });
145
+ ```
146
+
147
+ The default easing is `Easing.linear`.
148
+ There are various other convexities:
149
+
150
+ - `Easing.in` for starting slow and accelerating
151
+ - `Easing.out` for starting fast and slowing down
152
+ - `Easing.inOut`
153
+
154
+ and curves (sorted from most linear to most curved):
155
+
156
+ - `Easing.quad`
157
+ - `Easing.sin`
158
+ - `Easing.exp`
159
+ - `Easing.circle`
160
+
161
+ Convexities and curves need be combined for an easing function:
162
+
163
+ ```ts
164
+ const value1 = interpolate(frame, [0, 100], [0, 1], {
165
+ easing: Easing.inOut(Easing.quad),
166
+ extrapolateLeft: 'clamp',
167
+ extrapolateRight: 'clamp',
168
+ });
169
+ ```
170
+
171
+ Cubic bezier curves are also supported:
172
+
173
+ ```ts
174
+ const value1 = interpolate(frame, [0, 100], [0, 1], {
175
+ easing: Easing.bezier(0.8, 0.22, 0.96, 0.65),
176
+ extrapolateLeft: 'clamp',
177
+ extrapolateRight: 'clamp',
178
+ });
179
+ ```
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: transcribe-captions
3
+ description: Transcribing audio to generate captions in Remotion
4
+ metadata:
5
+ tags: captions, transcribe, whisper, audio, speech-to-text
6
+ ---
7
+
8
+ # Transcribing audio
9
+
10
+ Remotion provides several built-in options for transcribing audio to generate captions:
11
+
12
+ - `@remotion/install-whisper-cpp` - Transcribe locally on a server using Whisper.cpp. Fast and free, but requires server infrastructure.
13
+ https://remotion.dev/docs/install-whisper-cpp
14
+
15
+ - `@remotion/whisper-web` - Transcribe in the browser using WebAssembly. No server needed and free, but slower due to WASM overhead.
16
+ https://remotion.dev/docs/whisper-web
17
+
18
+ - `@remotion/openai-whisper` - Use OpenAI Whisper API for cloud-based transcription. Fast and no server needed, but requires payment.
19
+ https://remotion.dev/docs/openai-whisper/openai-whisper-api-to-captions
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: transitions
3
+ description: Fullscreen scene transitions for Remotion.
4
+ metadata:
5
+ tags: transitions, fade, slide, wipe, scenes
6
+ ---
7
+
8
+ ## Fullscreen transitions
9
+
10
+ Using `<TransitionSeries>` to animate between multiple scenes or clips.
11
+ This will absolutely position the children.
12
+
13
+ ## Prerequisites
14
+
15
+ First, the @remotion/transitions package needs to be installed.
16
+ If it is not, use the following command:
17
+
18
+ ```bash
19
+ npx remotion add @remotion/transitions # If project uses npm
20
+ bunx remotion add @remotion/transitions # If project uses bun
21
+ yarn remotion add @remotion/transitions # If project uses yarn
22
+ pnpm exec remotion add @remotion/transitions # If project uses pnpm
23
+ ```
24
+
25
+ ## Example usage
26
+
27
+ ```tsx
28
+ import {TransitionSeries, linearTiming} from '@remotion/transitions';
29
+ import {fade} from '@remotion/transitions/fade';
30
+
31
+ <TransitionSeries>
32
+ <TransitionSeries.Sequence durationInFrames={60}>
33
+ <SceneA />
34
+ </TransitionSeries.Sequence>
35
+ <TransitionSeries.Transition presentation={fade()} timing={linearTiming({durationInFrames: 15})} />
36
+ <TransitionSeries.Sequence durationInFrames={60}>
37
+ <SceneB />
38
+ </TransitionSeries.Sequence>
39
+ </TransitionSeries>;
40
+ ```
41
+
42
+ ## Available Transition Types
43
+
44
+ Import transitions from their respective modules:
45
+
46
+ ```tsx
47
+ import {fade} from '@remotion/transitions/fade';
48
+ import {slide} from '@remotion/transitions/slide';
49
+ import {wipe} from '@remotion/transitions/wipe';
50
+ import {flip} from '@remotion/transitions/flip';
51
+ import {clockWipe} from '@remotion/transitions/clock-wipe';
52
+ ```
53
+
54
+ ## Slide Transition with Direction
55
+
56
+ Specify slide direction for enter/exit animations.
57
+
58
+ ```tsx
59
+ import {slide} from '@remotion/transitions/slide';
60
+
61
+ <TransitionSeries.Transition presentation={slide({direction: 'from-left'})} timing={linearTiming({durationInFrames: 20})} />;
62
+ ```
63
+
64
+ Directions: `"from-left"`, `"from-right"`, `"from-top"`, `"from-bottom"`
65
+
66
+ ## Timing Options
67
+
68
+ ```tsx
69
+ import {linearTiming, springTiming} from '@remotion/transitions';
70
+
71
+ // Linear timing - constant speed
72
+ linearTiming({durationInFrames: 20});
73
+
74
+ // Spring timing - organic motion
75
+ springTiming({config: {damping: 200}, durationInFrames: 25});
76
+ ```
77
+
78
+ ## Duration calculation
79
+
80
+ Transitions overlap adjacent scenes, so the total composition length is **shorter** than the sum of all sequence durations.
81
+
82
+ For example, with two 60-frame sequences and a 15-frame transition:
83
+
84
+ - Without transitions: `60 + 60 = 120` frames
85
+ - With transition: `60 + 60 - 15 = 105` frames
86
+
87
+ The transition duration is subtracted because both scenes play simultaneously during the transition.
88
+
89
+ ### Getting the duration of a transition
90
+
91
+ Use the `getDurationInFrames()` method on the timing object:
92
+
93
+ ```tsx
94
+ import {linearTiming, springTiming} from '@remotion/transitions';
95
+
96
+ const linearDuration = linearTiming({durationInFrames: 20}).getDurationInFrames({fps: 30});
97
+ // Returns 20
98
+
99
+ const springDuration = springTiming({config: {damping: 200}}).getDurationInFrames({fps: 30});
100
+ // Returns calculated duration based on spring physics
101
+ ```
102
+
103
+ For `springTiming` without an explicit `durationInFrames`, the duration depends on `fps` because it calculates when the spring animation settles.
104
+
105
+ ### Calculating total composition duration
106
+
107
+ ```tsx
108
+ import {linearTiming} from '@remotion/transitions';
109
+
110
+ const scene1Duration = 60;
111
+ const scene2Duration = 60;
112
+ const scene3Duration = 60;
113
+
114
+ const timing1 = linearTiming({durationInFrames: 15});
115
+ const timing2 = linearTiming({durationInFrames: 20});
116
+
117
+ const transition1Duration = timing1.getDurationInFrames({fps: 30});
118
+ const transition2Duration = timing2.getDurationInFrames({fps: 30});
119
+
120
+ const totalDuration = scene1Duration + scene2Duration + scene3Duration - transition1Duration - transition2Duration;
121
+ // 60 + 60 + 60 - 15 - 20 = 145 frames
122
+ ```
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: trimming
3
+ description: Trimming patterns for Remotion - cut the beginning or end of animations
4
+ metadata:
5
+ tags: sequence, trim, clip, cut, offset
6
+ ---
7
+
8
+ Use `<Sequence>` with a negative `from` value to trim the start of an animation.
9
+
10
+ ## Trim the Beginning
11
+
12
+ A negative `from` value shifts time backwards, making the animation start partway through:
13
+
14
+ ```tsx
15
+ import { Sequence, useVideoConfig } from "remotion";
16
+
17
+ const fps = useVideoConfig();
18
+
19
+ <Sequence from={-0.5 * fps}>
20
+ <MyAnimation />
21
+ </Sequence>
22
+ ```
23
+
24
+ The animation appears 15 frames into its progress - the first 15 frames are trimmed off.
25
+ Inside `<MyAnimation>`, `useCurrentFrame()` starts at 15 instead of 0.
26
+
27
+ ## Trim the End
28
+
29
+ Use `durationInFrames` to unmount content after a specified duration:
30
+
31
+ ```tsx
32
+
33
+ <Sequence durationInFrames={1.5 * fps}>
34
+ <MyAnimation />
35
+ </Sequence>
36
+ ```
37
+
38
+ The animation plays for 45 frames, then the component unmounts.
39
+
40
+ ## Trim and Delay
41
+
42
+ Nest sequences to both trim the beginning and delay when it appears:
43
+
44
+ ```tsx
45
+ <Sequence from={30}>
46
+ <Sequence from={-15}>
47
+ <MyAnimation />
48
+ </Sequence>
49
+ </Sequence>
50
+ ```
51
+
52
+ The inner sequence trims 15 frames from the start, and the outer sequence delays the result by 30 frames.
53
+
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: videos
3
+ description: Embedding videos in Remotion - trimming, volume, speed, looping, pitch
4
+ metadata:
5
+ tags: video, media, trim, volume, speed, loop, pitch
6
+ ---
7
+
8
+ # Using videos in Remotion
9
+
10
+ ## Prerequisites
11
+
12
+ First, the @remotion/media package needs to be installed.
13
+ If it is not, use the following command:
14
+
15
+ ```bash
16
+ npx remotion add @remotion/media # If project uses npm
17
+ bunx remotion add @remotion/media # If project uses bun
18
+ yarn remotion add @remotion/media # If project uses yarn
19
+ pnpm exec remotion add @remotion/media # If project uses pnpm
20
+ ```
21
+
22
+ Use `<Video>` from `@remotion/media` to embed videos into your composition.
23
+
24
+ ```tsx
25
+ import { Video } from "@remotion/media";
26
+ import { staticFile } from "remotion";
27
+
28
+ export const MyComposition = () => {
29
+ return <Video src={staticFile("video.mp4")} />;
30
+ };
31
+ ```
32
+
33
+ Remote URLs are also supported:
34
+
35
+ ```tsx
36
+ <Video src="https://remotion.media/video.mp4" />
37
+ ```
38
+
39
+ ## Trimming
40
+
41
+ Use `trimBefore` and `trimAfter` to remove portions of the video. Values are in seconds.
42
+
43
+ ```tsx
44
+ const { fps } = useVideoConfig();
45
+
46
+ return (
47
+ <Video
48
+ src={staticFile("video.mp4")}
49
+ trimBefore={2 * fps} // Skip the first 2 seconds
50
+ trimAfter={10 * fps} // End at the 10 second mark
51
+ />
52
+ );
53
+ ```
54
+
55
+ ## Delaying
56
+
57
+ Wrap the video in a `<Sequence>` to delay when it appears:
58
+
59
+ ```tsx
60
+ import { Sequence, staticFile } from "remotion";
61
+ import { Video } from "@remotion/media";
62
+
63
+ const { fps } = useVideoConfig();
64
+
65
+ return (
66
+ <Sequence from={1 * fps}>
67
+ <Video src={staticFile("video.mp4")} />
68
+ </Sequence>
69
+ );
70
+ ```
71
+
72
+ The video will appear after 1 second.
73
+
74
+ ## Sizing and Position
75
+
76
+ Use the `style` prop to control size and position:
77
+
78
+ ```tsx
79
+ <Video
80
+ src={staticFile("video.mp4")}
81
+ style={{
82
+ width: 500,
83
+ height: 300,
84
+ position: "absolute",
85
+ top: 100,
86
+ left: 50,
87
+ objectFit: "cover",
88
+ }}
89
+ />
90
+ ```
91
+
92
+ ## Volume
93
+
94
+ Set a static volume (0 to 1):
95
+
96
+ ```tsx
97
+ <Video src={staticFile("video.mp4")} volume={0.5} />
98
+ ```
99
+
100
+ Or use a callback for dynamic volume based on the current frame:
101
+
102
+ ```tsx
103
+ import { interpolate } from "remotion";
104
+
105
+ const { fps } = useVideoConfig();
106
+
107
+ return (
108
+ <Video
109
+ src={staticFile("video.mp4")}
110
+ volume={(f) =>
111
+ interpolate(f, [0, 1 * fps], [0, 1], { extrapolateRight: "clamp" })
112
+ }
113
+ />
114
+ );
115
+ ```
116
+
117
+ Use `muted` to silence the video entirely:
118
+
119
+ ```tsx
120
+ <Video src={staticFile("video.mp4")} muted />
121
+ ```
122
+
123
+ ## Speed
124
+
125
+ Use `playbackRate` to change the playback speed:
126
+
127
+ ```tsx
128
+ <Video src={staticFile("video.mp4")} playbackRate={2} /> {/* 2x speed */}
129
+ <Video src={staticFile("video.mp4")} playbackRate={0.5} /> {/* Half speed */}
130
+ ```
131
+
132
+ Reverse playback is not supported.
133
+
134
+ ## Looping
135
+
136
+ Use `loop` to loop the video indefinitely:
137
+
138
+ ```tsx
139
+ <Video src={staticFile("video.mp4")} loop />
140
+ ```
141
+
142
+ Use `loopVolumeCurveBehavior` to control how the frame count behaves when looping:
143
+
144
+ - `"repeat"`: Frame count resets to 0 each loop (for `volume` callback)
145
+ - `"extend"`: Frame count continues incrementing
146
+
147
+ ```tsx
148
+ <Video
149
+ src={staticFile("video.mp4")}
150
+ loop
151
+ loopVolumeCurveBehavior="extend"
152
+ volume={(f) => interpolate(f, [0, 300], [1, 0])} // Fade out over multiple loops
153
+ />
154
+ ```
155
+
156
+ ## Pitch
157
+
158
+ Use `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:
159
+
160
+ ```tsx
161
+ <Video
162
+ src={staticFile("video.mp4")}
163
+ toneFrequency={1.5} // Higher pitch
164
+ />
165
+ <Video
166
+ src={staticFile("video.mp4")}
167
+ toneFrequency={0.8} // Lower pitch
168
+ />
169
+ ```
170
+
171
+ Pitch shifting only works during server-side rendering, not in the Remotion Studio preview or in the `<Player />`.