Skip to content

πŸŽ₯ Make videos programmatically with React

cool

Jonny Burger6b8b5467a1d4
diff --git a/packages/docs/docs/miscellaneous/snippets/hls.mdx b/packages/docs/docs/miscellaneous/snippets/hls.mdx
index 0f0dd88893..12a0ce4d7c 100644
--- a/packages/docs/docs/miscellaneous/snippets/hls.mdx
+++ b/packages/docs/docs/miscellaneous/snippets/hls.mdx
@@ -1,14 +1,14 @@
---
image: /generated/articles-docs-miscellaneous-snippets-hls.png
title: 'HLS support (HTTP Live Streaming)'
-sidebar_label: 'HTTP Live Streaming'
+sidebar_label: 'HLS'
id: hls
crumb: 'Video'
---
-## Using `<Video>` from `@remotion/media`<AvailableFrom v="4.0.TBD" />
+# HLS support<AvailableFrom v="4.0.TBD" />
-[`<Video>`](/docs/media/video) from [`@remotion/media`](/docs/media) supports HLS / HTTP Live Streaming / `.m3u8` files natively via [Mediabunny](https://mediabunny.dev).
+[`<Video>`](/docs/media/video) from [`@remotion/media`](/docs/media) supports HLS / `.m3u8` files natively via [Mediabunny](https://mediabunny.dev).
Simply pass an `.m3u8` URL as the `src` prop:
@@ -28,78 +28,23 @@ export const HlsExample = () => {
This works across all browsers and during rendering.
When a master playlist with multiple quality variants is used, Remotion will automatically select the highest-quality video track and its accompanying audio.
-:::note
-Only VOD (Video on Demand) HLS playlists are supported.
-Live HLS streams are not supported.
-:::
-
-## Legacy approaches
-
-The following approaches are still available but are no longer recommended now that native HLS support is available.
-
-### Using hls.js to play HLS videos during Preview
-
-You can play HLS videos during preview in the [`<Player>`](/docs/player) and in the Remotion Studio.
-
-Note the following caveats:
-
-<Step>1</Step> This code only shows how to connect the video tag to the HLS stream, it has not been tested on a real project. <br />
-<Step>2</Step> Audio will not work when rendering a video to an MP4 using this code. Use an alternative source during rendering.
-<br /> See [ Using a different tag in preview and rendering](/docs/video-tags#using-a-different-tag-in-preview-and-rendering) and [`useRemotionEnvironment()`](/docs/use-remotion-environment) for how to use different components based on whether you are rendering or previewing.
-<br />
-
-```tsx twoslash title="HlsDemo.tsx"
-import Hls from 'hls.js';
-import React, {useEffect, useRef} from 'react';
-import {AbsoluteFill, RemotionVideoProps, Html5Video} from 'remotion';
-
-const HlsVideo: React.FC<RemotionVideoProps> = ({src}) => {
- const videoRef = useRef<HTMLVideoElement>(null);
-
- useEffect(() => {
- if (!src) {
- throw new Error('src is required');
- }
-
- const startFrom = 0;
-
- const hls = new Hls({
- startLevel: 4,
- maxBufferLength: 5,
- maxMaxBufferLength: 5,
- });
+## Track selection
- hls.on(Hls.Events.MANIFEST_PARSED, () => {
- hls.startLoad(startFrom);
- });
+Is currently not implemented by Remotion.
+Currently, the highest-quality video track and its accompanying audio are selected automatically.
- hls.loadSource(src);
- hls.attachMedia(videoRef.current!);
+## Live streams
- return () => {
- hls.destroy();
- };
- }, [src]);
+Are not supported by Remotion.
+Any live HLS videos will be rejected.
+See: [Can Remotion be used for live streaming?](/docs/miscellaneous/live-streaming).
- return <Html5Video ref={videoRef} src={src} />;
-};
-
-export const HlsDemo: React.FC = () => {
- return (
- <AbsoluteFill>
- <HlsVideo src="https://stream.mux.com/nqGuji1CJuoPoU3iprRRhiy3HXiQN0201HLyliOg44HOU.m3u8" />
- </AbsoluteFill>
- );
-};
-```
-
-## Native support in Chrome v142+
-
-As of Chrome v142 (October 2025), Chrome supports native HLS playback.
-This means [`<OffthreadVideo />`](/docs/offthreadvideo) can play HLS / HTTP Live streaming / `.m3u8` files natively during preview (not rendering) without any additional setup in Chrome browsers.
+:::note
+Only VOD (Video on Demand) HLS playlists are supported.
+Live HLS streams are not supported.
+:::
## See also
- [`<Video>` from `@remotion/media`](/docs/media/video)
- [Mediabunny HLS reading guide](https://mediabunny.dev/guide/reading-hls)
-- [GitHub issue for this feature request](https://github.com/remotion-dev/remotion/issues/2930)
diff --git a/packages/docs/docs/video-tags.mdx b/packages/docs/docs/video-tags.mdx
index 9220c6bdae..fec9141bf8 100644
--- a/packages/docs/docs/video-tags.mdx
+++ b/packages/docs/docs/video-tags.mdx
@@ -7,28 +7,28 @@ crumb: '<Video>, <Html5Video>, <OffthreadVideo>'
We offer three components for embedding videos into your Remotion composition:
-- [`<OffthreadVideo />`](/docs/offthreadvideo) - **our recommendation**, based on a Rust-based frame extractor
+- [`<OffthreadVideo />`](/docs/offthreadvideo) - **our recommendation for now**, based on a Rust-based frame extractor
- [`<Html5Video />`](/docs/html5-video) from [`remotion`](/docs/remotion) (previously named `<Video>`) - based on the HTML5 `<video>` element
-- [`<Video />`](/docs/media/video) from [`@remotion/media`](/docs/media) - an experimental WebCodecs-based component, set to become the default
+- [`<Video />`](/docs/media/video) from [`@remotion/media`](/docs/media) - a WebCodecs-based component, **soon to become the default**
This page offers a comparison to help you decide which tag to use.
-| | [`<OffthreadVideo />`](/docs/offthreadvideo) | [`<Html5Video />`](/docs/html5-video) <br/> [`<Html5Audio />`](/docs/html5-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>` | WebCodecs |
-| **Render Speed** | Fast | Medium | <span style={{color: 'green', fontWeight: 'bold'}}> Fastest </span> |
+| | [`<OffthreadVideo />`](/docs/offthreadvideo) | [`<Html5Video />`](/docs/html5-video) <br/> [`<Html5Audio />`](/docs/html5-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>` | 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`, `.m3u8`, `.mkv`, `.mov`, `.mp3`, `.mp4`, `.ogg`, `.wav`, `.webm` <br/><br/> Fallback to `<OffthreadVideo>` for unsupported containers |
-| **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/> Fallback to `<OffthreadVideo>` for unsupported codecs |
-| **HLS Support** | [Chrome v142+](/docs/miscellaneous/snippets/hls) | [Only during preview](/docs/miscellaneous/snippets/hls) | [βœ… Supported](/docs/miscellaneous/snippets/hls) |
-| **CORS required** | No | No | Yes |
-| **Loopable** | ❌ | βœ… | βœ… |
-| **`playbackRate`** <br/> (Speed Change) | βœ… | βœ… | βœ… |
-| **`toneFrequency`** <br/> (Pitch Change) | Only during rendering | Only during rendering | Only during rendering |
-| **[Three.js texture](/docs/videos/as-threejs-texture)** | [`useOffthreadVideoTexture()`](/docs/use-offthread-video-texture) | [ `useVideoTexture()` ](/docs/use-video-texture) | [Snippet](/docs/videos/as-threejs-texture) - works best |
-| **[Client-side rendering](/docs/client-side-rendering)** | ❌ | ❌ | βœ… |
+| **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/> Fallback to `<OffthreadVideo>` for unsupported codecs |
+| **HLS Support** | [Chrome v142+](/docs/miscellaneous/snippets/hls) | [Only during preview](/docs/miscellaneous/snippets/hls) | [βœ… Supported](/docs/miscellaneous/snippets/hls) |
+| **CORS required** | No | No | Yes |
+| **Loopable** | ❌ | βœ… | βœ… |
+| **`playbackRate`** <br/> (Speed Change) | βœ… | βœ… | βœ… |
+| **`toneFrequency`** <br/> (Pitch Change) | Only during rendering | Only during rendering | Only during rendering |
+| **[Three.js texture](/docs/videos/as-threejs-texture)** | [`useOffthreadVideoTexture()`](/docs/use-offthread-video-texture) | [ `useVideoTexture()` ](/docs/use-video-texture) | [Snippet](/docs/videos/as-threejs-texture) - works best |
+| **[Client-side rendering](/docs/client-side-rendering)** | ❌ | ❌ | βœ… |
## Using a different tag in preview and rendering