Communitygithub.com

Hownameee/short-videos

Remotionのマークアップを構造化し、インタラクティブに操作できるようにします。

short-videos とは?

このスキルは、Remotion Studioでのビデオ編集をインタラクティブかつ直感的に行うためのベストプラクティスを提供します。具体的には、`Interactive`コンポーネントと`InteractivitySchema`を用いて、動画内の要素(テキスト、形状、メディアなど)をクリック選択、ドラッグ&ドロップ、サイズ変更、回転、CSSスタイルの編集、キーフレームやイージングの調整が可能になります。 このスキルはRemotion Studioプラットフォーム向けに設計されており、開発者はコンポーネントのマークアップを特定のルールに従って記述するだけで、Studioが自動的に構造を認識し、編集可能にします。主なルールとして、各編集可能要素は独立したJSXノードとして記述し、すべてのCSSスタイルはインラインで指定し、アニメーションは`interpolate()`関数を直接マークアップ内で使用することが推奨されています。複雑な箇所はグレーアウトされて非編集可能になりますが、このガイドラインに従うことで、誰でも直感的なビデオ編集ワークフローを構築できます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Hownameee/short-videos/tree/HEAD/.agent/skills/remotion-interactivity

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

プレビュー

スキル README より

short-videos preview

ドキュメント

Remotionのマークアップを特定の方法で記述することで、Remotion Studioはコードの構造を認識し、以下のようにインタラクティブに操作できるようになります:

  • アイテムをクリックして選択
  • ドラッグ&ドロップ、リサイズ、回転
  • CSSスタイルの編集
  • キーフレームとイージング値の編集

マークアップが複雑すぎてStudioがインタラクティブにできない場合、値はグレーアウトされます。

インタラクティブコンポーネントとその独自のタイムラインを優先する

カスタムシーン、カード、タイトル、その他の視覚的コンポーネントには、Interactive.withSchema({wrapInSequence: true})を使用します。これらのコンポーネントは、インスタンスごとにプロパティを編集可能にする必要があります。意味のあるコンテンツと外観のコントロールをInteractivitySchemaで公開し、装飾的な実装の詳細はコンポーネント内に隠蔽します。

コンポーネントはstyleを受け入れ、それを1つの視覚的なルート要素に転送する必要があります。変換、切り抜き、または不透明度がすべてのレイヤーに影響を与える場合は、共有のルート要素を維持します。レイアウトやアニメーションを変更せずにスタイルを既存の要素に移動できる場合は、冗長な内部ラッパーをフラット化します。

import type React from 'react';
import {Interactive, type InteractivitySchema} from 'remotion';

type LowerThirdProps = {
  readonly children: string;
  readonly accentColor: string;
  readonly style?: React.CSSProperties;
};

const LowerThirdInner: React.FC<LowerThirdProps> = ({
  children,
  accentColor,
  style,
}) => {
  return (
    <Interactive.Div
      style={{
        position: 'absolute',
        left: 80,
        bottom: 80,
        display: 'flex',
        alignItems: 'center',
        gap: 20,
        backgroundColor: 'white',
        borderRadius: 16,
        padding: '20px 32px',
        color: 'black',
        fontFamily: 'Helvetica, Arial, sans-serif',
        fontSize: 48,
        fontWeight: 600,
        ...style,
      }}
    >
      <div
        style={{
          width: 8,
          alignSelf: 'stretch',
          borderRadius: 4,
          backgroundColor: accentColor,
        }}
      />
      {children}
    </Interactive.Div>
  );
};

const lowerThirdSchema = {
  children: {type: 'text-content', default: '', description: 'テキスト'},
  accentColor: {
    type: 'color',
    default: '#0b84f3',
    description: 'アクセントカラー',
  },
} as const satisfies InteractivitySchema;

export const LowerThird = Interactive.withSchema({
  Component: LowerThirdInner,
  componentName: '<LowerThird>',
  schema: lowerThirdSchema,
  wrapInSequence: true,
});

注入されたstyleをコンポーネント内で転送することは必須です。編集可能なスタイルは、コンポーネントの呼び出し箇所でインラインに記述します。

スキーマフィールドの選択

スキーマの各キーは、Studioが呼び出し箇所で読み取りおよび編集できるプロパティです。スキーマに含まれていないプロパティも動作しますが、Studioでは編集できません。キーはstyle.colorのようなドット記法を使用できます。

