Index of every page on this site: llms.txt
All skills
vois-so avatar

/remotion-voiceover

@e0e7827
by vois.sovois-so/skills1 stars
Run it yourself

Adds a scene-timed voiceover to a Remotion video with Vois Studio, on the user's computer. It writes the narration of each scene for the ear and renders one WAV for each scene into public/voiceover/ with vois-cli. Then it measures each take and writes a timing manifest (seconds, and frames at the composition fps). The composition reads the manifest to set each scene length and to put each clip in a Sequence with Audio and staticFile. Use when the user asks to "add a voiceover to my Remotion video", "narrate these scenes", "time the scenes to the narration", "make TTS for Remotion", or "use Vois instead of ElevenLabs in Remotion". A Vois Studio plan with CLI file output is necessary, for example Pro. For directions in plain words, use Omni or Craft on Pro.

  • 7 files
  • 58.5 KB
  • MIT
  • Updated 3 weeks ago
  • GitHub
Use this Skill: https://skilld.dev/gh/vois-so/skills/remotion-voiceover

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesremotion-code.md

≈1.7k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Remotion code for the voiceover manifest

These examples use Remotion 4.0.520. They read src/voiceover.json from the script.

Audio import

Audio from @remotion/media is the current component. In remotion, Audio is a deprecated name for Html5Audio.

npx remotion add @remotion/media

If you cannot add a package, use Html5Audio from remotion. The props in these examples are the same.

import { Html5Audio as Audio } from 'remotion';

One component for each scene line

// src/SceneVoice.tsx
import React from 'react';
import { Sequence, staticFile } from 'remotion';
import { Audio } from '@remotion/media';
import voiceover from './voiceover.json';

export type VoiceScene = (typeof voiceover.scenes)[number];

export const SceneVoice: React.FC<{ scene: VoiceScene; volume?: number }> = ({ scene, volume = 1 }) => (
  <Sequence from={scene.leadFrames} durationInFrames={scene.durationFrames} name={`VO ${scene.id}`} layout="none">
    <Audio src={staticFile(scene.file)} volume={volume} />
  </Sequence>
);

layout="none" keeps the audio Sequence out of the layout. The Sequence starts leadFrames after the scene starts.

Scenes one after the other

// src/Explainer.tsx
import React from 'react';
import { AbsoluteFill, Series } from 'remotion';
import { SceneVoice } from './SceneVoice';
import voiceover from './voiceover.json';
import { Intro, How } from './scenes';

const VISUALS: Record<string, React.FC> = { intro: Intro, how: How };

export const Explainer: React.FC = () => (
  <AbsoluteFill style={{ backgroundColor: 'white' }}>
    <Series>
      {voiceover.scenes.map((scene) => {
        const Visual = VISUALS[scene.id];
        return (
          <Series.Sequence key={scene.id} durationInFrames={scene.sceneFrames} name={scene.id}>
            {Visual ? <Visual /> : null}
            <SceneVoice scene={scene} />
          </Series.Sequence>
        );
      })}
    </Series>
  </AbsoluteFill>
);

In a scene component, useCurrentFrame() starts at 0 at the scene start. The voice starts at frame scene.leadFrames.

The composition

// src/Root.tsx
import React from 'react';
import { Composition } from 'remotion';
import { Explainer } from './Explainer';
import voiceover from './voiceover.json';

export const RemotionRoot: React.FC = () => (
  <Composition
    id="Explainer"
    component={Explainer}
    durationInFrames={voiceover.totalFrames}
    fps={voiceover.fps}
    width={1920}
    height={1080}
  />
);

Set "resolveJsonModule": true in tsconfig.json for the JSON import. Remotion Studio loads the manifest again when the script writes it.

Without a JSON import: calculateMetadata

Use this when the manifest must stay in public/, for example when a different tool writes it. Start the script with --manifest public/voiceover/voiceover.json.

import { CalculateMetadataFunction, Composition, staticFile } from 'remotion';

