mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-15 20:51:22 +08:00
174e31b3fc
Translated 85 skill sub-reference files to achieve full parity with the English source: - skills/angular-developer/references/ — 35 files (all references) - skills/remotion-video-creation/rules/ — 28 files (all rules) - skills/tinystruct-patterns/references/ — 5 files - skills/openclaw-persona-forge/references/ — 6 files - skills/skill-comply/prompts/ — 3 files - skills/lead-intelligence/agents/ — 4 files - skills/brand-voice/references/ — 1 file - skills/frontend-slides/ — 2 files - hooks/memory-persistence/README.md — 1 file English source parity: 0 missing files (excluding rules/zh/, internal docs, and experimental examples absent from zh-CN)
3.3 KiB
3.3 KiB
name, description, metadata
| name | description | metadata | ||
|---|---|---|---|---|
| calculate-metadata | コンポジションのデュレーション、寸法、プロップを動的に設定する |
|
calculateMetadataの使用
<Composition> に calculateMetadata を使用して、レンダリング前にデュレーション、寸法、プロップを動的に設定し変換します。
<Composition id="MyComp" component={MyComponent} durationInFrames={300} fps={30} width={1920} height={1080} defaultProps={{videoSrc: 'https://remotion.media/video.mp4'}} calculateMetadata={calculateMetadata} />
動画に基づいたデュレーションの設定
mediabunny/metadataスキルの getMediaMetadata() 関数を使用して動画のデュレーションを取得します:
import {CalculateMetadataFunction} from 'remotion';
import {getMediaMetadata} from '../get-media-metadata';
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
const {durationInSeconds} = await getMediaMetadata(props.videoSrc);
return {
durationInFrames: Math.ceil(durationInSeconds * 30),
};
};
動画の寸法に合わせる
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
const {durationInSeconds, dimensions} = await getMediaMetadata(props.videoSrc);
return {
durationInFrames: Math.ceil(durationInSeconds * 30),
width: dimensions?.width ?? 1920,
height: dimensions?.height ?? 1080,
};
};
複数の動画に基づいたデュレーションの設定
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
const metadataPromises = props.videos.map((video) => getMediaMetadata(video.src));
const allMetadata = await Promise.all(metadataPromises);
const totalDuration = allMetadata.reduce((sum, meta) => sum + meta.durationInSeconds, 0);
return {
durationInFrames: Math.ceil(totalDuration * 30),
};
};
デフォルト出力ファイル名の設定
プロップに基づいてデフォルトの出力ファイル名を設定します:
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
return {
defaultOutName: `video-${props.id}.mp4`,
};
};
プロップの変換
レンダリング前にデータを取得したりプロップを変換します:
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props, abortSignal}) => {
const response = await fetch(props.dataUrl, {signal: abortSignal});
const data = await response.json();
return {
props: {
...props,
fetchedData: data,
},
};
};
abortSignal は、Studioでプロップが変更されたときに古いリクエストをキャンセルします。
戻り値
すべてのフィールドはオプションです。返された値は <Composition> のプロップを上書きします:
durationInFrames: フレーム数width: コンポジションの幅(ピクセル)height: コンポジションの高さ(ピクセル)fps: 1秒あたりのフレーム数props: コンポーネントに渡される変換済みプロップdefaultOutName: デフォルトの出力ファイル名defaultCodec: レンダリングのデフォルトコーデック