タイプ使用目的キーフレーム可能
text-contentテキスト(タイトルなど)いいえ
number数値(min、max、step、integerオプション付き)はい
booleanオン/オフスイッチはい (ホールド)
colorCSSカラー文字列はい
enumvariants間の選択(各バリアントは独自のネストされたスキーマを持つ)オプトイン (ホールド)
array数値、色、列挙型などのリストいいえ
assetメディアソース(オプションでassetType付き)いいえ
font-familyCSSフォントファミリーいいえ
font-weightフォントの太さはい
translate, scale, rotation-css, rotation-degrees, transform-originトランスフォームはい
uv-coordinate要素上の正規化された[x, y]点はい
svg-pathSVGパスデータはい
remotion-captionsCaption[]データいいえ
hiddenコントロールから除外される値—

すべてのフィールドにはdefaultが必要であり、description(Studioがラベルとして表示)を持つ必要があります。 keyframable: falseを設定すると、静的コントロールが表示されます。

コンテンツとインスタンスごとの外観(テキストやアクセントカラーなど)を公開します。 style.translate、style.scale、style.rotate、style.transformOrigin、style.opacityのフィールドは追加しないでください。wrapInSequence: trueがすでにそれらを追加します。

ルート要素のCSSプロパティをインスタンスごとに編集可能にするには、組み込みのスキーマフラグメントを展開します:

const cardSchema = {
  ...Interactive.textSchema, // style.color, style.fontSize, style.fontWeight, ...
  ...Interactive.backgroundSchema, // style.backgroundColor
  ...Interactive.borderRadiusSchema, // style.borderRadius, ...
} as const satisfies InteractivitySchema;

また、Interactive.borderSchemaや、キャプションを受け入れるコンポーネント向けのInteractive.captionsSchemaも利用できます。 すべてのオプションについては、InteractivitySchemaを参照してください。

再利用可能なコンポーネントを接続コンポジションとして登録する

重要なシーンや、独自のレイヤーまたはアニメーションを持つ再利用可能なコンポーネントは、スタンドアロンのコンポジションとして登録します。Studioはこれらを接続コンポジションと呼びます。これらは親動画と同じコンポーネント実装を共有しながら、独自のタイムラインで開くことができます。

親がレンダリングするのと同じエクスポートされたコンポーネント参照を登録します。上記の例では、component={LowerThird}を使用し、LowerThirdInnerやインラインラッパーは使用しません。 wrapInSequence: trueの場合、接続に追加の<Sequence>は必要ありません。

import {Composition} from 'remotion';
import {LowerThird} from './LowerThird';

export const RemotionRoot = () => (
  <Composition
    id="LowerThird"
    component={LowerThird}
    width={1280}
    height={720}
    fps={30}
    durationInFrames={30}
    defaultProps={{
      children: 'Jane Doe, Product Designer',
      accentColor: '#0b84f3',
    }}
  />
);

一意のID、代表的なインラインのデフォルト値、およびプレビューに適した解像度、fps、持続時間を選択します。登録時のデフォルト値は、親インスタンスから自動的にプロパティをコピーしません。 登録と抽出の詳細については、接続コンポジションを参照してください。

タイミングを直接コンポーネントに設定する

すでにタイミングプロパティを受け入れているコンポーネントの周りに、別個の<Sequence>を配置しないでください。wrapInSequence: trueを使用して作成された組み込みのインタラクティブコンポーネントとカスタムコンポーネントは、name、from、durationInFrames、trimBefore、playbackRate、premountForを直接受け取ることができます。

<LowerThird
  name="ローサード"
  from={30}
  durationInFrames={90}
  accentColor="#0b84f3"
>
  Jane Doe, Product Designer
</LowerThird>

冗長なシーケンスを削除する場合は、そのタイミングと名前を子に移動します。既存の子のタイミングは保持し、オフセットを上書きしたり二重適用したりしないでください。コンポーネント内のuseCurrentFrame()呼び出しはそのローカルフレームを読み取りますが、呼び出し箇所のスタイル式は呼び出し元のフレームを使用します。アニメーションスタイルを移動する際は、その区別を保持してください。

