Remotion Rule: Audio
Remotion skill rule: Using audio and sound in Remotion - importing, trimming, volume, speed, pitch. Part of the official Remotion Agent Skill for programmatic video in React.
Agent 可直接安装
这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。
npx -y tokrepo@latest install e92dc629-9a69-4a43-9143-6aec38691794 --target codex先 dry-run 确认安装计划,再运行此命令。
What it is
The Remotion Rule: Audio is a skill rule from the official Remotion Agent Skill set. It provides structured guidance for AI coding agents working with audio in Remotion projects. Remotion is a framework for creating programmatic video using React components, and this rule covers the audio layer: importing sound files, trimming clips, adjusting volume over time, changing playback speed, and modifying pitch.
This rule is for developers using AI coding assistants (like Claude Code) to build Remotion video projects. When activated, it teaches the AI how to correctly use Remotion's audio APIs.
How it saves time or tokens
Without this rule, an AI coding agent would need to discover Remotion's audio API conventions through trial and error or by reading documentation. The rule provides the correct patterns upfront, reducing failed attempts and token waste on incorrect code generation.
The rule is approximately 500 tokens and activates automatically when audio work is detected in a Remotion project context.
How to use
- Install the Remotion skills:
npx skills add remotion-dev/skills
- The audio rule activates automatically when working with audio in a Remotion project.
- Use the Audio component in your Remotion composition:
import { Audio } from 'remotion';
export const MyVideo: React.FC = () => {
return (
<Audio
src='https://example.com/music.mp3'
volume={0.5}
startFrom={30} // skip first 30 frames
endAt={150} // stop at frame 150
/>
);
};
Example
Dynamic volume adjustment with a fade-in effect:
import { Audio, interpolate, useCurrentFrame } from 'remotion';
export const FadeInAudio: React.FC = () => {
const frame = useCurrentFrame();
const volume = interpolate(
frame,
[0, 30], // frames 0 to 30
[0, 1], // volume 0 to 1
{ extrapolateRight: 'clamp' }
);
return (
<Audio
src='https://example.com/bgm.mp3'
volume={volume}
/>
);
};
The interpolate function creates smooth transitions for volume, making fade-in and fade-out effects straightforward.
Related on TokRepo
- AI tools for video -- AI-powered video production tools
- AI tools for coding -- AI coding assistants and development tools
Common pitfalls
- Using unsupported audio formats. Remotion supports MP3, WAV, and AAC. Some browsers have limited codec support for formats like OGG or FLAC during preview.
- Forgetting that Audio components must be inside a Remotion Composition. Placing them outside the composition tree causes silent failures.
- Not pre-loading audio assets. For remote URLs, add the audio to your public folder or use the
staticFile()helper to avoid loading delays during rendering.
常见问题
Remotion supports MP3, WAV, and AAC audio formats. The support depends on the browser engine used for rendering (Chromium). For production renders, MP3 and AAC are the most reliable choices.
Yes. The Audio component accepts a volume prop that can be a static number (0 to 1) or a function that receives the frame number. Using interpolate() with useCurrentFrame() creates smooth volume transitions like fade-in and fade-out.
Use the startFrom and endAt props on the Audio component. startFrom skips a number of frames from the beginning of the audio file. endAt stops playback at a specific frame. Both work in frame units based on your composition's FPS.
Yes. Use the playbackRate prop on the Audio component. A value of 2 doubles the speed, 0.5 halves it. Note that changing playback speed also affects pitch unless you use additional audio processing.
Install the Remotion skills with 'npx skills add remotion-dev/skills'. When Claude Code detects audio-related work in a Remotion project, this rule activates automatically and provides correct API patterns without manual instruction.
引用来源 (3)
- Remotion GitHub— Remotion is a framework for creating programmatic video using React
- Remotion Audio Docs— Audio component API for Remotion
- Remotion Interpolate Docs— Interpolation functions for animation and transitions
来源与感谢
Created by Remotion. Licensed under MIT. remotion-dev/skills — Rule:
audio
Part of the Remotion AI Skill collection on TokRepo.
讨论
相关资产
Remotion Rule: Videos
Remotion skill rule: Embedding videos in Remotion - trimming, volume, speed, looping, pitch. Part of the official Remotion Agent Skill for programmatic video in React.
Remotion Rule: Transcribe Captions
Remotion skill rule: Transcribing audio to generate captions in Remotion. Part of the official Remotion Agent Skill for programmatic video in React.
Remotion Rule: Import Srt Captions
Remotion skill rule: Importing .srt subtitle files into Remotion using @remotion/captions. Part of the official Remotion Agent Skill for programmatic video in React.
Remotion Rule: Trimming
Remotion skill rule: Trimming patterns for Remotion - cut the beginning or end of animations. Part of the official Remotion Agent Skill for programmatic video in React.