🎥 Make videos programmatically with React
add docs
Jonny Burger3a2658adafa4
diff --git a/packages/docs/docs/webcodecs/convert-audiodata.mdx b/packages/docs/docs/webcodecs/convert-audiodata.mdxindex 7185f63ba8..0efdde211b 100644--- a/packages/docs/docs/webcodecs/convert-audiodata.mdx+++ b/packages/docs/docs/webcodecs/convert-audiodata.mdx@@ -51,3 +51,24 @@ const newAudioData = convertAudioData({audioData, newSampleRate: 22050});- The new sample rate must be between 3000 and 768000.- If no conversion is needed (same sample rate and format), the original `AudioData` is cloned.- No cleanup is done on either the input or output `AudioData` (call [`close()`](https://developer.mozilla.org/en-US/docs/Web/API/AudioData/close) on them yourself).++## API++Takes an object with the following properties:++### `audioData`++The [`AudioData`](https://developer.mozilla.org/en-US/docs/Web/API/AudioData) object to convert.++### `newSampleRate?`++The new sample rate. Must be between 3000 and 768000 (only Chrome enforces this technically, but Remotion will throw an error always).++### `newFormat?`++The new format.++## See also++- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/webcodecs/src/convert-audiodata.ts)+- [convertMedia()](/docs/webcodecs/convert-media)diff --git a/packages/docs/docs/webcodecs/resample-audio-16khz.mdx b/packages/docs/docs/webcodecs/resample-audio-16khz.mdxindex 604deb9f5f..656ab7b32e 100644--- a/packages/docs/docs/webcodecs/resample-audio-16khz.mdx+++ b/packages/docs/docs/webcodecs/resample-audio-16khz.mdx@@ -1,11 +1,14 @@---+image: /generated/articles-docs-webcodecs-resample-audio-16khz.pngid: resample-audio-16khztitle: Resample audio to 16kHzslug: /webcodecs/resample-audio-16khzcrumb: '@remotion/webcodecs'----For using Whisper, Whisper.cpp, [`@remotion/install-whisper-cpp`](/docs/webcodecs/install-whisper-cpp) and Whisper.wasm, you need to provide a 16-bit, 16KHz, WAVE audio file. This page describes approaches for converting your audio in the browser and on the server.+For using Whisper, Whisper.cpp, [`@remotion/install-whisper-cpp`](/docs/webcodecs/install-whisper-cpp) and Whisper.wasm, you need to provide a 16-bit, 16KHz, WAVE audio file.++This page describes approaches for converting your audio in the browser and on the server.## In the browser@@ -14,7 +17,7 @@ You can use [`convertMedia()`](/docs/webcodecs/convert-media) to convert any ofimport {LicenseDisclaimer} from './LicenseDisclaimer';<details>- <summary>💼 Important @remotion/webcodecs License Disclaimer</summary>+ <summary>💼 Important `@remotion/webcodecs` License Disclaimer</summary><LicenseDisclaimer /></details>@@ -29,6 +32,7 @@ const output = await convertMedia({await canReencodeAudioTrack({audioCodec: 'wav',track,+ // Ignore this, bitrate is not used for WAV filesbitrate: 128000,sampleRate: 16000,})@@ -41,13 +45,14 @@ const output = await convertMedia({};}+ // If this conversion is not supported, return an errorreturn {type: 'fail',};},});-const blob = await output.save(); // returns a Blob+const blob = await output.save(); // returns a `Blob````## On the server@@ -63,3 +68,7 @@ If you don't want to install FFmpeg, you can also use the [smaller FFmpeg binary```bashnpx remotion ffmpeg -i input.mp4 -ar 16000 output.wav -y```++## On remotion.dev/convert++If you are looking for a GUI, [remotion.dev/convert](https://remotion.dev/convert) is our free offering that allows you to convert your audio to a 16-bit, 16KHz, WAVE file, powered by [`@remotion/webcodecs`](/docs/webcodecs), offline and fast.diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex 66fe6c0889..19f6aebac2 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -6045,6 +6045,15 @@ export const articles = [noAi: false,slug: 'webcodecs/pause-resume-abort',},+ {+ id: 'resample-audio-16khz',+ title: 'Resample audio to 16kHz',+ relativePath: 'docs/webcodecs/resample-audio-16khz.mdx',+ compId: 'articles-docs-webcodecs-resample-audio-16khz',+ crumb: '@remotion/webcodecs',+ noAi: false,+ slug: 'webcodecs/resample-audio-16khz',+ },{id: 'resize-a-video',title: 'Resize a video',diff --git a/packages/docs/static/generated/articles-docs-webcodecs-resample-audio-16khz.png b/packages/docs/static/generated/articles-docs-webcodecs-resample-audio-16khz.pngnew file mode 100644index 0000000000..57e5820cc1Binary files /dev/null and b/packages/docs/static/generated/articles-docs-webcodecs-resample-audio-16khz.png differ