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

Remotion Rule: Display Captions

Remotion skill rule: Displaying captions in Remotion with TikTok-style pages and word highlighting. Part of the official Remotion Agent Skill for programmatic video in React.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Remotion Rule: Display Captions
先审查命令
npx -y tokrepo@latest install b95ee0ef-b7ad-44e4-8c80-88622f358da7 --target codex

先 dry-run,确认写入项后再运行此命令。

TL;DR
Remotion skill for rendering TikTok-style captions with word-level highlighting and paged layouts in React video.
§01

What it is

This is a Remotion skill rule that teaches AI agents how to render captions in programmatic video. It implements TikTok-style paged captions with word-level highlighting that syncs to audio timing. The rule is part of the official Remotion Agent Skill for building video in React.

The skill targets developers and content creators using Remotion to produce short-form video (TikTok, YouTube Shorts, Reels) where synchronized captions are essential for engagement and accessibility.

§02

How it saves time or tokens

Manually timing caption highlights frame-by-frame is tedious. This skill rule provides the pattern for automatic word-level synchronization based on subtitle timing data. An AI agent following this rule generates the caption component correctly on the first attempt, avoiding iterative debugging of timing issues.

§03

How to use

  1. Add this skill rule to your Claude Code or Remotion agent configuration.
  2. Provide subtitle timing data (SRT or JSON format).
  3. The agent generates a React component that renders highlighted captions.
// Caption component following the Remotion skill rule
import { useCurrentFrame, useVideoConfig } from 'remotion';

interface Word {
  text: string;
  startFrame: number;
  endFrame: number;
}

export const Caption: React.FC<{ words: Word[] }> = ({ words }) => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();

  return (
    <div style={{ position: 'absolute', bottom: 80, width: '100%', textAlign: 'center' }}>
      {words.map((word, i) => (
        <span
          key={i}
          style={{
            color: frame >= word.startFrame && frame <= word.endFrame
              ? '#FFD700' : '#FFFFFF',
            fontSize: 48,
            fontWeight: 'bold',
            textShadow: '2px 2px 4px rgba(0,0,0,0.8)',
          }}
        >
          {word.text}{' '}
        </span>
      ))}
    </div>
  );
};
§04

Example

// Subtitle timing data for the Caption component
[
  {"text": "Welcome", "startFrame": 0, "endFrame": 15},
  {"text": "to", "startFrame": 16, "endFrame": 22},
  {"text": "our", "startFrame": 23, "endFrame": 30},
  {"text": "tutorial", "startFrame": 31, "endFrame": 50}
]
§05

Related on TokRepo

§06

Common pitfalls

  • Word timing data must be frame-accurate. If your subtitle source uses seconds, convert to frames using the video's FPS (e.g., 30fps means 1 second = 30 frames).
  • Page breaks in long captions need careful handling. Show 4-6 words per page maximum for readability on mobile screens.
  • Font rendering differs across platforms. Test caption appearance in both the Remotion preview and the final rendered MP4.

常见问题

Does this skill work with any Remotion project?+

Yes. The caption component is a standard React component that uses Remotion's useCurrentFrame hook. It works in any Remotion project regardless of the video content. You pass word timing data as props and the component handles highlighting.

How do I generate word-level timing data?+

Use a speech-to-text service like Whisper, AssemblyAI, or Deepgram that provides word-level timestamps. Convert the timestamps from seconds to frames based on your video's FPS. Most services output JSON with start/end times per word.

Can I customize the highlight style?+

Yes. The highlight color, font size, shadow, and position are all CSS properties you can modify. The skill rule provides a baseline TikTok-style look. Adjust colors and fonts to match your brand or video theme.

Does this support multiple languages?+

Yes. The caption component renders any text passed as word data. Unicode and CJK characters work. For right-to-left languages, add the appropriate CSS direction property to the container.

Can I add animation effects to the captions?+

Yes. Remotion's interpolate and spring functions let you add scale, opacity, and position animations to each word as it highlights. The skill rule provides the basic pattern; you extend it with Remotion's animation utilities.

引用来源 (3)
🙏

来源与感谢

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

Part of the Remotion AI Skill collection on TokRepo.

讨论

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

相关资产