Skip to content

🎥 Make videos programmatically with React

finish blog post

Jonny Burgerdc72e487efbd
diff --git a/packages/docs/blog/2021-04-15-remotion-2-0.md b/packages/docs/blog/2021-04-15-remotion-2-0.md
index 8a1606bb89..27fa6451c1 100644
--- a/packages/docs/blog/2021-04-15-remotion-2-0.md
+++ b/packages/docs/blog/2021-04-15-remotion-2-0.md
@@ -29,40 +29,32 @@ Read more about [audio visualization](/docs/audio-visualization) in the docs or
## Export as MP3, AAC, WAV
-You can now also completely omit the video from the output and only emit an audio file. Yes, Remotion can also be used as an audio editing program! Pass `mp3`, `aac` or `wav` as a codec [using the `--codec` flag](/docs/cli#flags) or [in your config file](/docs/config#setcodec)
+You can now also completely omit the video from the output and only emit an audio file. Yes, Remotion can also be used as an audio editing program! Pass `mp3`, `aac` or `wav` as a codec [using the `--codec` flag](/docs/cli#flags) or [in your config file](/docs/config#setcodec).
-## `remotion/media-utils` package
+## `@remotion/media-utils` package
-with Remotion 2.0 we are introducing a new remotion package called `@remotion/media-utils` with new audio and video metadata api.
+This is a new helper package which includes functions useful for dealing with audio. Besides audio visualization, you can also for example measure the duration of an audio or video source, which is really useful for making a composition duration dynamic. The functions included are [`getAudioData()`](/docs/get-audio-data), [`getAudioDuration()`](/docs/get-audio-duration), [`getVideoMetadata()`](/docs/get-video-metadata), [`getWaveformPortion()`](/docs/get-waveform-portion), [`visualizeAudio()`](/docs/visualize-audio) and [`useAudioData()`](/docs/use-audio-data).
-- [`getAudioData()`](/docs/get-audio-data) Takes an audio `src`, loads it and returns data and metadata for the specified source.
-
-- [`getAudioDuration()`](/docs/get-audio-duration) Gets the duration in seconds of an audio source. Remotion will create an invisible `<Audio>` tag, load the audio and return the duration.
-
-- [`getVideoMetadata()`](/docs/get-video-metadata) Takes a `src` to a video, loads it and returns metadata for the specified source.
-
-- [`getWaveformPortion()`](/docs/get-waveform-portion) Takes bulky waveform data (for example fetched by `getAudioData()`) and returns a trimmed and simplified version of it, for simpler visualization.
-
-- [`useAudioData()`](/docs/use-audio-data) This convienience function wraps the [`getAudioData()`](/docs/get-audio-data) function into a hook and does 3 things. **1**. Keeps the audio data in a state **2**. Wraps the function in a [`delayRender()` / `continueRender()`](/docs/data-fetching) pattern **3**. Handles the case where the component gets unmounted while the fetching is in progress and a React error is thrown.
-
-- [`visualizeAudio()`](/docs/visualize-audio) This function takes in `AudioData` (preferrably fetched by the `useAudioData()` hook) and processes it in a way that makes visualizing the audio that is playing at the current frame easy.
+All of them except the last one are completely independent from the ideas of Remotion, so they might be a great fit for your other non-Remotion projects as well!
## Rich Timeline
-The [**rich timeline**](/docs/timeline) will render additional frames to gather enough information to visualize a full timeline.
+With the normal timeline, you don't see the full picture of all the media that you have placed in your composition. The reason is that the visualization you see is based on what's currently rendered at the position of your playhead.
+
+Introducing a new mode, the [**rich timeline**](/docs/timeline) will render additional frames other than the current one to gather enough information to visualize a full timeline.
Sequences which are normally not rendered because the playback head is not within the time range of the sequence, will appear because Remotion is doing an additional render at a time where the sequence is visible.
<img src="/img/timeline.png"></img>
-By default **rich timeline** feature is enabled. You may switch between `rich timeline` and `simple timeline` by clicking the icon with the three lines.
+By default the **rich timeline** feature is enabled. You may switch between the rich timeline and simple timeline by clicking the icon with the three lines.
<img src="/img/timeline-toggle.png"></img>
## ESBuild loader
-In Remotion 2.0, the traditional transpilation of Javascript and Typescript using the `babel-loader` has been replaced by the faster `esbuild-loader` by default.
+We have replaced the traditional transpilation of Javascript and Typescript using the `babel-loader` has been replaced by the faster `esbuild-loader` by default.
-If you for some reason need to go back to the previous behavior, you may [override the Webpack configuration](/docs/webpack). Read more about [legacy babel loader](/docs/legacy-babel).
+This will speed up bundling by a lot - hopefully you won't notice any other differences! If you for some reason need to go back to the previous behavior, you may install the [legacy babel webpack configuration](/docs/legacy-babel) and override the Webpack config.
<div>
<video width="100%" height="100%" controls playsinline autoplay="true" muted loop>
@@ -72,40 +64,59 @@ If you for some reason need to go back to the previous behavior, you may [overri
## Webpack caching
+Even though transpilation is done using ESBuild now, Webpack is still used for bundling. We rely on awesome features that Webpack provides such as Hot Module Replacement, asset importing, it's strong loader ecosystem and now it's caching features.
+
+When you run `npm run build` for the first time, you will get a message that a cache is building. From the second time on, bundling will be much faster, even if you change your code. You shouldn't have to ever do it, but you can [opt out of caching](/docs/config#setcachingenabled).
+
## Partial video rendering + Stills
-Want to render partial video or a still for thumbnail? You can do that with Remotion 2.0. We introduced a new cli option `--frames` to render a subset or a still of a video.
+Want to render partial video or a still for thumbnail? You can do that with Remotion 2.0. We introduced a new CLI flag `--frames` to render a subset or a still of a video.
`--frames=0-9` (To select the first 10 frames) or `--frames=50` (To render a still of the 51st frame).
Learn more about [`--frames`](/docs/config#setframerange) cli options.
-## `<Gif />` component
+## `@remotion/gif` component
-With Remotion 2.0 we have supports for `gif` component as a standalone npm package `@remotion/gif`. **`@remotion/gif`** exports `<Gif />` component for displaying GIFs that synchronize with Remotions `useCurrentFrame()`.
+A new GIF component released in the `@remotion/gif` package is now available. The `<Gif />` component allows to load a local or remote GIF and synchronizes with Remotions `useCurrentFrame()`. For that it parses the GIF using WebAssembly - basically it's really cool tech! Thanks a lot to [@jeetiss](https://github.com/jeetiss) for contributing this new component.
-Learn more about [`<Gif />`](/docs/gif) APIs.
+[Learn more about the GIF component here](/docs/gif).
-## Resizable panels
+## Resizable editor panels
-## interpolate()
+In the editor, you can now resize the timeline as well as the left sidebar. Thanks a lot to [Arthur Denner](https://github.com/arthurdenner) for this awesome contribution!
-`interpolate()` in Remotion 2.0 supports number array (array length >= 2) in input and outpur range. Make sure the length or input and output array length is same.
+## interpolate()
-From Remotion 2.0 onwards you can do something like this.
+`interpolate()` now supports arrays with lengths that are longer than 2. Really useful - for example you can create a fade in and fade out transition with one line.
```tsx
-const opacity = interpolate(input, [0, 10, 20], [0, 0.7, 1]) //0.7
+const opacity = interpolate(frame, [0, 10, durationInFrames - 10, durationInFrames], [0, 1, 1, 0])
```
-## 174 tests added
+## 170+ tests added
+
+While not strictly a new feature, this is definitely worth mentioning.
+
+[Calvin Falter](https://github.com/calvin-f), [Jonas Brunner](https://github.com/j0nezz) and [Tobias Boner](https://github.com/dydent) took Remotion as their project for their university seminar and contributed over 100 tests, strengthening the code and ironing out edge cases.
+
+[@cnnr](https://github.com/cnnrhill) contributed a really cool test that tests the video seeking of Remotion and makes sure it is frame-accurate by matching the colors in each frame.
-on remotion 1.5.4 we had total 43 tests including core (14 tests), renderer (1 tests), root (3 tests) and eslint-plugin (25 tests). In remotion 2.0 we added 174 more tests to make our development faster it now contains a total of 217 tests including core (147 tests), eslint-plugin (25 tests), renderer (31 tests) and root (14 tests).
+The remaining added tests are testing the tricky parts of audio rendering. Thanks to test-driven development, we've been able to catch regression and ship really solid audio support.
+
+On Remotion 1.5.4 we had total 43 tests, in Remotion 2.0 we added a total of 174 tests to come out at a total of 217.
## Fixed: Frame seeking
-## Upgrade
+In Remotion 1.x, a `<Video/>` would not always perfectly synchronize with Remotions time during render. This is now fixed and validated by tests that scan the color of the output frames - [however not in the most efficient way](https://github.com/JonnyBurger/remotion/issues/200). Help on improving it further is still welcome.
+
+## Breaking changes and upgrade
-[Migration guide](/docs/2-0-migration)
+We've taken this opportunity of a major release to introduce some breaking changes that we think are beneficial for an awesome future of Remotion. Please take a moment to read through the [2.0 Migration guide](/docs/2-0-migration) and see if you are affected.
## The future
+
+Most of the core functionality for making videos in React is now implemented.
+This gives us time to focus on improving all the areas around it - we are talking better documentation, developer experience, examples, abstractions on top or Remotion, improving speed and reliability of Remotion.
+
+Furthermore, we want to provide a way to embed Remotion compositions in traditional web apps and to make server-side rendering easier - stay tuned!
diff --git a/packages/media-utils/package.json b/packages/media-utils/package.json
index 1f9d2bdcdb..91c201eb7b 100644
--- a/packages/media-utils/package.json
+++ b/packages/media-utils/package.json
@@ -17,7 +17,7 @@
"url": "https://github.com/JonnyBurger/remotion"
},
"dependencies": {
- "remotion": "^1.5.0"
+ "remotion": ">=1.5.0"
},
"peerDependencies": {
"react": "^17.0.1",