Skip to content

🎥 Make videos programmatically with React

Docs: Example costs for renders

Jonny Burger6520f1f2e895
diff --git a/packages/docs/docs/lambda/cost-example.mdx b/packages/docs/docs/lambda/cost-example.mdx
new file mode 100644
index 0000000000..17595b54f1
--- /dev/null
+++ b/packages/docs/docs/lambda/cost-example.mdx
@@ -0,0 +1,111 @@
+---
+image: /generated/articles-docs-lambda-cost-example.png
+id: cost-example
+sidebar_label: Cost example
+title: How much does Remotion Lambda cost?
+crumb: 'Lambda'
+---
+
+This page shows estimations to help you better expect how much Remotion Lambda will cost.
+All renders are done with the following Lambda configuration:
+
+- 2048 MB RAM (default)
+- 10GB Disk size (default from Remotion 5.0)
+- Default [concurrency](/docs/lambda/concurrency)
+- Warm Lambda functions (expect the first render to be more expensive)
+- `us-east-1` region
+
+Prices may also vary based on the region, heavyness of your bundle, fluctuations in latency.
+We always recommend to measure the cost of your composition yourself.
+
+## Rendering the Hello World project
+
+Rendering the [`HelloWorld`](https://github.com/remotion-dev/template-helloworld) composition of our default template.
+
+**Cost**: $0.001
+
+## Rendering a 1 minute Video in the same S3 bucket
+
+```tsx twoslash title="OffthreadRemoteVideo.tsx"
+import {CalculateMetadataFunction, OffthreadVideo, staticFile} from 'remotion';
+
+export const calculateMetadataFn: CalculateMetadataFunction<{}> = async () => {
+ return {
+ durationInFrames: 60 * 30,
+ fps: 30,
+ width: 1280,
+ height: 720,
+ };
+};
+
+export const OffthreadRemoteVideo: React.FC = () => {
+ return <OffthreadVideo src={staticFile('bigbuckbunny.mp4')} />;
+};
+```
+
+[This](https://github.com/remotion-dev/remotion/blob/main/packages/example/public/bigbuckbunny.mp4) is the video file used.
+
+**Cost**: $0.021
+Rendering a video inside your video increases the cost significantly.
+
+## Rendering a 10 minute Remote HD Video
+
+```tsx twoslash title="OffthreadRemoteVideo.tsx"
+import {CalculateMetadataFunction, OffthreadVideo} from 'remotion';
+
+export const calculateMetadataFn: CalculateMetadataFunction<{}> = async () => {
+ return {
+ durationInFrames: 10 * 60 * 30,
+ fps: 30,
+ width: 1280,
+ height: 720,
+ };
+};
+
+export const OffthreadRemoteVideo: React.FC = () => {
+ return (
+ <OffthreadVideo src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" />
+ );
+};
+```
+
+**Cost**: $0.162
+
+## Rendering a 10 second Remote 4K Video
+
+```tsx twoslash title="OffthreadRemoteVideo.tsx"
+import {CalculateMetadataFunction, OffthreadVideo} from 'remotion';
+
+export const calculateMetadataFn: CalculateMetadataFunction<{}> = async () => {
+ return {
+ durationInFrames: 10 * 30,
+ fps: 30,
+ width: 3840,
+ height: 2160,
+ };
+};
+
+export const OffthreadRemoteVideo: React.FC = () => {
+ return (
+ <OffthreadVideo src="https://videos.pexels.com/video-files/5530402/5530402-uhd_3840_2160_25fps.mp4" />
+ );
+};
+```
+
+**Cost**: $0.017
+Increasing the resolution to 4K does significantly increase the time to render and therfore the cost.
+
+## Additional cost
+
+The calculation above only factors in Lambda computation cost.
+This is usually the majority of the cost.
+However, you also incur additional cost for:
+
+- Bandwidth: Pulling in assets happens always over HTTP and incurs S3 egress cost.
+- Storage: Storing the sites and renders in S3 incurs S3 storage.
+- CloudWatch Logs: Renders are logged to CloudWatch by default.
+- [Remotion Licensing](https://remotion.pro/license): Teams of 4+ people also need to acquire a Remotion Company License in addition to the AWS cost.
+
+## See also
+
+- [Optimizing for cost](/docs/lambda/optimizing-cost)
diff --git a/packages/docs/docs/lambda/cost.mdx b/packages/docs/docs/lambda/cost.mdx
index 07d0da2d5f..cd84da1bce 100644
--- a/packages/docs/docs/lambda/cost.mdx
+++ b/packages/docs/docs/lambda/cost.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-cost.png
id: optimizing-cost
title: Optimizing for cost
slug: /lambda/optimizing-cost
-crumb: "Lambda"
+crumb: 'Lambda'
---
On this page, a few strategies for optimizing the cost of using Remotion Lambda are presented.
@@ -34,5 +34,6 @@ See [this video](https://www.youtube.com/watch?v=GUsjj1jsLhw) of how we optimize
## See also
+- [How much does Remotion Lambda cost?](/docs/lambda/cost-example)
- [Optimizing for speed](/docs/lambda/optimizing-speed)
- [Performance](/docs/performance)
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 93a2db3346..c2987eca04 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -738,6 +738,7 @@ module.exports = {
'lambda/custom-destination',
'lambda/checklist',
'lambda/webhooks',
+ 'lambda/cost-example',
'lambda/autodelete',
{
type: 'category',
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 71690b3557..bfe403e636 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -1147,6 +1147,13 @@ export const articles = [
compId: 'articles-docs-lambda-concurrency',
crumb: 'Lambda',
},
+ {
+ id: 'cost-example',
+ title: 'How much does Remotion Lambda cost?',
+ relativePath: 'docs/lambda/cost-example.mdx',
+ compId: 'articles-docs-lambda-cost-example',
+ crumb: 'Lambda',
+ },
{
id: 'optimizing-cost',
title: 'Optimizing for cost',
diff --git a/packages/docs/static/generated/articles-docs-lambda-cost-example.png b/packages/docs/static/generated/articles-docs-lambda-cost-example.png
new file mode 100644
index 0000000000..c9c0fcdcb8
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-lambda-cost-example.png differ
diff --git a/packages/example/runlambda.sh b/packages/example/runlambda.sh
index c1718ae187..475c14791d 100644
--- a/packages/example/runlambda.sh
+++ b/packages/example/runlambda.sh
@@ -1,10 +1,2 @@
-set -e
-cd ..
-cd lambda
-bun run build
-cd ..
-cd example
-bunx remotion lambda functions rmall -f
-bunx remotion lambda functions deploy --memory=3000 --disk=10000
bunx remotion lambda sites create --site-name=testbed-v6 --log=verbose --enable-folder-expiry
-bunx remotion lambda render testbed-v6 react-svg --log=verbose --delete-after="1-day"
+bunx remotion lambda render testbed-v6 OffthreadRemoteVideo --log=verbose --delete-after="1-day"
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index 8d5fdf1ea1..eb7051fb36 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -623,7 +623,7 @@ export const Index: React.FC = () => {
fps={30}
calculateMetadata={calculateMetadataFn}
defaultProps={{
- src: 'https://videos.pexels.com/video-files/5530402/5530402-uhd_3840_2160_25fps.mp4',
+ src: staticFile('bigbuckbunny.mp4'),
}}
/>
<Composition