type Manifest = { fps: number; totalFrames: number; scenes: { id: string; file: string; leadFrames: number; durationFrames: number; sceneFrames: number }[] };
type Props = { manifest: Manifest | null };

const calculateMetadata: CalculateMetadataFunction<Props> = async ({ abortSignal }) => {
  const manifest: Manifest = await fetch(staticFile('voiceover/voiceover.json'), { signal: abortSignal }).then((r) => r.json());
  return { durationInFrames: manifest.totalFrames, fps: manifest.fps, props: { manifest } };
};

<Composition id="Explainer" component={Explainer} width={1920} height={1080} defaultProps={{ manifest: null }} calculateMetadata={calculateMetadata} />;

The component then reads props.manifest.scenes.

Scene changes with an overlap

A scene change in @remotion/transitions (TransitionSeries) makes two scenes overlap. The composition becomes shorter than totalFrames. Keep the voice on its own layer with absolute frames. Then a scene change cannot move or cut a line:

import { Sequence, staticFile } from 'remotion';
import { Audio } from '@remotion/media';

const OVERLAP = 15; // frames of each transition

export const VoiceTrack: React.FC = () => (
  <>
    {voiceover.scenes.map((scene, i) => (
      <Sequence key={scene.id} from={scene.startFrame - i * OVERLAP + scene.leadFrames} durationInFrames={scene.durationFrames} layout="none">
        <Audio src={staticFile(scene.file)} />
      </Sequence>
    ))}
  </>
);

Use durationInFrames={voiceover.totalFrames - (voiceover.scenes.length - 1) * OVERLAP} for the composition. Make lead and tail longer than half of the overlap. This prevents two lines at the same time.

Music below the voice

Put the music on its own layer. Lower it while the voice speaks:

import { interpolate, Sequence, staticFile } from 'remotion';
import { Audio } from '@remotion/media';

const spans = voiceover.scenes.map((s) => [s.startFrame + s.leadFrames, s.startFrame + s.leadFrames + s.durationFrames]);
const musicVolume = (f: number) => {
  const inVoice = spans.some(([a, b]) => f >= a - 8 && f <= b + 8);
  return inVoice ? 0.12 : 0.35;
};

<Audio src={staticFile('music/bed.mp3')} volume={(f) => musicVolume(f)} />;

For a smooth change, use interpolate() in the 8 frames at each end of a span.

Captions

Each scene has captions in the Caption shape of @remotion/captions. The times are in milliseconds from the scene start, and they are estimates.

import { createTikTokStyleCaptions } from '@remotion/captions';
import { useCurrentFrame, useVideoConfig } from 'remotion';

export const SceneCaptions: React.FC<{ scene: VoiceScene }> = ({ scene }) => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();
  const { pages } = createTikTokStyleCaptions({ captions: scene.captions, combineTokensWithinMilliseconds: 800 });
  const ms = (frame / fps) * 1000;
  const page = pages.find((p) => ms >= p.startMs && ms < p.startMs + p.durationMs);
  return page ? <div style={{ position: 'absolute', bottom: 80, width: '100%', textAlign: 'center', fontSize: 48 }}>{page.text}</div> : null;
};

Put <SceneCaptions scene={scene} /> in each Series.Sequence. Install the package with npx remotion add @remotion/captions.

Check the render

npx remotion render Explainer out/explainer.mp4
ffprobe -v error -show_entries stream=codec_type:format=duration -of compact out/explainer.mp4
ffmpeg -i out/explainer.mp4 -af silencedetect=n=-40dB:d=0.3 -f null - 2>&1 | grep silence_

The length in format must be totalSeconds. The silence list shows the pauses between lines. Each pause must be near tail + lead of the two scenes.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at e0e7827. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 3 weeks ago
metadata
{
  "author": "vois-so",
  "version": "0.1.0"
}
Other metadata
compatibility
Vois Studio on an Apple Silicon Mac or Windows, vois-cli, Node.js 18+, and a Remotion 4 project.

README badge

README badge for vois-so/skills/remotion-voiceover