Skip to content

🎥 Make videos programmatically with React

Docs: Update media and GPU guidance

Jonny Burgerfe2ac28223b5
diff --git a/packages/docs/docs/get-audio-data.mdx b/packages/docs/docs/get-audio-data.mdx
index bbeb2d61a5..8355c475c8 100644
--- a/packages/docs/docs/get-audio-data.mdx
+++ b/packages/docs/docs/get-audio-data.mdx
@@ -110,13 +110,11 @@ Whether the audio was imported locally or from a different origin.
## Example
-```ts twoslash
-import {Audio, staticFile} from 'remotion';
-// ---cut---
+```ts twoslash title="get-audio-data.ts"
import {getAudioData} from '@remotion/media-utils';
-import music from './music.mp3';
+import {staticFile} from 'remotion';
-await getAudioData(music); /* {
+await getAudioData(staticFile('music.mp3')); /* {
channelWaveforms: [Float32Array(4410000), Float32Array(4410000)],
sampleRate: 44100,
durationInSeconds: 100.0000,
diff --git a/packages/docs/docs/get-remotion-environment.mdx b/packages/docs/docs/get-remotion-environment.mdx
index 4e90962b3d..b3c26a6d0f 100644
--- a/packages/docs/docs/get-remotion-environment.mdx
+++ b/packages/docs/docs/get-remotion-environment.mdx
@@ -58,4 +58,4 @@ A more realistic use case: You might want to debounce a request during editing i
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/core/src/get-remotion-environment.ts)
- [`useRemotionEnvironment()`](/docs/use-remotion-environment) - a new preferred way to get the environment information
- [`useVideoConfig()`](/docs/use-video-config)
-- [`<OffthreadVideo/> while rendering`](/docs/video-tags#using-a-different-tag-in-preview-and-rendering)
+- [Using a different tag in preview and rendering](/docs/video-tags#using-a-different-tag-in-preview-and-rendering)
diff --git a/packages/docs/docs/get-waveform-portion.mdx b/packages/docs/docs/get-waveform-portion.mdx
index e2265d1617..4ebc79b0e8 100644
--- a/packages/docs/docs/get-waveform-portion.mdx
+++ b/packages/docs/docs/get-waveform-portion.mdx
@@ -110,4 +110,4 @@ The [`visualizeAudio()`](/docs/visualize-audio) function is more suitable for vi
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/media-utils/src/get-waveform-portion.ts)
- [Using audio](/docs/using-audio)
-- [`<Html5Audio/>`](/docs/html5-audio)
+- [`<Audio>`](/docs/media/audio)
diff --git a/packages/docs/docs/gpu.mdx b/packages/docs/docs/gpu.mdx
index d9e84ef8fc..ae7a241c94 100644
--- a/packages/docs/docs/gpu.mdx
+++ b/packages/docs/docs/gpu.mdx
@@ -12,6 +12,7 @@ By default in many cases, the GPU is disabled in headless mode, which can lead t
## Content accelerated by the GPU
- WebGL content (Three.JS, Skia, P5.js, Mapbox etc.)
+- Video decoding
- `box-shadow`
- `text-shadow`
- `background-image: linear-gradient()`
@@ -25,16 +26,6 @@ If a GPU is available, it should be enabled by default while in the Remotion Stu
However, in headless mode, Chromium disables the GPU, leading to a significant
slowdown in rendering time.
-## Content not accelerated by the GPU
-
-Contrary to popular belief, the following content is not accelerated by the GPU:
-
-- `<Html5Video>`
-- `<OffthreadVideo>`
-- [Canvas pixel manipulation](/docs/videos/video-manipulation)
-
-Furthermore, the encoding of the video is not accelerated by the GPU at this point.
-
## Use the `--gl` flag to enable the GPU during rendering
See [here](/docs/gl-options) for recommendations which OpenGL backend you should use during rendering.
diff --git a/packages/docs/docs/miscellaneous/video-formats.mdx b/packages/docs/docs/miscellaneous/video-formats.mdx
index fbdf66eb68..380e3fddd8 100644
--- a/packages/docs/docs/miscellaneous/video-formats.mdx
+++ b/packages/docs/docs/miscellaneous/video-formats.mdx
@@ -7,7 +7,9 @@ sidebar_label: Video formats
Remotion supports a variety of video codecs.
-**Output formats**: Videos can be rendered to `H.264` (MP4), `H.265` (HEVC), `VP8` and `VP9` (WebM), `AV1`, `ProRes` as well as GIFs. `AV1` is not available on Remotion Lambda or Linux ARM64 GNU because those runtimes ship only the essential codecs to stay lean. See the [Encoding guide](/docs/encoding) for more detail.
+**Server-side output formats**: Videos can be rendered to `H.264` (MP4), `H.265` (HEVC), `VP8` and `VP9` (WebM), `AV1`, `ProRes` as well as GIFs. `AV1` is not available on Remotion Lambda or Linux ARM64 GNU because those runtimes ship only the essential codecs to stay lean. See the [Encoding guide](/docs/encoding) for more detail.
+
+**Client-side output formats**: [`renderMediaOnWeb()`](/docs/web-renderer/render-media-on-web) can render video to MP4, WebM, MKV and MOV, as well as audio-only output to WAV, MP3, AAC, OGG and FLAC. The available video codecs are `H.264`, `H.265`, `VP8`, `VP9` and `AV1`. Encoding support depends on the browser. Use [`canRenderMediaOnWeb()`](/docs/web-renderer/can-render-media-on-web) to check whether a specific container and codec combination is supported.
**Codecs supported for [`<Video>`](/docs/media/video):** Remotion uses WebCodecs and [Mediabunny](/docs/mediabunny) for playback. See the [Supported formats and codecs for `@remotion/media`](/docs/media/support) page for more details.
diff --git a/packages/docs/docs/videos/transparency.mdx b/packages/docs/docs/videos/transparency.mdx
index 8c9468cca8..ab03779499 100644
--- a/packages/docs/docs/videos/transparency.mdx
+++ b/packages/docs/docs/videos/transparency.mdx
@@ -7,30 +7,32 @@ crumb: 'How To'
You can embed transparent videos in Remotion.
-## With an alpha channel
+## With `@remotion/media`
-To embed a video which has an alpha channel, use the [`<OffthreadVideo>`](/docs/offthreadvideo) component with the [`transparent`](/docs/offthreadvideo#transparent) prop.
+Transparent videos with an alpha channel are natively supported by [`<Video>` from `@remotion/media`](/docs/media/video).
-```tsx twoslash
+```tsx twoslash title="MyComp.tsx"
import React from 'react';
-import {OffthreadVideo, staticFile} from 'remotion';
+import {Video} from '@remotion/media';
+import {staticFile} from 'remotion';
export const MyComp: React.FC = () => {
- return <OffthreadVideo src={staticFile('transparent.webm')} transparent />;
+ return <Video src={staticFile('transparent.webm')} />;
};
```
## Without an alpha channel
-To embed a video which does not have an alpha channel but just a black background, add `mixBlendMode: "screen"` to the [`style`](/docs/offthreadvideo#style) prop of the [`<OffthreadVideo>`](/docs/offthreadvideo) component.
+To embed a video which does not have an alpha channel but has a black background, add `mixBlendMode: "screen"` to the [`style`](/docs/media/video#style) prop of the [`<Video>`](/docs/media/video) component.
-```tsx twoslash
+```tsx twoslash title="MyComp.tsx"
import React from 'react';
-import {OffthreadVideo, staticFile} from 'remotion';
+import {Video} from '@remotion/media';
+import {staticFile} from 'remotion';
export const MyComp: React.FC = () => {
return (
- <OffthreadVideo
+ <Video
src={staticFile('nottransparent.mp4')}
style={{
mixBlendMode: 'screen',
@@ -40,6 +42,19 @@ export const MyComp: React.FC = () => {
};
```
+## With `<OffthreadVideo>`
+
+To embed a video with an alpha channel using [`<OffthreadVideo>`](/docs/offthreadvideo), enable the [`transparent`](/docs/offthreadvideo#transparent) prop.
+
+```tsx twoslash title="MyComp.tsx"
+import React from 'react';
+import {OffthreadVideo, staticFile} from 'remotion';
+
+export const MyComp: React.FC = () => {
+ return <OffthreadVideo src={staticFile('transparent.webm')} transparent />;
+};
+```
+
## Greenscreen effect
To remove a background based on the color of the pixels, see the [Greenscreen](/docs/greenscreen) page.
diff --git a/packages/docs/docs/visualize-audio.mdx b/packages/docs/docs/visualize-audio.mdx
index 48fdabe1af..8a6d12d7f8 100644
--- a/packages/docs/docs/visualize-audio.mdx
+++ b/packages/docs/docs/visualize-audio.mdx
@@ -67,9 +67,10 @@ Usually the values on left side of the array can become much larger than the val
In this example, we render a bar chart visualizing the audio spectrum of an audio file we imported using [`useAudioData()`](/docs/use-audio-data) and `visualizeAudio()`.
-```tsx twoslash
+```tsx twoslash title="MyComponent.tsx"
+import {Audio} from '@remotion/media';
import {useAudioData, visualizeAudio} from '@remotion/media-utils';
-import {Html5Audio, staticFile, useCurrentFrame, useVideoConfig} from 'remotion';
+import {staticFile, useCurrentFrame, useVideoConfig} from 'remotion';
export const MyComponent: React.FC = () => {
const frame = useCurrentFrame();
@@ -91,7 +92,7 @@ export const MyComponent: React.FC = () => {
// the longer the bar
return (
<div>
- <Html5Audio src={staticFile('music.mp3')} />
+ <Audio src={staticFile('music.mp3')} />
{visualization.map((v) => {
return <div style={{width: 1000 * v, height: 15, backgroundColor: 'blue'}} />;
})}
@@ -152,5 +153,5 @@ const amplitudes = frequencyData.map((value) => {
- [Audio visualization](/docs/audio/visualization)
- [`useAudioData()`](/docs/use-audio-data)
- [`getAudioData()`](/docs/get-audio-data)
-- [`<Html5Audio/>`](/docs/html5-audio)
+- [`<Audio>`](/docs/media/audio)
- [Using audio](/docs/using-audio)