packages/docs/blog/2022-11-17-remotion-3-3.mdx
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import {NewMuxVideo} from '../src/components/MuxVideo'; import {TableOfContents} from '../docs/paths/table-of-contents'; import {FfmpegVideo} from '../components/FFmpegVideo';
Now, when you are rendering a video and don't have FFmpeg installed, Remotion will download a copy for you. Previously, installing FFmpeg required 7 steps on Windows and took several minutes when using Homebrew on macOS.
<FfmpegVideo />When deploying Remotion on a server, you can now also let Remotion install FFmpeg for you using the ensureFfmpeg() API or the npx remotion install ffmpeg command. Learn more about FFmpeg auto-install here.
@remotion/google-fonts packageIt is now easy to import Google Fonts into Remotion! @remotion/google-fonts takes care of correct loading, and is fully type-safe!
@remotion/motion-blur packageThis package contains two components: <Trail> and <CameraMotionBlur>, assisting you with achieving awesome motion blur effects!
A quick demo of what is now called <Trail>:
<NewMuxVideo muxId="XPgKwILbTR4jZPxuR2ewfKjRF9cnThudkXPIkSSvQBM" style={{ width: '100%', }} controls />
@remotion/noise packageThis package offers easy, type-safe, pure functions for getting creative with noise. Check out our playground to see what you can do with it!
A video demo of how you can create interesting effects with noise:
<NewMuxVideo muxId="5o013raWoyw1Jv01MJo02INMEQ5scAt01PveIQ800yYkEhQk" style={{ width: '100%', }} controls />
@remotion/paths packageThis package offers utilities for animating and manipulating SVG paths! With 9 pure, type-safe functions, we cover many common needs while working with SVG paths:
<TableOfContents />By pressing <kbd>Cmd+K</kbd>, you can trigger a new Quick Switcher. It has three functions:
> followed by an item in the menu bar to trigger that action.? followed by a search term to query the docs.<NewMuxVideo muxId="t00Mj7y1CLLGjaMvQyoBqcjdy4PIzVrFaT4317fKbzx00" style={{ width: '100%', }} controls />
<Sequence> makes from optional, accepts style and ref<Sequence from={0}> can now be shortened to <Sequence>. Our ESLint plugin was updated to suggest this refactor automatically.
You can now also style a sequence if you did not pass layout="none".
A ref can be attached to <Sequence> and <AbsoluteFill>.
loop propThe <Video> and <Audio> components now support the loop property.
When starting the Remotion Preview, it now shows on which URL the preview is running. The Webpack output is now also cleaner.
If your device supports multitouch, you can now pinch to zoom the composition. Alternatively, you can hold <kbd>Ctrl</kbd>/<kbd>Cmd</kbd> and use your scrollwheel to zoom.
Using two fingers, you can move the canvas around and pressing <kbd>0</kbd> will reset the canvas. For the latter, there is also a button in the top-right corner that you can click.
<NewMuxVideo muxId="5I01hwK6hs7w0200Ho1KNho7rfU700UVKYDnd7FItANR32U" style={{ width: '100%', }} controls />
Pressing <kbd>?</kbd> to reveal the keyboard shortcuts now has a secondary function: You can type in any term to search the Remotion documentation!
Previously, a Remotion CLI command looked like this:
npx remotion render src/index.tsx my-comp output.mp4
We now allow you to skip the output name, in this case the render would land in out/my-comp.mp4 by default:
npx remotion render src/index.tsx my-comp
You can also omit the composition name and Remotion will ask which composition to render:
npx remotion render src/index.tsx
:::note Experimental: We might change the behavior to rendering all compositions in the future. :::
Finally, you can also omit the entry point and Remotion will take an educated guess!
npx remotion render
If you deviate from the defaults of our templates, you can set an entry point in your config file and leave it out from Remotion commands.
If you change values in your .env file, the Remotion Preview will reload and pick them up without having to restart.
When quitting the Remotion Preview using Ctrl+C, for example to render a video, A new popup will signalize that Fast Refresh will not work anymore.
--muted renderThis new flag can be passed to a render to ignore the audio. If you know that your video has no audio, this can make your render faster.
--enforce-audio-trackWhen no audio was detected in your video, the audio will now be dropped (except on Lambda). With this new flag, you can enforce that a silent audio track is added.
--audio-bitrate and --video-bitrateThese flags allow you to set a target bitrate for audio or video. Those flags are not recommended though, use --crf instead.
--height and --width flagsUsing these flags, you can ignore the width and height you have defined for your output, and override it. The difference to --scale is that the viewport and therefore the layout may actually change.
If you add --log=verbose, the slowest frames are shown in order, so you can optimize them. Slowest frames are also available for renderMedia() using the onSlowestFrames callback.
When rendering a still, you may now pass a negative frame number to refer to frames from the back of the video. -1 is the last frame of a video, -2 the second last, and so on.
The FFmpeg command that Remotion executes under the hood can now be overriden reducer-style.
If a render crashes due to being resource-intensive (see: Target closed), Remotion will now retry each failed frame once, to prevent long renders from failing on low-resource machines.
renderMedia()Previously, the progress for rendering and encoding was reported individually. There is a new field, simply named progress, in the onProgress callback that you can use to display progress without calculating it yourself.
Previously, bundle() accepted three arguments: entryPoint, onProgress and options.
import {bundle} from '@remotion/bundler';
bundle('./src/index.ts', (progress) => console.log(progress), {
publicDir: process.cwd() + '/public',
});
Since getting the progress was less important than some of the options, bundle() now accepts an object with options, progress callback and entryPoint altogether:
import {bundle} from '@remotion/bundler';
bundle({
entryPoint: './src/index.ts',
onProgress: (progress) => console.log(progress),
publicDir: process.cwd() + '/public',
});
The previous signature is still supported.
<Thumbnail> componentThe new <Thumbnail> component is like the <Player>, but for rendering a preview of a still. You can use it to display a specific frame of a video without having to render it.
import React from 'react';
const MyComp: React.FC = () => null;
// ---cut---
import {Thumbnail} from '@remotion/player';
const MyApp: React.FC = () => {
return (
<Thumbnail
component={MyComp}
compositionWidth={1920}
compositionHeight={1080}
frameToDisplay={30}
durationInFrames={120}
fps={30}
style={{
width: 200,
}}
/>
);
};
frameupdate eventIn addition to timeupdate, you can subscribe to frameupdate, which fires whenever the current frame changes. You can use it for example to render a custom frame-accurate time display.
If the Player is displayed in a narrow container, the volume control now goes upwards instead of to the right, in order to save some space.
<video src="https://pub-646d808d9cb240cea53bedc76dd3cd0c.r2.dev/responsivevolume.mov" autoPlay loop muted playsInline />Using the imperative getScale() method, you can now see how big the displayed size is in comparison to the canvas width of the component.
On YouTube, the video always starts with controls shown and then they fade out after a few seconds. We have made this the default behavior in Remotion as well, because users would often not realize that the Player is interactive otherwise. You can control the behavior using initiallyShowControls.
<video src="/img/controlsinitiallyshown.mov" style={{maxWidth: 400, width: '100%'}} autoPlay loop muted playsInline />
Using the inFrame and outFrame props, you can force the Remotion Player to only play a certain section of a video. The rest of the seek bar will be greyed out.
Using renderPlayPauseButton and renderFullscreenButton, you can customize the appearance of the Player more granularly.
You can define the initialFrame on which your component gets mounted on. This will be the default position of the video, however, it will not clamp the playback range like the inFrame prop.
prefetch() APIIn addition to the Preload APIs, prefetch() presents another way of preloading an asset so it is ready to display when it is supposed to appear in the Remotion Player.
import {prefetch} from 'remotion';
const {free, waitUntilDone} = prefetch('https://example.com/video.mp4');
waitUntilDone().then(() => {
console.log('Video has finished loading');
free(); // Free up memory
});
Video and audio tags will automatically use the prefetched asset if it is available. See @remotion/preload vs. prefetch() for a comparison.
The Remix template is our first SaaS template! It includes the Remotion Preview, the Player and Remotion Lambda out of the box to jumpstart you with everything you need to create your app that offers customized video generation.
</img>Get started by running:
<Tabs defaultValue="npm" values={[ { label: 'npm', value: 'npm', }, { label: 'yarn', value: 'yarn', }, { label: 'pnpm', value: 'pnpm', }, ] }> <TabItem value="npm">
npx create-video --remix
yarn create video --remix
pnpm create video --remix
You can now send and receive a webhook when a Lambda render is done or has failed. Examples for Next.js and Express apps have been added and our documentation page features a way to send a test webhook.
Previously, the input props passed to a Lambda render could not be bigger than 256KB when serialized. Now, this limit is lifted, since if the payload is big, it will be stored to S3 instead being passed directly to the Lambda function.
The output videos generated by Lambda can now be saved to other S3-compatible protocols such as DigitalOcean Spaces or Cloudflare R2.
The new deleteRender() API will delete the output video from the S3 bucket, which you previously had to do through the console or with the AWS SDK.
renderMediaOnLambda() params optionalThe following options are now optional:
imageFormat: (defaulting to jpeg)privacy (defaulting to public)maxRetries (defaulting to 1)The new npx remotion benchmark helps you compare different render configurations and find out which one is the fastest. Currently, you can compare different codecs, compositions and concurrency values. Each configuration is run multiple times in order to increase confidence in the results.
We have added new guides that document interesting workflows for Remotion:
We try to avoid jargon, but we have also created a Remotion Terminology page to define some commonly used terms. When using these terms, we will from now link to the terminology page for you to read about it.
The file that was previously called src/Video.tsx in templates is now called src/Root.tsx, because it did not contain a video, but a list of compositions. That component was also renamed from RemotionVideo to RemotionRoot. The new naming makes more sense, because that component is passed into registerRoot().
The new function getGifDurationInSeconds() allows you to get the duration of a GIF.
Using the new direction prop, you can play a Lottie animation backwards.
Should a Lottie animation contain an embedded image, it will now be properly awaited.
The temporary directory that Remotion creates is now completely cleaned up after every render.
Parallel encoding will not be used when a machine has little free RAM. You can also force-disable it using disallowParallelEncoding.
Thank you to these contributors that implemented these awesome features:
@remotion/google-fonts package<Thumbnail> component, for reloading the page when the environment variables change and implementing negative frame indices--height and --width CLI flagsloop prop for Video and Audiodirection property for the Lottie componentMany of these contributions came during Hacktoberfest where we put bounties on GitHub issues. We also want to thank CodeChem for sponsoring a part of those bounties!