diff --git a/.claude/skills/remotion-video/SKILL.md b/.claude/skills/remotion-video/SKILL.md index 8a2d9b6..4da80c2 100644 --- a/.claude/skills/remotion-video/SKILL.md +++ b/.claude/skills/remotion-video/SKILL.md @@ -87,6 +87,7 @@ Copy-paste starting points. Read the one that fits: - `templates/captions.md` - words highlighted in time with speech - `templates/charts.md` - animated bar chart - `templates/intro-outro.md` - title card + chaining scenes with `Series` +- `templates/audio-voiceover.md` - background music, voiceover, auto video length - `templates/vertical.md` - 1080x1920 clips for Reels/TikTok/Shorts ## Docs diff --git a/.claude/skills/remotion-video/templates/audio-voiceover.md b/.claude/skills/remotion-video/templates/audio-voiceover.md new file mode 100644 index 0000000..3d9cbfc --- /dev/null +++ b/.claude/skills/remotion-video/templates/audio-voiceover.md @@ -0,0 +1,62 @@ +# Template: Audio, music and voiceover + +Put sound files in `public/` (mp3 or wav). Load them with `staticFile()`. + +`src/Narrated.tsx` +```tsx +import { AbsoluteFill, Audio, Sequence, interpolate, staticFile, useVideoConfig } from "remotion"; +import { getAudioDurationInSeconds } from "@remotion/media-utils"; +import type { CalculateMetadataFunction } from "remotion"; + +type Props = { title: string; voice: string; music: string }; + +// Make the video exactly as long as the voiceover (+1 second of padding). +export const calcNarratedMetadata: CalculateMetadataFunction = async ({ props }) => { + const seconds = await getAudioDurationInSeconds(staticFile(props.voice)); + return { durationInFrames: Math.ceil((seconds + 1) * 30) }; +}; + +export const Narrated = ({ title, voice, music }: Props) => { + const { fps, durationInFrames } = useVideoConfig(); + return ( + +

{title}

+ + {/* Background music: quiet, fades out over the last second. */} +
+ ); +}; +``` + +Register it (note `calculateMetadata`): +```tsx + +``` + +Install: `npm i @remotion/media-utils` + +Getting a voiceover +- Record yourself, or generate speech with a text-to-speech service, and save as `public/voice.mp3`. Never commit API keys; keep them in environment variables. +- Pair with `templates/captions.md`: feed it word timings from a transcription of the same file. + +Rules +- Music volume 0.1-0.2 so the voice stays clear. +- `` delays when a sound starts. +- Audio is only in the final render (mp4). Stills (`remotion still`) have no sound. +- Check the sound made it in: `ffprobe out/video.mp4` should list an `Audio:` stream.