π₯ Make videos programmatically with React
Docs: Comparison of video tags
Jonny Burger9bc69c5d5e94
diff --git a/packages/docs/blog/2022-07-14-remotion-3-1.mdx b/packages/docs/blog/2022-07-14-remotion-3-1.mdxindex cd9f536d35..533f96e0c4 100644--- a/packages/docs/blog/2022-07-14-remotion-3-1.mdx+++ b/packages/docs/blog/2022-07-14-remotion-3-1.mdx@@ -111,7 +111,7 @@ Until now - if you pass a duration to a spring, we will detect the trajectory of[This component](/docs/offthreadvideo) is an alternative to the [`<Video>`](/docs/video) component that extracts frames using FFMPEG and renders them inside an [`<Img>`](/docs/img) tag.-We made the `<OffthreadVideo>` component in order to counteract problems with seeking and throttling that users were reporting with the `<Video>` tag. The new way improves reliability but has it's tradeoffs - read [`<OffthreadVideo> vs <Video>`](/docs/video-vs-offthreadvideo) or check out our [visual explanation on Instagram](https://www.instagram.com/p/CftaiHpMM-L/)!+We made the `<OffthreadVideo>` component in order to counteract problems with seeking and throttling that users were reporting with the `<Video>` tag. The new way improves reliability but has it's tradeoffs - read [`<OffthreadVideo> vs <Video>`](/docs/video-tags) or check out our [visual explanation on Instagram](https://www.instagram.com/p/CftaiHpMM-L/)!<a href="https://www.instagram.com/p/CftaiHpMM-L/"><img src="/img/offthreadvideo-all.png" />diff --git a/packages/docs/docs/offthreadvideo.mdx b/packages/docs/docs/offthreadvideo.mdxindex c5e84fcc73..19f59337e0 100644--- a/packages/docs/docs/offthreadvideo.mdx+++ b/packages/docs/docs/offthreadvideo.mdx@@ -9,7 +9,7 @@ _Available from Remotion 3.0.11_This component imports and displays a video, similar to [`<Video/>`](/docs/video), but during rendering, extracts the exact frame from the video and displays it in a [`<Img>`](/docs/img) tag. This extraction process happens outside the browser using FFmpeg.-This component was designed to combat limitations of the default `<Video>` element. See: [`<Video>` vs `<OffthreadVideo>`](/docs/video-vs-offthreadvideo).+This component was designed to combat limitations of the default `<Video>` element. See: [Comparison of video tags](/docs/video-tags).## Example@@ -399,4 +399,4 @@ The following codecs can be read by `<OffthreadVideo>`:- [Source code for this component](https://github.com/remotion-dev/remotion/blob/main/packages/core/src/video/OffthreadVideo.tsx)- [`<Video />`](/docs/video)-- [`<Video>` vs `<OffthreadVideo>`](/docs/video-vs-offthreadvideo)+- [Comparison of video tags](/docs/video-tags)diff --git a/packages/docs/docs/performance.mdx b/packages/docs/docs/performance.mdxindex c0313de05b..29077b2372 100644--- a/packages/docs/docs/performance.mdx+++ b/packages/docs/docs/performance.mdx@@ -3,7 +3,7 @@ image: /generated/articles-docs-performance.pngid: performancesidebar_label: Performancetitle: Performance Tips-crumb: "Need for Speed"+crumb: 'Need for Speed'---Video rendering is one of the most heavy workloads a computer can take on. Remotion aims to at least perform similarly than traditional video editing programs.@@ -30,7 +30,7 @@ Read the [considerations about using the GPU](/docs/gpu).## Videos-For embedding videos, there is an alternative component [`<OffthreadVideo>`](/docs/offthreadvideo) that can speed up rendering. See [`<Video>` vs. `<OffthreadVideo>`](/docs/video-vs-offthreadvideo)+For embedding videos, there is an alternative component [`<OffthreadVideo>`](/docs/offthreadvideo) that can speed up rendering. See [Comparison of video tags](/docs/video-tags)Embedded videos can be a significant bottleneck in Remotion at the moment regardless of which component is being used. We are aware of this constraint and are encouraging users to combine Remotion with other tools such as FFmpeg to build efficient pipelines.diff --git a/packages/docs/docs/use-offthread-video-texture.mdx b/packages/docs/docs/use-offthread-video-texture.mdxindex e47028b3d1..931f97babd 100644--- a/packages/docs/docs/use-offthread-video-texture.mdx+++ b/packages/docs/docs/use-offthread-video-texture.mdx@@ -12,7 +12,7 @@ Allows you to use a video in React Three Fiber that is synchronized with RemotioThis hook only works during rendering. In the Player and the Remotion Studio, use [`useVideoTexture()`](/docs/use-video-texture) instead. See below for an example.This hook was designed to combat limitations of the default `<Video>` element that is used with `useVideoTexture()` hook.-See: [`<OffthreadVideo> vs <Video>`](/docs/video-vs-offthreadvideo)+See: [Comparison of video tags](/docs/video-tags)The return type of it is a `THREE.Texture | null` which you can assign as a `map` to for example `meshBasicMaterial`. We recommend to only render the material when the texture is not `null` to prevent bugs.@@ -123,4 +123,4 @@ Like `<OffthreadVideo>`, looping a video [is not supported out of the box](/docs- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/three/src/use-offthread-video-texture.ts)- [`useVideoTexture()`](/docs/use-video-texture)- [`<ThreeCanvas />`](/docs/three-canvas)-- [`<OffthreadVideo> vs <Video>`](/docs/video-vs-offthreadvideo)+- [Comparison of video tags](/docs/video-tags)diff --git a/packages/docs/docs/video-tags.mdx b/packages/docs/docs/video-tags.mdxnew file mode 100644index 0000000000..064eb74e50--- /dev/null+++ b/packages/docs/docs/video-tags.mdx@@ -0,0 +1,29 @@+---+image: /generated/articles-docs-video-tags.png+id: video-tags+title: Comparison of video tags+crumb: 'Comparison'+---++We offer three components for embedding videos into your Remotion composition:++- [`<OffthreadVideo />`](/docs/offthreadvideo) - **our recommendation**, based on a Rust-based frame extractor+- [`<Video />`](/docs/video) from `remotion` - based on the HTML5 `<video>` element+- [`<Video />`](/docs/media/video) from `@remotion/media` - an experimental WebCodecs-based component, set to become the default++This page offers a comparison to help you decide which tag to use.++| | [`<OffthreadVideo />`](/docs/offthreadvideo) | [`<Video />`](/docs/video) <br/> [`<Audio />`](/docs/audio) <br/> (`remotion`) | [`<Video />`](/docs/media/video) <br/> [`<Audio />`](/docs/media/audio) (`@remotion/media`) |+| ---------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |+| **Based on** | Rust + FFmpeg binary | HTML5 `<video>` tag | Mediabunny, WebCodecs |+| **Frame-perfect** | β | β Not guaranteed | β |+| **Partial download of asset** | β | Only with `muted` prop | β |+| **Preview** | HTML5 `<video>` | HTML5 `<video>` | HTML5 `<video>` <br/> Soon: WebCodecs |+| **Render Speed** | Fast | Medium | <span style={{color: 'green', fontWeight: 'bold'}}> Fastest </span> |+| **Supported containers** | `.aac`, `.avi`, `.caf`, `.flac`, `.flv`, `.m4a`, `.mkv`, `.mp3`, `.mp4`, `.ogg`, `.wav`, `.webm` | `.aac`, `.flac`, `.m4a`, `.mkv`, `.mp3`, `.mp4`, `.ogg`, `.wav`, `.webm` | `.aac`, `.flac`, `.mkv`, `.mov`, `.mp3`, `.mp4`, `.ogg`, `.wav`, `.webm` |+| **Supported codecs** | AAC, AC3, AV1, FLAC, H.264, H.265, M4A, MP3, Opus, PCM, ProRes, VP8, VP9, Vorbis | AAC, FLAC, H.264, MP3, Opus, VP8, VP9, Vorbis | AAC, FLAC, H.264, MP3, Opus, VP8, VP9, Vorbis <br/><br/> Planned: Fallback to `<OffthreadVideo>` for unsupported codecs |+| **HLS Support** | No | [Only during preview](/docs/miscellaneous/snippets/hls) | Planned |+| **CORS required** | No | No | Yes |+| **Loopable** | β | β | β |+| **`playbackRate`** <br/> (Speed Change) | β | β | Planned |+| **`toneFrequency`** <br/> (Pitch Change) | Only during rendering | Only during rendering | Planned |diff --git a/packages/docs/docs/video-vs-offthreadvideo.mdx b/packages/docs/docs/video-vs-offthreadvideo.mdxdeleted file mode 100644index 1d36587da8..0000000000--- a/packages/docs/docs/video-vs-offthreadvideo.mdx+++ /dev/null@@ -1,48 +0,0 @@-----image: /generated/articles-docs-video-vs-offthreadvideo.png-id: video-vs-offthreadvideo-title: '<OffthreadVideo> vs. <Video>'-crumb: 'Comparison'------We offer two components for including other videos in your video: [`<Video />`](/docs/video) and [`<OffthreadVideo />`](/docs/offthreadvideo).-This page offers a comparison to help you decide which tag to use.--## [`<OffthreadVideo />`](/docs/offthreadvideo)--:::info-Prefer [`<OffthreadVideo />`](/docs/offthreadvideo) whenever possible.-:::--A more sophisticated way of embedding a video, which:--- **During preview:** renders a HTML5 `<video>` tag.-- **While rendering:** Extracts the exact frame outside the browser and displays it in an [`<Img>`](/docs/img) tag.--**Pros**--β More videos can be displayed simulatenously as Chrome will not apply throttling.-β No flickers or duplicate frames in the output video can occur.-β Supports more codecs such as ProRes (only during render-time).-β Is usually faster to render.--**Cons**--β The video needs to be downloaded fully before a frame can be rendered.-β Supports transparent videos only if the [`transparent`](/docs/offthreadvideo#transparent) prop is set which is a bit slower.--## [`<Video />`](/docs/video)--Is based on the native HTML5 `<video>` element and therefore behaves similar to it.--**Pros**--β Can render a video without having it to be downloaded fully (if you don't pass the [`muted`](/docs/video/#muted) prop, the video will still be downloaded fully to extract its audio).-β You can attach a ref to the `<video>` element.--**Cons**--β Fewer codecs are supported.-β Chrome may throttle video tags if the page is heavy.-β If too many video tags get rendered simultaneously, a timeout may occur.-β If the input video framerate does not match with the output framerate, some duplicate frames may occur in the output.diff --git a/packages/docs/docs/video.mdx b/packages/docs/docs/video.mdxindex 1d2c949ad0..2d6dc62c81 100644--- a/packages/docs/docs/video.mdx+++ b/packages/docs/docs/video.mdx@@ -301,13 +301,13 @@ See: [Which video formats does Remotion support?](/docs/miscellaneous/video-form## Alternative: `<OffthreadVideo>`-[`<OffthreadVideo>`](/docs/offthreadvideo) is a drop-in alternative to `<Video>`. To decide which tag to use, see: [`<Video>` vs `<OffthreadVideo>`](/docs/video-vs-offthreadvideo)+[`<OffthreadVideo>`](/docs/offthreadvideo) is a drop-in alternative to `<Video>`. To decide which tag to use, see: [Comparison of video tags](/docs/video-tags)## See also- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/core/src/video/Video.tsx)- [`<Audio />`](/docs/audio)- [`<OffthreadVideo />`](/docs/offthreadvideo)-- [`<Video>` vs `<OffthreadVideo>`](/docs/video-vs-offthreadvideo)+- [Comparison of video tags](/docs/video-tags)- [`<Video />` (from `@remotion/media`)](/docs/media/video)- [`Change the speed of a video over time`](/docs/miscellaneous/snippets/accelerated-video)diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.tsindex 6baaabfc58..cfa399f4ad 100644--- a/packages/docs/sidebars.ts+++ b/packages/docs/sidebars.ts@@ -825,8 +825,8 @@ const sidebars: SidebarsConfig = {'miscellaneous/snippets/accelerated-video','miscellaneous/snippets/jumpcuts','miscellaneous/snippets/freeze-portions',+ 'video-tags','miscellaneous/snippets/hls',- 'video-vs-offthreadvideo',],},{diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex 7f3ca0e4aa..c58d243344 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -6162,6 +6162,15 @@ export const articles = [noAi: false,slug: 'video-manipulation',},+ {+ id: 'video-tags',+ title: 'Comparison of video tags',+ relativePath: 'docs/video-tags.mdx',+ compId: 'articles-docs-video-tags',+ crumb: 'Comparison',+ noAi: false,+ slug: 'video-tags',+ },{id: 'video-uploads',title: 'Handling user video uploads',@@ -6171,15 +6180,6 @@ export const articles = [noAi: false,slug: 'video-uploads',},- {- id: 'video-vs-offthreadvideo',- title: '<OffthreadVideo> vs. <Video>',- relativePath: 'docs/video-vs-offthreadvideo.mdx',- compId: 'articles-docs-video-vs-offthreadvideo',- crumb: 'Comparison',- noAi: false,- slug: 'video-vs-offthreadvideo',- },{id: 'video',title: '<Video>',diff --git a/packages/docs/static/generated/articles-docs-video-tags.png b/packages/docs/static/generated/articles-docs-video-tags.pngnew file mode 100644index 0000000000..bfb9b028a3Binary files /dev/null and b/packages/docs/static/generated/articles-docs-video-tags.png differdiff --git a/packages/docs/vercel.json b/packages/docs/vercel.jsonindex c0ab037692..aa8a83c9d1 100644--- a/packages/docs/vercel.json+++ b/packages/docs/vercel.json@@ -413,6 +413,11 @@"destination": "/docs/animation-math","permanent": false},+ {+ "source": "/docs/video-vs-offthreadvideo",+ "destination": "/docs/video-tags",+ "permanent": false+ },{"source": "/bbb.webm","destination": "https://upload.wikimedia.org/wikipedia/commons/transcoded/c/c0/Big_Buck_Bunny_4K.webm/Big_Buck_Bunny_4K.webm.720p.vp9.webm",