Capítulo 245 de 988

Chapter 245: Comparison of video tags

Core Idea

For new code, use <Video /> from @remotion/media. It is the recommended component for embedding videos into a Remotion composition.

Key Concepts

  • Using a different tag in preview and rendering

Code Examples

const OffthreadWhileRenderingRefForwardingFunction: React.FC<{
  offthreadVideoProps: RemotionOffthreadVideoProps;
  videoProps: VideoProps;
}> = ({offthreadVideoProps, videoProps}) => {
  const env = useRemotionEnvironment();

  if (!env.isRendering) {
    return <OffthreadVideo {...offthreadVideoProps} />;
  }

  return <Video {...videoProps} />;
};
  • What it demonstrates: Usage pattern for Comparison of video tags from the official docs.

Reference Tables

<Video /> <br/> <Audio /> (@remotion/media)<OffthreadVideo /><Html5Video /> <br/> <Html5Audio /> <br/> (remotion)
Based onMediabunny, WebCodecsRust + FFmpeg binaryHTML5 <video> tag
Frame-perfect❌ Not guaranteed
Partial download of assetOnly with muted prop
PreviewWebCodecsHTML5 <video>HTML5 <video>
Render Speed<span style={{color: 'green', fontWeight: 'bold'}}> Fastest </span>FastMedium
Supported containers.aac, .flac, .m3u8, .mkv, .mov, .mp3, .mp4, .ogg, .wav, .webm <br/>``<br/> Fallback to <OffthreadVideo> for unsupported containers.aac, .avi, .caf, .flac, .flv, .m4a, .mkv, .mp3, .mp4, .ogg, .wav, .webm.aac, .flac, .m4a, .mkv, .mp3, .mp4, .ogg, .wav, .webm
Supported codecsAAC, FLAC, H.264, MP3, Opus, VP8, VP9, Vorbis <br/>``<br/> Fallback to <OffthreadVideo> for unsupported codecsAAC, AC3, AV1, FLAC, H.264, H.265, M4A, MP3, Opus, PCM, VP8, VP9, VorbisAAC, FLAC, H.264, MP3, Opus, VP8, VP9, Vorbis
ProResPreview & RenderingDuring RenderingNot supported
HLS Support✅ SupportedChrome v142+, only during previewOnly during preview
CORS requiredYesNoNo
Loopable
playbackRate <br/> (Speed Change)✅, but audio pitch changes with the speed✅, audio pitch is preserved by default✅, audio pitch is preserved by default
toneFrequency <br/> (Pitch Change)Only during server-side renderingOnly during server-side renderingOnly during server-side rendering
Three.js textureSnippet - works bestuseOffthreadVideoTexture() useVideoTexture()
Client-side rendering

Key Takeaways

  1. Understand using a different tag in preview and rendering when working with Comparison of video tags.

Connects To

  • Animatedimage: related page in the Assets & Media section.
  • Delaying: related page in the Assets & Media section.
  • Exporting: related page in the Assets & Media section.