<Sequence>は、複数の兄弟に共有タイミングを提供する場合、useVideoConfig()の解像度をオーバーライドする場合、またはタイミングを処理しないコンポーネントをラップする場合に保持します。連続するレイアウトには<Series.Sequence>を、トランジションには<TransitionSeries.Sequence>を保持します。直接のfromプロパティはこれらの動作を置き換えません。

編集可能な各アイテムに独自のJSXノードを与える

Studioは、アイテムを作成したJSXソースノードを編集します。複数のランタイムアイテムが同じJSXノードから生成されると、それらは1つのソース編集ターゲットを共有します。

各コンポジション登録、クリップ、シーン、レイヤー、またはシーケンスは、それ自体が編集可能であるべきであり、別個のJSXノードを作成し、そのノードに編集可能なプロパティを保持します。これは、<Composition>、<Still>、組み込みメディアコンポーネント、<Sequence>、<Series.Sequence>、<TransitionSeries.Sequence>、およびカスタムコンポーネントに適用されます。

たとえば、次のように編集可能なタイムラインを作成します:

<Series>
  <Series.Sequence name="イントロ" durationInFrames={90}>
    <Introduction />
  </Series.Sequence>
  <Series.Sequence name="デモ" durationInFrames={150}>
    <Demo />
  </Series.Sequence>
</Series>

.map()などのプログラムによるループは、1つのJSXソースノードから複数のランタイムアイテムを作成します。これは、可視化バーやパーティクルなど、意図的に1つのテンプレートとして制御される繰り返し出力には適切ですが、インスタンスに個別のIDや名前、プロパティ、メタデータ、タイミング、順序、削除、またはStudioでの複製が必要な場合には適切ではありません。

Interactiveを使用してHTML要素をインタラクティブにする

すべてのHTMLおよびSVG要素(<Img>を除く、すでにインタラクティブです)は、Interactiveを使用してインタラクティブにできます:

<Interactive.Div
  name="グリーティングカード"
  style={{fontSize: 80, padding: 24}}
>
  こんにちは
</Interactive.Div>

これにより、Studioでスタイルやキーフレームを設定できるようになります。ただし、コンポーネントに多くの要素があるとタイムラインが乱雑になる可能性があるため、適切に使用してください。

インラインテキストを優先する

テキストが固定されており、1回しか使用されない場合は、定数に抽出する代わりに、インタラクティブ要素内に直接記述します。

// 👍 固定のコピーは編集可能なまま
<Interactive.Div name="タイトル">
  Remotionのベストプラクティス
</Interactive.Div>

テキストが動的または再利用される場合のみ、プロパティまたは変数を使用します。

インタラクティブ要素に説明的な名前を付ける

要素にnameプロパティを追加して、識別しやすくします。 計算された名前は避け、ハードコードします。

<>
  <Interactive.Div name="ヒーロータイトル" style={{fontSize: 80}}>
    ローンチ日
  </Interactive.Div>
  <Img name="アバター" src="https://remotion.media/image.jpeg" />
  <Video name="背景" src="https://remotion.media/video.mp4" />
  <Interactive.Div name="タイトル">
    ローンチ日
  </Interactive.Div>
</>

すべてのCSSスタイルをインラインに保つ

最良の方法は、styleにプレーンなオブジェクトを渡すことです。定数を参照したり、オブジェクトを展開したり、計算式を使用したりしないでください。

<Interactive.Div
  style={{
    fontSize: 80,
    color: 'red',
  }}
>
  ハローワールド!
</Interactive.Div>
const baseStyle = useMemo(() => {
  return {
    fontSize: 12 // ❌ 非インラインスタイルはサポートされていません
  }
}, []);

<Interactive.Div
  style={{
    ...baseStyle, // ❌ 展開はサポートされていません
    color: RED, // ❌ 定数参照はサポートされていません
    scale: frame * 10 // ❌ 計算式はサポートされていません
  }}
>
  ハローワールド!
</Interactive.Div>

interpolate()を使用してアニメーションさせる

アニメーションは、変更されるプロパティに対してインラインのinterpolate()呼び出しとして記述します。 出力範囲、イージング、外挿法、outputプロパティはハードコードされた値を使用する必要があります。

入力範囲は、さらにuseVideoConfig()から直接分割代入されたdurationInFrames、fps、width、heightを使用できます。durationInFramesのようなベア識別子、2 * fpsまたはfps * 2のような数値との乗算、durationInFrames - 1のような数値の減算がサポートされています。

