Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Lambda functionality in templates #4663

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/template-next-app-tailwind/deploy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const { functionName, alreadyExisted: functionAlreadyExisted } =
region: REGION,
timeoutInSeconds: TIMEOUT,
diskSizeInMb: DISK,
enableV5Runtime: true,
});
console.log(
functionName,
Expand Down
1 change: 1 addition & 0 deletions packages/template-next-app/deploy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const { functionName, alreadyExisted: functionAlreadyExisted } =
region: REGION,
timeoutInSeconds: TIMEOUT,
diskSizeInMb: DISK,
enableV5Runtime: true,
});
console.log(
functionName,
Expand Down
1 change: 1 addition & 0 deletions packages/template-next-pages/deploy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const { functionName, alreadyExisted: functionAlreadyExisted } =
region: REGION,
timeoutInSeconds: TIMEOUT,
diskSizeInMb: DISK,
enableV5Runtime: true,
});
console.log(
functionName,
Expand Down
4 changes: 3 additions & 1 deletion packages/template-remix/app/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from "@remotion/lambda";
import dotenv from "dotenv";
import path from "path";
import { RAM, TIMEOUT, SITE_NAME } from "./remotion/constants";
import { RAM, TIMEOUT, SITE_NAME, DISK } from "./remotion/constants";

dotenv.config();

Expand All @@ -19,7 +19,9 @@ const run = async () => {
createCloudWatchLogGroup: true,
memorySizeInMb: RAM,
region,
diskSizeInMb: DISK,
timeoutInSeconds: TIMEOUT,
enableV5Runtime: true,
});
console.log(
`${alreadyExisted ? "Ensured" : "Deployed"} function "${functionName}"`,
Expand Down
9 changes: 0 additions & 9 deletions packages/template-remix/app/lib/get-function-name.ts

This file was deleted.

25 changes: 20 additions & 5 deletions packages/template-remix/app/lib/render-video.server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import type { AwsRegion } from "@remotion/lambda";
import { renderMediaOnLambda } from "@remotion/lambda/client";
import { speculateFunctionName } from "./get-function-name";
import {
renderMediaOnLambda,
speculateFunctionName,
} from "@remotion/lambda/client";
import type { RenderResponse } from "./types";
import type { LogoAnimationProps } from "app/remotion/constants";
import {
DISK,
RAM,
TIMEOUT,
type LogoAnimationProps,
} from "app/remotion/constants";

export const renderVideo = async ({
serveUrl,
Expand All @@ -24,7 +31,11 @@ export const renderVideo = async ({

const { renderId, bucketName } = await renderMediaOnLambda({
region,
functionName: speculateFunctionName(),
functionName: speculateFunctionName({
diskSizeInMb: DISK,
memorySizeInMb: RAM,
timeoutInSeconds: TIMEOUT,
}),
serveUrl,
composition,
inputProps,
Expand All @@ -39,7 +50,11 @@ export const renderVideo = async ({
return {
renderId,
bucketName,
functionName: speculateFunctionName(),
functionName: speculateFunctionName({
diskSizeInMb: DISK,
memorySizeInMb: RAM,
timeoutInSeconds: TIMEOUT,
}),
region,
};
};
2 changes: 1 addition & 1 deletion packages/template-remix/app/remotion/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const COMPOSITION_WIDTH = 1920;
export const COMPOSITION_HEIGHT = 1080;
export const COMPOSITION_ID = "LogoAnimation";
export const RAM = 2048;
export const DISK = 2048;
export const DISK = 10240;
export const TIMEOUT = 240;
export const SITE_NAME = "remotion-remix-example-" + VERSION;

Expand Down
13 changes: 10 additions & 3 deletions packages/template-remix/app/routes/progress.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import type { ActionFunction } from "@remix-run/node";
import { json } from "@remix-run/node";
import type { AwsRegion } from "@remotion/lambda";
import { getRenderProgress } from "@remotion/lambda/client";
import { speculateFunctionName } from "app/lib/get-function-name";
import {
getRenderProgress,
speculateFunctionName,
} from "@remotion/lambda/client";
import type { StatusResponse } from "../lib/types";
import { DISK, RAM, TIMEOUT } from "~/remotion/constants";

export const action: ActionFunction = async ({ request }) => {
const body = await request.formData();
Expand All @@ -29,7 +32,11 @@ export const action: ActionFunction = async ({ request }) => {
{
renderId,
bucketName,
functionName: speculateFunctionName(),
functionName: speculateFunctionName({
diskSizeInMb: DISK,
memorySizeInMb: RAM,
timeoutInSeconds: TIMEOUT,
}),
region,
},
);
Expand Down
5 changes: 5 additions & 0 deletions packages/template-tiktok/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ Captioning will download Whisper.cpp and the 1.5GB big `medium.en` model. To con

To support non-English languages, you need to change the `WHISPER_MODEL` variable in `whisper-config.mjs` to a model that does not have a `.en` sufix.

## Rendering on Lambda

If you plan on deploying this template to Lambda, make sure to enable the [`--enable-v5-runtime`](https://www.remotion.dev/docs/lambda/cli/functions#--enable-v5-runtime) flag.
This will enable a Chrome version which supports the `paint-order` CSS property that is required for this template to render properly.

## Docs

Get started with Remotion by reading the [fundamentals page](https://www.remotion.dev/docs/the-fundamentals).
Expand Down
Loading