🎥 Make videos programmatically with React
explain webcodecs relation to ffmpeg
Jonny Burgeree90a2647df1
diff --git a/packages/docs/docs/mediabunny.mdx b/packages/docs/docs/mediabunny.mdxindex dcd4546ab4..5cb7331568 100644--- a/packages/docs/docs/mediabunny.mdx+++ b/packages/docs/docs/mediabunny.mdx@@ -1,6 +1,6 @@---image: /generated/articles-docs-mediabunny-migration.png-id: mediabunny-migration+id: mediabunnytitle: Remotion and Mediabunnycrumb: 'Migration'sidebar_label: Mediabunnydiff --git a/packages/docs/docs/webcodecs/misconceptions.mdx b/packages/docs/docs/webcodecs/misconceptions.mdxindex 80b73196a7..3b1d0d59cb 100644--- a/packages/docs/docs/webcodecs/misconceptions.mdx+++ b/packages/docs/docs/webcodecs/misconceptions.mdx@@ -14,7 +14,7 @@ This page clears up some common misconceptions surrounding the topic of WebCodecMaybe this confusion comes up because both APIs start with ‘Web’, or from the fact that multimedia operations are low-level.Or it’s because FFmpeg writes their code in [handwritten assembly](https://x.com/search?q=from%3Affmpeg%20handwritten%20assembly&src=typed_query), or because [ffmpeg.wasm](https://github.com/ffmpegwasm/ffmpeg.wasm) as a library exists.-Fact is: WebCodecs has nothing to do with WebAssembly!+Fact is: WebCodecs has nothing to do with WebAssembly!WebAssembly is used to bring over code written in native languages to the web, but all the hardware-specific optimizations are stripped, so it's not suitable for multimedia.@@ -26,8 +26,9 @@ Bonus confusion: Handwritten assembly is not the same as WebAssembly</summary>For example, if FFmpeg writes fast assembly code for the `armv9` instruction set, it cannot be used because WebAssembly code runs in the browser and must therefore support all CPU architectures, meaning that only a common denominator of CPU-instructions can be used.- The optimizations for `armv9` will be entirely removed when FFmpeg is compiled to WebAssembly.+The optimizations for `armv9` will be entirely removed when FFmpeg is compiled to WebAssembly.Think of WebAssembly as another compilation target alongside x86, ARM etc., rather than associate it with Assembly languages.+</details>## WebCodecs has nothing to do with WebGPU@@ -43,18 +44,13 @@ So, fortunately we don’t have to use WebGPU to make our own decoders and encodRather, we just need an interface to make use of the already existing ones, and that interface is WebCodecs.<details>-<summary>-Bonus confusion: The GPU is used less often than you think-</summary>+ <summary>Bonus confusion: The GPU is used less often than you think</summary>For encoding videos, the CPU is often preferred, because it leads to better compression. With GPU encoding, you either get a larger file size or a worse video quality. However, it is faster!</details>-<details>-<summary>-Fine print: There is interopability between WebCodecs and WebGPU-</summary>-You can [import a frame that you extracted with WebCodecs into a WebGPU texture](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/importExternalTexture). So WebCodecs and WebGPU are tangentially connected, just not in the way most people imagine.+ <summary>Fine print: There is interopability between WebCodecs and WebGPU</summary>+ You can [import a frame that you extracted with WebCodecs into a WebGPU texture](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/importExternalTexture). So WebCodecs and WebGPU are tangentially connected, just not in the way most people imagine.</details>## JavaScript can be faster than WebAssembly@@ -74,3 +70,8 @@ At least for now, WebCodecs is an API that is only available in web browsers.We tried to see if the C++ WebCodecs implementation of Chromium can be easily extracted into a module that may then be used in other contexts, but it is heavily connected to other Chromium code.Using WebCodecs outside of the web browser is probably not so interesting anyways – in these contexts you already can natively use FFmpeg with its full performance.++## Does WebCodecs use FFmpeg under the hood?++Some browsers use the [`libavcodec`](https://en.wikipedia.org/wiki/Libavcodec) library, which is part of FFmpeg, under the hood.+The whole story has more nuances to it. Check out this tweet by [Vanilagy](https://x.com/vanilagy/status/1962427445706908127) for an in-depth explanation!