Skills2026年3月29日·1 分钟阅读

Remotion Rule: Subtitles

Remotion skill rule: subtitles and caption rules. Part of the official Remotion Agent Skill for programmatic video in React.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Remotion Rule: Subtitles
直接安装命令
npx -y tokrepo@latest install d43f84af-1581-4b02-9c0e-b8fef366a8ca --target codex

先 dry-run 确认安装计划,再运行此命令。

TL;DR
A Remotion agent rule that teaches AI assistants how to add subtitles to React-based videos.
§01

What it is

This Remotion rule defines how AI coding agents should generate subtitle and caption components in Remotion video projects. It is part of the official Remotion Agent Skill that teaches AI assistants the correct patterns for programmatic video creation in React.

The rule targets developers using AI code assistants (Claude Code, Cursor, etc.) to build Remotion video projects that include captions, subtitles, or text overlays.

§02

How it saves time or tokens

Without this rule, AI agents often generate incorrect subtitle timing, wrong component APIs, or deprecated Remotion patterns. The rule provides exact API signatures, timing calculations, and styling patterns so the agent produces working code on the first attempt, avoiding trial-and-error iterations.

§03

How to use

  1. Add the Remotion subtitles rule to your project's AI configuration (e.g., .cursorrules or CLAUDE.md).
  2. Ask your AI assistant to add subtitles to your Remotion composition.
  3. The agent follows the rule to generate correct subtitle components with proper timing.
§04

Example

import { useCurrentFrame, useVideoConfig, Sequence } from 'remotion';

const Subtitle: React.FC<{
  text: string;
  startFrame: number;
  durationInFrames: number;
}> = ({ text, startFrame, durationInFrames }) => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();
  const opacity = Math.min(1, (frame - startFrame) / (fps * 0.3));

  return (
    <Sequence from={startFrame} durationInFrames={durationInFrames}>
      <div style={{
        position: 'absolute',
        bottom: 80,
        width: '100%',
        textAlign: 'center',
        fontSize: 48,
        color: 'white',
        textShadow: '2px 2px 4px rgba(0,0,0,0.8)',
        opacity,
      }}>
        {text}
      </div>
    </Sequence>
  );
};
§05

Related on TokRepo

§06

Common pitfalls

  • Subtitle timing must use frame numbers, not seconds. Convert seconds to frames using Math.round(seconds * fps).
  • Always use the Sequence component for subtitle timing rather than conditional rendering based on frame count. Sequence handles cleanup and performance.
  • Font loading in Remotion requires explicit registration. Do not assume system fonts are available in the render environment.

常见问题

What is a Remotion rule?+

A Remotion rule is a configuration file that teaches AI coding assistants the correct patterns and APIs for Remotion video development. It prevents the AI from generating deprecated or incorrect code by providing exact signatures and best practices.

Does this rule work with any AI assistant?+

The rule works with any AI coding assistant that supports project-level instructions, including Claude Code (CLAUDE.md), Cursor (.cursorrules), and similar tools. The content is the same regardless of the assistant.

How do I sync subtitles with audio?+

Use a transcription service or manual timing to generate a list of text segments with start and end times in seconds. Convert these to frame numbers using the video's fps setting and pass them to the Subtitle component.

Can I style subtitles with custom fonts?+

Yes. Register custom fonts using Remotion's loadFont utility or the @remotion/google-fonts package. Apply the font family in the subtitle component's style object.

Does this rule handle multi-language subtitles?+

The rule provides the subtitle component pattern. Multi-language support is a data concern -- pass different text arrays for different languages to the same component structure.

引用来源 (3)
🙏

来源与感谢

Created by Remotion. Licensed under MIT. remotion-dev/skills — Rule: subtitles

Part of the Remotion AI Skill collection on TokRepo.

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产