@revideo/create 0.5.11-beta.1106 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/avatar-with-background/package.json +7 -14
- package/examples/avatar-with-background/src/{scenes/example.tsx → project.tsx} +19 -3
- package/examples/avatar-with-background/src/render.ts +4 -3
- package/examples/avatar-with-background/tsconfig.json +2 -1
- package/examples/default/package.json +6 -6
- package/examples/default/src/project.tsx +2 -2
- package/examples/github-stars-celebration/package.json +7 -11
- package/examples/github-stars-celebration/src/{scenes/example.tsx → project.tsx} +24 -4
- package/examples/github-stars-celebration/src/render.ts +1 -1
- package/examples/github-stars-celebration/tsconfig.json +2 -1
- package/examples/marketing-templates/marketing-template/README.md +19 -0
- package/examples/marketing-templates/marketing-template/package.json +7 -11
- package/examples/marketing-templates/marketing-template/src/{scenes/example.tsx → project.tsx} +23 -3
- package/examples/marketing-templates/marketing-template/src/render.ts +1 -1
- package/examples/marketing-templates/marketing-template/tsconfig.json +2 -1
- package/examples/marketing-templates/multiple-videos-in-one/README.md +19 -0
- package/examples/marketing-templates/multiple-videos-in-one/package.json +7 -11
- package/examples/marketing-templates/multiple-videos-in-one/src/{scenes/example.tsx → project.tsx} +21 -3
- package/examples/marketing-templates/multiple-videos-in-one/src/render.ts +1 -1
- package/examples/marketing-templates/multiple-videos-in-one/tsconfig.json +2 -1
- package/examples/minimal-drag-drop/README.md +14 -18
- package/examples/minimal-drag-drop/{next/app → app}/page.tsx +51 -39
- package/examples/minimal-drag-drop/{next/next-env.d.ts → next-env.d.ts} +1 -1
- package/examples/minimal-drag-drop/{next/package.json → package.json} +9 -4
- package/examples/minimal-drag-drop/revideo/project.tsx +54 -0
- package/examples/parallelized-aws-lambda/Dockerfile +0 -2
- package/examples/parallelized-aws-lambda/README.md +331 -100
- package/examples/parallelized-aws-lambda/revideo-project/package.json +9 -11
- package/examples/parallelized-aws-lambda/revideo-project/src/lambda.ts +2 -3
- package/examples/parallelized-aws-lambda/revideo-project/src/{scenes/example.tsx → project.tsx} +9 -5
- package/examples/parallelized-aws-lambda/revideo-project/src/render.ts +1 -1
- package/examples/parallelized-aws-lambda/revideo-project/tsconfig.json +1 -0
- package/examples/rive-explanation-video/README.md +0 -3
- package/examples/rive-explanation-video/package.json +8 -12
- package/examples/rive-explanation-video/src/project.tsx +234 -0
- package/examples/rive-explanation-video/src/render.ts +1 -1
- package/examples/rive-explanation-video/tsconfig.json +2 -1
- package/examples/saas-template/package.json +39 -39
- package/examples/stitching-videos/README.md +15 -3
- package/examples/stitching-videos/package.json +7 -10
- package/examples/stitching-videos/src/{scenes/example.tsx → project.tsx} +36 -3
- package/examples/stitching-videos/src/render.ts +4 -16
- package/examples/stitching-videos/tsconfig.json +2 -1
- package/examples/three-js-example/package.json +10 -13
- package/examples/three-js-example/src/project.tsx +105 -0
- package/examples/three-js-example/src/render.ts +1 -1
- package/examples/three-js-example/tsconfig.json +2 -1
- package/examples/youtube-shorts/README.md +14 -60
- package/examples/youtube-shorts/package.json +8 -12
- package/examples/youtube-shorts/src/{scenes/example.tsx → project.tsx} +20 -3
- package/examples/youtube-shorts/src/render.ts +11 -8
- package/examples/youtube-shorts/src/utils.ts +1 -1
- package/examples/youtube-shorts/tsconfig.json +2 -1
- package/index.js +2 -26
- package/package.json +9 -9
- package/examples/avatar-with-background/src/project.meta +0 -31
- package/examples/avatar-with-background/src/project.ts +0 -6
- package/examples/avatar-with-background/src/revideo.d.ts +0 -1
- package/examples/avatar-with-background/src/scenes/example.meta +0 -5
- package/examples/avatar-with-background/vite.config.ts +0 -8
- package/examples/github-stars-celebration/src/project.meta +0 -28
- package/examples/github-stars-celebration/src/project.ts +0 -8
- package/examples/github-stars-celebration/src/revideo.d.ts +0 -1
- package/examples/github-stars-celebration/src/scenes/example.meta +0 -5
- package/examples/github-stars-celebration/vite.config.ts +0 -8
- package/examples/google-cloud-run-parallelized/README.md +0 -127
- package/examples/google-cloud-run-parallelized/render-orchestrator/Dockerfile +0 -56
- package/examples/google-cloud-run-parallelized/render-orchestrator/package.json +0 -22
- package/examples/google-cloud-run-parallelized/render-orchestrator/src/index.ts +0 -72
- package/examples/google-cloud-run-parallelized/render-orchestrator/src/revideo.d.ts +0 -1
- package/examples/google-cloud-run-parallelized/render-orchestrator/tsconfig.json +0 -10
- package/examples/google-cloud-run-parallelized/render-worker/.gcloudignore +0 -17
- package/examples/google-cloud-run-parallelized/render-worker/.puppeteerrc.cjs +0 -9
- package/examples/google-cloud-run-parallelized/render-worker/package.json +0 -30
- package/examples/google-cloud-run-parallelized/render-worker/src/index.ts +0 -45
- package/examples/google-cloud-run-parallelized/render-worker/src/project.meta +0 -31
- package/examples/google-cloud-run-parallelized/render-worker/src/project.ts +0 -6
- package/examples/google-cloud-run-parallelized/render-worker/src/render.ts +0 -14
- package/examples/google-cloud-run-parallelized/render-worker/src/revideo.d.ts +0 -1
- package/examples/google-cloud-run-parallelized/render-worker/src/scenes/example.tsx +0 -30
- package/examples/google-cloud-run-parallelized/render-worker/tsconfig.json +0 -13
- package/examples/google-cloud-run-parallelized/render-worker/vite.config.ts +0 -9
- package/examples/marketing-templates/marketing-template/src/globals.css +0 -0
- package/examples/marketing-templates/marketing-template/src/project.meta +0 -28
- package/examples/marketing-templates/marketing-template/src/project.ts +0 -9
- package/examples/marketing-templates/marketing-template/src/revideo.d.ts +0 -1
- package/examples/marketing-templates/marketing-template/src/scenes/example.meta +0 -5
- package/examples/marketing-templates/marketing-template/vite.config.ts +0 -9
- package/examples/marketing-templates/multiple-videos-in-one/src/project.meta +0 -28
- package/examples/marketing-templates/multiple-videos-in-one/src/project.ts +0 -9
- package/examples/marketing-templates/multiple-videos-in-one/src/revideo.d.ts +0 -1
- package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.meta +0 -5
- package/examples/marketing-templates/multiple-videos-in-one/vite.config.ts +0 -9
- package/examples/minimal-drag-drop/next/package-lock.json +0 -5577
- package/examples/minimal-drag-drop/next/public/favicon.ico +0 -0
- package/examples/minimal-drag-drop/next/public/next.svg +0 -1
- package/examples/minimal-drag-drop/next/public/vercel.svg +0 -1
- package/examples/minimal-drag-drop/revideo/package-lock.json +0 -3771
- package/examples/minimal-drag-drop/revideo/package.json +0 -24
- package/examples/minimal-drag-drop/revideo/src/project.meta +0 -28
- package/examples/minimal-drag-drop/revideo/src/project.ts +0 -9
- package/examples/minimal-drag-drop/revideo/src/render.ts +0 -15
- package/examples/minimal-drag-drop/revideo/src/revideo.d.ts +0 -1
- package/examples/minimal-drag-drop/revideo/src/scenes/example.meta +0 -5
- package/examples/minimal-drag-drop/revideo/src/scenes/example.tsx +0 -44
- package/examples/minimal-drag-drop/revideo/tsconfig.json +0 -9
- package/examples/minimal-drag-drop/revideo/vite.config.ts +0 -6
- package/examples/parallelized-aws-lambda/revideo-project/.puppeteerrc.cjs +0 -9
- package/examples/parallelized-aws-lambda/revideo-project/src/project.meta +0 -28
- package/examples/parallelized-aws-lambda/revideo-project/src/project.ts +0 -7
- package/examples/parallelized-aws-lambda/revideo-project/src/revideo.d.ts +0 -1
- package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.meta +0 -5
- package/examples/parallelized-aws-lambda/revideo-project/vite.config.ts +0 -9
- package/examples/reddit-post-video/README.md +0 -84
- package/examples/reddit-post-video/package-lock.json +0 -2941
- package/examples/reddit-post-video/package.json +0 -27
- package/examples/reddit-post-video/src/global.css +0 -1
- package/examples/reddit-post-video/src/metadata.json +0 -576
- package/examples/reddit-post-video/src/project.meta +0 -31
- package/examples/reddit-post-video/src/project.ts +0 -9
- package/examples/reddit-post-video/src/render.ts +0 -157
- package/examples/reddit-post-video/src/revideo.d.ts +0 -1
- package/examples/reddit-post-video/src/scenes/example.meta +0 -5
- package/examples/reddit-post-video/src/scenes/example.tsx +0 -74
- package/examples/reddit-post-video/tsconfig.json +0 -9
- package/examples/reddit-post-video/vite.config.ts +0 -6
- package/examples/rive-explanation-video/src/project.meta +0 -31
- package/examples/rive-explanation-video/src/project.ts +0 -8
- package/examples/rive-explanation-video/src/revideo.d.ts +0 -1
- package/examples/rive-explanation-video/src/scenes/example.meta +0 -5
- package/examples/rive-explanation-video/src/scenes/example.tsx +0 -218
- package/examples/rive-explanation-video/vite.config.ts +0 -8
- package/examples/stitching-videos/src/project.meta +0 -28
- package/examples/stitching-videos/src/project.ts +0 -20
- package/examples/stitching-videos/src/revideo.d.ts +0 -1
- package/examples/stitching-videos/vite.config.ts +0 -8
- package/examples/three-js-example/README.md +0 -8
- package/examples/three-js-example/src/project.meta +0 -31
- package/examples/three-js-example/src/project.ts +0 -8
- package/examples/three-js-example/src/revideo.d.ts +0 -1
- package/examples/three-js-example/src/scenes/basic3D.meta +0 -5
- package/examples/three-js-example/src/scenes/basic3D.tsx +0 -89
- package/examples/three-js-example/vite.config.ts +0 -6
- package/examples/youtube-shorts/src/project.meta +0 -28
- package/examples/youtube-shorts/src/project.ts +0 -9
- package/examples/youtube-shorts/src/revideo.d.ts +0 -1
- package/examples/youtube-shorts/vite.config.ts +0 -8
- /package/examples/minimal-drag-drop/{next/app → app}/api/render/route.ts +0 -0
- /package/examples/minimal-drag-drop/{next/app → app}/globals.css +0 -0
- /package/examples/minimal-drag-drop/{next/app → app}/layout.tsx +0 -0
- /package/examples/minimal-drag-drop/{next/next.config.mjs → next.config.mjs} +0 -0
- /package/examples/minimal-drag-drop/{next/postcss.config.js → postcss.config.js} +0 -0
- /package/examples/minimal-drag-drop/revideo/{src/global.css → global.css} +0 -0
- /package/examples/minimal-drag-drop/{next/tailwind.config.ts → tailwind.config.ts} +0 -0
- /package/examples/minimal-drag-drop/{next/tsconfig.json → tsconfig.json} +0 -0
- /package/examples/minimal-drag-drop/{next/utils → utils}/parse.ts +0 -0
|
@@ -6,15 +6,18 @@
|
|
|
6
6
|
"dev": "next dev",
|
|
7
7
|
"build": "next build",
|
|
8
8
|
"start": "next start",
|
|
9
|
-
"lint": "next lint"
|
|
9
|
+
"lint": "next lint",
|
|
10
|
+
"revideo:serve": "revideo serve --projectFile ./revideo/project.ts",
|
|
11
|
+
"revideo:editor": "revideo editor --projectFile ./revideo/project.ts"
|
|
10
12
|
},
|
|
11
13
|
"dependencies": {
|
|
12
14
|
"@radix-ui/react-navigation-menu": "^1.1.4",
|
|
13
|
-
"@revideo/
|
|
14
|
-
"@revideo/
|
|
15
|
+
"@revideo/2d": "0.10.1",
|
|
16
|
+
"@revideo/core": "0.10.1",
|
|
17
|
+
"@revideo/player-react": "0.10.1",
|
|
15
18
|
"class-variance-authority": "^0.7.0",
|
|
16
19
|
"lucide-react": "^0.378.0",
|
|
17
|
-
"next": "14.2.
|
|
20
|
+
"next": "^14.2.13",
|
|
18
21
|
"p-limit": "^3",
|
|
19
22
|
"react": "^18",
|
|
20
23
|
"react-dom": "^18",
|
|
@@ -22,6 +25,8 @@
|
|
|
22
25
|
"tailwindcss-animate": "^1.0.7"
|
|
23
26
|
},
|
|
24
27
|
"devDependencies": {
|
|
28
|
+
"@revideo/cli": "0.10.1",
|
|
29
|
+
"@revideo/ui": "0.10.1",
|
|
25
30
|
"@types/node": "^20",
|
|
26
31
|
"@types/react": "^18",
|
|
27
32
|
"@types/react-dom": "^18",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** @jsxImportSource @revideo/2d/lib */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createRef,
|
|
5
|
+
Reference,
|
|
6
|
+
makeProject,
|
|
7
|
+
useScene,
|
|
8
|
+
waitFor,
|
|
9
|
+
} from '@revideo/core';
|
|
10
|
+
import {Video, Txt, makeScene2D} from '@revideo/2d';
|
|
11
|
+
|
|
12
|
+
import './global.css';
|
|
13
|
+
|
|
14
|
+
const scene = makeScene2D("scene", function* (view) {
|
|
15
|
+
const nodesObj = useScene().variables.get("nodes", {})() as Record<string, any>;
|
|
16
|
+
const nodes = new Map(Object.entries(nodesObj));
|
|
17
|
+
|
|
18
|
+
yield view.add(
|
|
19
|
+
<Video
|
|
20
|
+
src="https://revideo-example-assets.s3.amazonaws.com/stars.mp4"
|
|
21
|
+
size={"100%"}
|
|
22
|
+
key={'data-video'}
|
|
23
|
+
play={true}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const refs: Array<Reference<Txt>> = [];
|
|
28
|
+
if (nodes.size > 0) {
|
|
29
|
+
for (const [key, node] of nodes) {
|
|
30
|
+
const ref = createRef<Txt>();
|
|
31
|
+
yield view.add(
|
|
32
|
+
<Txt
|
|
33
|
+
key={key}
|
|
34
|
+
text={node.text}
|
|
35
|
+
fontSize={100}
|
|
36
|
+
fontWeight={800}
|
|
37
|
+
fontFamily={"Roboto"}
|
|
38
|
+
fill={"white"}
|
|
39
|
+
x={() => node.x}
|
|
40
|
+
y={() => node.y}
|
|
41
|
+
ref={ref}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
refs.push(ref);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
yield* waitFor(5);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
export default makeProject({
|
|
53
|
+
scenes: [scene],
|
|
54
|
+
});
|
|
@@ -18,129 +18,357 @@ The handler that gets executed when the lambda function is invoked can be found
|
|
|
18
18
|
|
|
19
19
|
## Getting Started
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Here's how you can set up your example project on AWS Lambda:
|
|
22
22
|
|
|
23
|
-
###
|
|
23
|
+
### Assign Permissions
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
We will first create users and roles to obtain the neccessary permissions for creating, managing and running lambda functions:
|
|
26
26
|
|
|
27
|
+
#### 1. Create role policy
|
|
28
|
+
|
|
29
|
+
- Go to [AWS account IAM Policies section](https://console.aws.amazon.com/iamv2/home?#/policies). Now click on **"Create Policy"** and then click on **"JSON"**
|
|
30
|
+
- Paste the following JSON into the Policy field:
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"Version": "2012-10-17",
|
|
34
|
+
"Statement": [
|
|
35
|
+
{
|
|
36
|
+
"Sid": "0",
|
|
37
|
+
"Effect": "Allow",
|
|
38
|
+
"Action": [
|
|
39
|
+
"s3:ListAllMyBuckets"
|
|
40
|
+
],
|
|
41
|
+
"Resource": [
|
|
42
|
+
"*"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"Sid": "1",
|
|
47
|
+
"Effect": "Allow",
|
|
48
|
+
"Action": [
|
|
49
|
+
"s3:CreateBucket",
|
|
50
|
+
"s3:ListBucket",
|
|
51
|
+
"s3:PutBucketAcl",
|
|
52
|
+
"s3:GetObject",
|
|
53
|
+
"s3:DeleteObject",
|
|
54
|
+
"s3:PutObjectAcl",
|
|
55
|
+
"s3:PutObject",
|
|
56
|
+
"s3:GetBucketLocation"
|
|
57
|
+
],
|
|
58
|
+
"Resource": [
|
|
59
|
+
"arn:aws:s3:::revideo-*"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"Sid": "2",
|
|
64
|
+
"Effect": "Allow",
|
|
65
|
+
"Action": [
|
|
66
|
+
"lambda:InvokeFunction"
|
|
67
|
+
],
|
|
68
|
+
"Resource": [
|
|
69
|
+
"arn:aws:lambda:*:*:function:revideo-*"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"Sid": "3",
|
|
74
|
+
"Effect": "Allow",
|
|
75
|
+
"Action": [
|
|
76
|
+
"logs:CreateLogGroup"
|
|
77
|
+
],
|
|
78
|
+
"Resource": [
|
|
79
|
+
"arn:aws:logs:*:*:log-group:/aws/lambda-insights"
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"Sid": "4",
|
|
84
|
+
"Effect": "Allow",
|
|
85
|
+
"Action": [
|
|
86
|
+
"logs:CreateLogStream",
|
|
87
|
+
"logs:PutLogEvents"
|
|
88
|
+
],
|
|
89
|
+
"Resource": [
|
|
90
|
+
"arn:aws:logs:*:*:log-group:/aws/lambda/revideo-*",
|
|
91
|
+
"arn:aws:logs:*:*:log-group:/aws/lambda-insights:*"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"Sid": "CreateLambdaLogGroup",
|
|
96
|
+
"Effect": "Allow",
|
|
97
|
+
"Action": [
|
|
98
|
+
"logs:CreateLogGroup"
|
|
99
|
+
],
|
|
100
|
+
"Resource": [
|
|
101
|
+
"arn:aws:logs:*:*:log-group:/aws/lambda/revideo-*"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"Sid": "ECRAccess",
|
|
106
|
+
"Effect": "Allow",
|
|
107
|
+
"Action": [
|
|
108
|
+
"ecr:GetAuthorizationToken",
|
|
109
|
+
"ecr:BatchCheckLayerAvailability",
|
|
110
|
+
"ecr:GetDownloadUrlForLayer",
|
|
111
|
+
"ecr:BatchGetImage",
|
|
112
|
+
"ecr:InitiateLayerUpload",
|
|
113
|
+
"ecr:GetRepositoryPolicy",
|
|
114
|
+
"ecr:SetRepositoryPolicy"
|
|
115
|
+
],
|
|
116
|
+
"Resource": "*"
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
27
120
|
```
|
|
28
|
-
|
|
121
|
+
- Click next. On the tags page, you don't need to fill in anything. Click next again.
|
|
122
|
+
- Give the policy **exactly** the name `revideo-lambda-policy` in the "Policy Name" field. No other changes are needed.
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
#### 2. Create a role
|
|
126
|
+
|
|
127
|
+
- Go to [AWS account IAM Roles section](https://console.aws.amazon.com/iamv2/home#/roles). Now click "Create role", and under "Use Cases", select "Lambda". Now click next.
|
|
128
|
+
- Under "Permissions policies", filter for `revideo-lambda-policy` and click the checkbox to assign this policy. Click next.
|
|
129
|
+
- In the final step, name the role `revideo-lambda-role` **exactly**. Don't change anything else.
|
|
130
|
+
- Click "Create role" to confirm. Note down the arn of the role as you will need it later.
|
|
131
|
+
|
|
132
|
+
#### 3. Create a user
|
|
133
|
+
|
|
134
|
+
- Go to [AWS account IAM Users section](https://console.aws.amazon.com/iamv2/home#/users). Now click **"Add users"** and enter a username for your user, such as `revideo-user`.
|
|
135
|
+
- **Don't check** the "Enable console access" option. You don't need it.
|
|
136
|
+
- Click "Next", and click "Next" again on the next page. You should now be at the Review and Create" step.
|
|
137
|
+
- Click "Create user".
|
|
138
|
+
|
|
139
|
+
#### 4. Create an access key for the user
|
|
140
|
+
|
|
141
|
+
- Go to [AWS account IAM Users section](https://console.aws.amazon.com/iamv2/home#/users)
|
|
142
|
+
- Click on the name of the user that was created in step 3 (`revideo-user`).
|
|
143
|
+
- Navigate to the "Security Credentials" tab, and scroll down to the "Access Keys" section.
|
|
144
|
+
- Click the "Create access key" button.
|
|
145
|
+
- Select "Application running on an AWS compute service".
|
|
146
|
+
- Ignore warnings that might appear and check the "I understand the recommendations..." checkbox.
|
|
147
|
+
- Click "Next".
|
|
148
|
+
- Click "Create access key".
|
|
149
|
+
|
|
150
|
+
Note down your access key id and secret access key as you will need them later.
|
|
151
|
+
|
|
152
|
+
#### 5. Add permissions to your user
|
|
153
|
+
|
|
154
|
+
- Go to [AWS account IAM Users section](https://console.aws.amazon.com/iamv2/home#/users)
|
|
155
|
+
- Select the user you just created.
|
|
156
|
+
- Click "Add inline policy" under the "Add Permissions" dropdown in the "Permissions policies" panel.
|
|
157
|
+
- Click the tab "JSON".
|
|
158
|
+
- Paste the following policy into the text field:
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"Version": "2012-10-17",
|
|
162
|
+
"Statement": [
|
|
163
|
+
{
|
|
164
|
+
"Sid": "HandleQuotas",
|
|
165
|
+
"Effect": "Allow",
|
|
166
|
+
"Action": [
|
|
167
|
+
"servicequotas:GetServiceQuota",
|
|
168
|
+
"servicequotas:GetAWSDefaultServiceQuota",
|
|
169
|
+
"servicequotas:RequestServiceQuotaIncrease",
|
|
170
|
+
"servicequotas:ListRequestedServiceQuotaChangeHistoryByQuota"
|
|
171
|
+
],
|
|
172
|
+
"Resource": [
|
|
173
|
+
"*"
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"Sid": "PermissionValidation",
|
|
178
|
+
"Effect": "Allow",
|
|
179
|
+
"Action": [
|
|
180
|
+
"iam:SimulatePrincipalPolicy"
|
|
181
|
+
],
|
|
182
|
+
"Resource": [
|
|
183
|
+
"*"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"Sid": "LambdaInvokation",
|
|
188
|
+
"Effect": "Allow",
|
|
189
|
+
"Action": [
|
|
190
|
+
"iam:PassRole"
|
|
191
|
+
],
|
|
192
|
+
"Resource": [
|
|
193
|
+
"arn:aws:iam::*:role/revideo-lambda-role"
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"Sid": "Storage",
|
|
198
|
+
"Effect": "Allow",
|
|
199
|
+
"Action": [
|
|
200
|
+
"s3:GetObject",
|
|
201
|
+
"s3:DeleteObject",
|
|
202
|
+
"s3:PutObjectAcl",
|
|
203
|
+
"s3:PutObject",
|
|
204
|
+
"s3:CreateBucket",
|
|
205
|
+
"s3:ListBucket",
|
|
206
|
+
"s3:GetBucketLocation",
|
|
207
|
+
"s3:PutBucketAcl",
|
|
208
|
+
"s3:DeleteBucket",
|
|
209
|
+
"s3:PutBucketOwnershipControls",
|
|
210
|
+
"s3:PutBucketPublicAccessBlock",
|
|
211
|
+
"s3:PutLifecycleConfiguration"
|
|
212
|
+
],
|
|
213
|
+
"Resource": [
|
|
214
|
+
"arn:aws:s3:::revideo-*"
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"Sid": "BucketListing",
|
|
219
|
+
"Effect": "Allow",
|
|
220
|
+
"Action": [
|
|
221
|
+
"s3:ListAllMyBuckets"
|
|
222
|
+
],
|
|
223
|
+
"Resource": [
|
|
224
|
+
"*"
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"Sid": "FunctionListing",
|
|
229
|
+
"Effect": "Allow",
|
|
230
|
+
"Action": [
|
|
231
|
+
"lambda:ListFunctions",
|
|
232
|
+
"lambda:GetFunction"
|
|
233
|
+
],
|
|
234
|
+
"Resource": [
|
|
235
|
+
"*"
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"Sid": "FunctionManagement",
|
|
240
|
+
"Effect": "Allow",
|
|
241
|
+
"Action": [
|
|
242
|
+
"lambda:InvokeAsync",
|
|
243
|
+
"lambda:InvokeFunction",
|
|
244
|
+
"lambda:CreateFunction",
|
|
245
|
+
"lambda:UpdateFunctionCode",
|
|
246
|
+
"lambda:DeleteFunction",
|
|
247
|
+
"lambda:PutFunctionEventInvokeConfig",
|
|
248
|
+
"lambda:PutRuntimeManagementConfig",
|
|
249
|
+
"lambda:TagResource"
|
|
250
|
+
],
|
|
251
|
+
"Resource": [
|
|
252
|
+
"arn:aws:lambda:*:*:function:revideo-*"
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"Sid": "LogsRetention",
|
|
257
|
+
"Effect": "Allow",
|
|
258
|
+
"Action": [
|
|
259
|
+
"logs:CreateLogGroup",
|
|
260
|
+
"logs:PutRetentionPolicy"
|
|
261
|
+
],
|
|
262
|
+
"Resource": [
|
|
263
|
+
"arn:aws:logs:*:*:log-group:/aws/lambda/revideo-*"
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"Sid": "ECRPermissions",
|
|
268
|
+
"Effect": "Allow",
|
|
269
|
+
"Action": [
|
|
270
|
+
"ecr:GetAuthorizationToken",
|
|
271
|
+
"ecr:BatchCheckLayerAvailability",
|
|
272
|
+
"ecr:GetDownloadUrlForLayer",
|
|
273
|
+
"ecr:GetRepositoryPolicy",
|
|
274
|
+
"ecr:DescribeRepositories",
|
|
275
|
+
"ecr:ListImages",
|
|
276
|
+
"ecr:DescribeImages",
|
|
277
|
+
"ecr:BatchGetImage",
|
|
278
|
+
"ecr:InitiateLayerUpload",
|
|
279
|
+
"ecr:UploadLayerPart",
|
|
280
|
+
"ecr:CompleteLayerUpload",
|
|
281
|
+
"ecr:PutImage",
|
|
282
|
+
"ecr:SetRepositoryPolicy"
|
|
283
|
+
],
|
|
284
|
+
"Resource": "*"
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
}
|
|
29
288
|
```
|
|
30
289
|
|
|
31
|
-
|
|
290
|
+
- Click "Review policy".
|
|
291
|
+
- Give the policy a name. For example `revideo-user-policy`, but it can be anything.
|
|
292
|
+
- Click "Create policy" to confirm.
|
|
293
|
+
|
|
294
|
+
### Deploy your Lambda Function
|
|
295
|
+
|
|
296
|
+
We assume that you've cloned or donwloaded the parallelized lambda example and are now in the root directory of the project.
|
|
297
|
+
|
|
298
|
+
We will now set up the AWS resources you need to deploy your project. To do so, first make sure that the AWS CLI is operated by the user we just granted the neccessary permissions by setting the credentials from bullet point 4 of the previous section:
|
|
32
299
|
|
|
33
300
|
```
|
|
34
|
-
|
|
301
|
+
export AWS_ACCESS_KEY_ID=<your-access-key-id>
|
|
302
|
+
export AWS_SECRET_ACCESS_KEY=<your-secret-access-key>
|
|
303
|
+
export AWS_DEFAULT_REGION=<your-aws-region>
|
|
35
304
|
```
|
|
36
305
|
|
|
37
|
-
|
|
306
|
+
#### Create A Bucket
|
|
307
|
+
|
|
308
|
+
First, create a bucket to store your renders as well as the partial renders that get merged:
|
|
309
|
+
|
|
310
|
+
- Head to the [S3 Dashboard](https://eu-central-1.console.aws.amazon.com/s3) and make sure that you're in the region you want your bucket to be in.
|
|
311
|
+
- Click "Create Bucket".
|
|
312
|
+
- Give the bucket a name that starts with "revideo-", untick "Block all Public Access" and acknowledge the warning by ticking its box
|
|
313
|
+
- Confirm by clicking "Create Bucket"
|
|
314
|
+
- Click onto your Bucket and head to the tab "Permissions"
|
|
315
|
+
|
|
316
|
+
Now paste the following into the "Bucket Policy" field:
|
|
38
317
|
|
|
39
318
|
```json
|
|
40
319
|
{
|
|
41
320
|
"Version": "2012-10-17",
|
|
42
321
|
"Statement": [
|
|
43
322
|
{
|
|
44
|
-
"Sid": "
|
|
323
|
+
"Sid": "PublicReadGetObject",
|
|
45
324
|
"Effect": "Allow",
|
|
46
325
|
"Principal": "*",
|
|
47
326
|
"Action": "s3:GetObject",
|
|
48
|
-
"Resource": "arn:aws:s3
|
|
327
|
+
"Resource": "arn:aws:s3:::<your-bucket-name>/*"
|
|
49
328
|
},
|
|
50
|
-
|
|
329
|
+
{
|
|
51
330
|
"Sid": "AllowUserToWriteObjects",
|
|
52
331
|
"Effect": "Allow",
|
|
53
332
|
"Principal": {
|
|
54
333
|
"AWS": "<your-user-arn>"
|
|
55
334
|
},
|
|
56
335
|
"Action": "s3:PutObject",
|
|
57
|
-
"Resource": "arn:aws:s3
|
|
336
|
+
"Resource": "arn:aws:s3:::<your-bucket-name>/*"
|
|
58
337
|
}
|
|
59
|
-
|
|
60
338
|
]
|
|
61
339
|
}
|
|
62
340
|
```
|
|
63
341
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
You want to give the user the permission to write to buckets, invoke lambda functions and create logs in CloudWatch (in order to monitor the logs of your lambda function).
|
|
67
|
-
|
|
68
|
-
To do so, create a role with the following policy attached:
|
|
342
|
+
Also paste the following into the field "Cross-origin resource sharing (CORS)" and click:
|
|
69
343
|
|
|
70
344
|
```json
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"s3:ListBucket",
|
|
90
|
-
"s3:PutBucketAcl",
|
|
91
|
-
"s3:GetObject",
|
|
92
|
-
"s3:DeleteObject",
|
|
93
|
-
"s3:PutObjectAcl",
|
|
94
|
-
"s3:PutObject",
|
|
95
|
-
"s3:GetBucketLocation"
|
|
96
|
-
],
|
|
97
|
-
"Resource": [
|
|
98
|
-
"arn:aws:s3:::*"
|
|
99
|
-
]
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"Sid": "2",
|
|
103
|
-
"Effect": "Allow",
|
|
104
|
-
"Action": [
|
|
105
|
-
"lambda:InvokeFunction"
|
|
106
|
-
],
|
|
107
|
-
"Resource": [
|
|
108
|
-
"arn:aws:lambda:*:*:function:*"
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"Sid": "3",
|
|
113
|
-
"Effect": "Allow",
|
|
114
|
-
"Action": [
|
|
115
|
-
"logs:CreateLogGroup"
|
|
116
|
-
],
|
|
117
|
-
"Resource": [
|
|
118
|
-
"*"
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"Sid": "4",
|
|
123
|
-
"Effect": "Allow",
|
|
124
|
-
"Action": [
|
|
125
|
-
"logs:CreateLogStream",
|
|
126
|
-
"logs:PutLogEvents"
|
|
127
|
-
],
|
|
128
|
-
"Resource": [
|
|
129
|
-
"*"
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
}
|
|
345
|
+
[
|
|
346
|
+
{
|
|
347
|
+
"AllowedHeaders": [
|
|
348
|
+
"*"
|
|
349
|
+
],
|
|
350
|
+
"AllowedMethods": [
|
|
351
|
+
"GET",
|
|
352
|
+
"HEAD"
|
|
353
|
+
],
|
|
354
|
+
"AllowedOrigins": [
|
|
355
|
+
"*"
|
|
356
|
+
],
|
|
357
|
+
"ExposeHeaders": [
|
|
358
|
+
"ETag"
|
|
359
|
+
],
|
|
360
|
+
"MaxAgeSeconds": 3000
|
|
361
|
+
}
|
|
362
|
+
]
|
|
134
363
|
```
|
|
135
364
|
|
|
136
|
-
Attach this role to the user that you have previously given the permission to write to your bucket.
|
|
137
365
|
|
|
138
|
-
|
|
366
|
+
#### Build Docker Image & Push to ECR
|
|
139
367
|
|
|
140
|
-
We want to upload our docker image to Amazon's container registry so that it is close to our lambda function. To create an ECR repository, run the following command
|
|
368
|
+
We want to upload our docker image to Amazon's container registry so that it is close to our lambda function. To create an ECR repository, run the following command.
|
|
141
369
|
|
|
142
370
|
```
|
|
143
|
-
aws ecr create-repository --repository-name
|
|
371
|
+
aws ecr create-repository --repository-name revideo-render-project
|
|
144
372
|
```
|
|
145
373
|
|
|
146
374
|
This will give you the URI of your ECR repository `<your-ecr-uri>`, which looks something like `0123456789.dkr.ecr.us-east-1.amazonaws.com/your-repo-name`.
|
|
@@ -148,50 +376,53 @@ This will give you the URI of your ECR repository `<your-ecr-uri>`, which looks
|
|
|
148
376
|
Now you can build the docker image. To do so, head to the folder in which our `Dockerfile` is present and run:
|
|
149
377
|
|
|
150
378
|
```
|
|
151
|
-
docker buildx build --progress=plain --platform linux/amd64 -t
|
|
379
|
+
docker buildx build --progress=plain --platform linux/amd64 -t revideo-render-project:latest .
|
|
152
380
|
```
|
|
153
381
|
|
|
154
382
|
Now tag the image to upload it to ECR:
|
|
155
383
|
|
|
156
384
|
```
|
|
157
|
-
docker tag
|
|
385
|
+
docker tag revideo-render-project:latest <your-ecr-uri>:latest
|
|
158
386
|
```
|
|
159
387
|
|
|
160
|
-
Finally, push the image to
|
|
388
|
+
Finally, to push the image, you have to authenticate Docker with ECR. To do so, run the following command:
|
|
389
|
+
|
|
161
390
|
```
|
|
162
|
-
docker
|
|
391
|
+
aws ecr get-login-password --region <your-region> | docker login --username AWS --password-stdin <your-ecr-uri>
|
|
163
392
|
```
|
|
164
393
|
|
|
165
|
-
|
|
394
|
+
Now push the image to your repository:
|
|
395
|
+
```
|
|
396
|
+
docker push <your-ecr-uri>:latest
|
|
397
|
+
```
|
|
166
398
|
|
|
167
|
-
|
|
399
|
+
You can now create a lambda function from your docker image. The `<your-lambda-role-arn>` field should be filled out by the arn that was returned in step 2 ("Create a Role").
|
|
168
400
|
|
|
169
401
|
```
|
|
170
402
|
aws lambda create-function \
|
|
171
|
-
--function-name
|
|
403
|
+
--function-name revideo-render-function \
|
|
172
404
|
--package-type Image \
|
|
173
405
|
--code ImageUri=<your-ecr-uri>:latest \
|
|
174
406
|
--role <your-lambda-role-arn> \
|
|
175
|
-
--timeout
|
|
176
|
-
--memory-size
|
|
177
|
-
--environment Variables={REVIDEO_BUCKET_NAME
|
|
407
|
+
--timeout 900 \
|
|
408
|
+
--memory-size 3000 \
|
|
409
|
+
--environment Variables={REVIDEO_BUCKET_NAME=<your-bucket-name>}
|
|
178
410
|
```
|
|
179
411
|
|
|
180
412
|
You should get a response in your terminal indicating that your function is being created.
|
|
181
413
|
|
|
182
|
-
|
|
414
|
+
|
|
415
|
+
#### Test your function
|
|
183
416
|
|
|
184
417
|
To test your function, head to the Lambda tab in the AWS console. Now create a test event with the following arguments and use it to invoke your function:
|
|
185
418
|
|
|
186
|
-
```
|
|
419
|
+
```json
|
|
187
420
|
{
|
|
188
421
|
"jobId": "12345",
|
|
189
|
-
"numWorkers":
|
|
422
|
+
"numWorkers": 5,
|
|
190
423
|
"jobType": "fullRender",
|
|
191
424
|
"variables": {"message": "Hello from Revideo!"}
|
|
192
425
|
}
|
|
193
426
|
```
|
|
194
427
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
**Note: The first time after an image is uploaded to ECR, the function may take longer to execute, but after the first time, executions are faster, even when you have long breaks between executions. You can read more about why this happens [here](https://brooker.co.za/blog/2023/05/23/snapshot-loading.html).**
|
|
428
|
+
If you want to build an app that interacts with your function, you should use the AWS Lambda SDK. You can see how it is used to invoke partial renders within `src/lambda.ts`.
|
|
@@ -3,26 +3,24 @@
|
|
|
3
3
|
"private": true,
|
|
4
4
|
"version": "0.0.0",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"start": "
|
|
7
|
-
"serve": "vite",
|
|
8
|
-
"build": "tsc && vite build",
|
|
6
|
+
"start": "revideo editor --projectFile ./src/project.tsx",
|
|
9
7
|
"render": "tsc && node dist/render.js"
|
|
10
8
|
},
|
|
11
9
|
"dependencies": {
|
|
12
|
-
"@revideo/2d": "0.
|
|
13
|
-
"@revideo/core": "0.
|
|
14
|
-
"@revideo/ffmpeg": "0.
|
|
15
|
-
"@revideo/renderer": "0.
|
|
16
|
-
"@revideo/vite-plugin": "0.5.10",
|
|
10
|
+
"@revideo/2d": "0.10.1",
|
|
11
|
+
"@revideo/core": "0.10.1",
|
|
12
|
+
"@revideo/ffmpeg": "0.10.1",
|
|
13
|
+
"@revideo/renderer": "0.10.1",
|
|
17
14
|
"@sparticuz/chromium": "^123.0.1",
|
|
18
15
|
"aws-lambda": "^1.0.7",
|
|
19
16
|
"aws-sdk": "^2.1642.0",
|
|
20
17
|
"ffmpeg-static": "^5.2.0"
|
|
21
18
|
},
|
|
22
19
|
"devDependencies": {
|
|
23
|
-
"@revideo/cli": "0.
|
|
24
|
-
"@revideo/ui": "0.
|
|
20
|
+
"@revideo/cli": "0.10.1",
|
|
21
|
+
"@revideo/ui": "0.10.1",
|
|
22
|
+
"@types/chroma-js": "^2.4.4",
|
|
25
23
|
"typescript": "5.5.4",
|
|
26
|
-
"vite": "
|
|
24
|
+
"vite": "4.5"
|
|
27
25
|
}
|
|
28
26
|
}
|
|
@@ -4,7 +4,6 @@ import chromium from '@sparticuz/chromium';
|
|
|
4
4
|
import * as AWS from "aws-sdk";
|
|
5
5
|
import * as fs from "fs";
|
|
6
6
|
|
|
7
|
-
AWS.config.update({ region: 'us-east-1' });
|
|
8
7
|
chromium.setHeadlessMode = true;
|
|
9
8
|
|
|
10
9
|
const s3 = new AWS.S3();
|
|
@@ -23,7 +22,7 @@ export const handler = async (event: any, context: any) => {
|
|
|
23
22
|
const { workerId, numWorkers, variables } = event;
|
|
24
23
|
|
|
25
24
|
const { audioFile, videoFile } = await renderPartialVideo({
|
|
26
|
-
projectFile: './src/project.
|
|
25
|
+
projectFile: './src/project.tsx',
|
|
27
26
|
workerId: workerId,
|
|
28
27
|
numWorkers: numWorkers,
|
|
29
28
|
variables: variables,
|
|
@@ -35,7 +34,7 @@ export const handler = async (event: any, context: any) => {
|
|
|
35
34
|
!arg.startsWith('--use-gl=angle') &&
|
|
36
35
|
!arg.startsWith('--use-angle=swiftshader') &&
|
|
37
36
|
!arg.startsWith('--disable-features=')
|
|
38
|
-
)
|
|
37
|
+
),
|
|
39
38
|
}}
|
|
40
39
|
});
|
|
41
40
|
|