const {fps, durationInFrames} = useVideoConfig();

// 👍 インライン値は標準化され、キーフレーム化できます
<Interactive.Div
  name="プロダクトカード"
  style={{
    color: 'white',
    fontSize: 80,
    scale: interpolate(frame, [0, fps], [0, 1], {
      easing: Easing.spring({damping: 200}),
      output: 'perceptual-scale',
      extrapolateLeft: 'clamp',
      extrapolateRight: 'clamp'
    }),
    rotate: interpolate(frame, [0, 1 * fps], ['0deg', '20deg'], {
      easing: Easing.spring({damping: 200}),
      extrapolateLeft: 'clamp',
      extrapolateRight: 'clamp'
    }),
    translate: interpolate(
      frame,
      [durationInFrames - 30, durationInFrames],
      ['0px 0px', '0px 120px'],
      {
        easing: Easing.spring({damping: 200}),
        output: 'perceptual-scale',
        extrapolateLeft: 'clamp',
        extrapolateRight: 'clamp'
      }
    ),
  }}
/>
const translateY = interpolate(frame, [0, 30], [0, 120]); // ❌ 計算式はマークアップ内で直接記述すべき

<Interactive.Div
  name="プロダクトカード"
  style={{
    translate: translateY, // ❌ インラインのinterpolate()呼び出しのみサポート
    rotate: interpolate(frame, [start, start + 10], [0, Math.PI]), // ❌ 任意の変数での計算式は使用不可、定数も不可
    scale: interpolate(anyVariable, [0, 30], [0, 1]) // ❌ `frame`変数のみ解釈可能
  }}
/>

SVGパスはそのままにしておく

SVGパスデータは、Studioによって編集可能な個別の<path>要素として記述します。複雑なパスは、<path>要素を分割して個別に編集可能にします。


このスキルは、Remotion Studioとのシームレスなインタラクションを実現するための実践的なガイドラインです。上記のルールに従うことで、動画編集者はコードの詳細を気にすることなく、直感的にビジュアルコンテンツを操作・調整できます。

Individual skills in this repo

This repo contains 11 individual skills — each has its own dedicated page.

Hownameee/short-videos

Generate, revise or troubleshoot local Kokoro narration, pronunciation and scene word timing. Reuse verified unchanged clips; inspect the Python environment before setup changes. Exclude research, visuals, music composition and publishing.

Hownameee/short-videos

Router for all Remotion skills

Hownameee/short-videos

Transcribing, displaying and animating captions

Hownameee/short-videos

Remotion Map animation knowledge

Hownameee/short-videos

Content, animation and effects best practices

Hownameee/short-videos

Upgrade Remotion, and related packages

Hownameee/short-videos

>- Run Phase 1 of the shared short-video workflow: turn a raw topic or prompt into a sourced research pack and 2–4 distinct video directions, each with a defensible tension hook, promise, payoff, beats, visual approach, duration range, and risks. Use whenever the user asks for video ideas, angles, research, facts, hooks, topic analysis, or choices before scriptwriting. Stop for the user's direction choice and do not silently continue into script or production.

Hownameee/short-videos

Produce an approved short video or correct an existing video's background sound, emotion, captions, mix or export. Generate only changed narration, render and review a current preview, run technical and editorial QC, then export. Exclude script-only and general audio-advice requests.

Hownameee/short-videos

>- Run Phase 2 of the shared short-video workflow: convert an explicitly selected direction and its research into a reviewable beat sheet, narration, flexible scene timing, on-screen text, visual plan, captions, music and SFX cues, pronunciation notes, payoff, takeaway, and contextual CTA. Use whenever a user asks to write, revise, preview, or approve a short-video script. Stop for script approval and do not generate TTS or render video yet.

Hownameee/short-videos

>- Design and review a coherent visual system for short-form video before and during Remotion implementation. Use for video art direction, scene UI, typography, layout, color, diagrams, captions, motion, transitions, platform safe areas, or visual-quality review. Use Remotion skills separately for API, timeline, media, Studio, and rendering behavior; do not use this skill for narration-only or research-only work.

Hownameee/short-videos

Coordinate prompt-to-short-video discovery, scripting and production. Resume existing projects and route soundtrack or mix corrections directly to production. Preserve direction choice and script approval; exclude general audio advice.

関連スキル