@revideo/create 0.5.11-beta.1106 → 0.10.0

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.
Files changed (156) hide show
  1. package/examples/avatar-with-background/package.json +7 -14
  2. package/examples/avatar-with-background/src/{scenes/example.tsx → project.tsx} +19 -3
  3. package/examples/avatar-with-background/src/render.ts +4 -3
  4. package/examples/avatar-with-background/tsconfig.json +2 -1
  5. package/examples/default/package.json +6 -6
  6. package/examples/default/src/project.tsx +2 -2
  7. package/examples/github-stars-celebration/package.json +7 -11
  8. package/examples/github-stars-celebration/src/{scenes/example.tsx → project.tsx} +24 -4
  9. package/examples/github-stars-celebration/src/render.ts +1 -1
  10. package/examples/github-stars-celebration/tsconfig.json +2 -1
  11. package/examples/marketing-templates/marketing-template/README.md +19 -0
  12. package/examples/marketing-templates/marketing-template/package.json +7 -11
  13. package/examples/marketing-templates/marketing-template/src/{scenes/example.tsx → project.tsx} +23 -3
  14. package/examples/marketing-templates/marketing-template/src/render.ts +1 -1
  15. package/examples/marketing-templates/marketing-template/tsconfig.json +2 -1
  16. package/examples/marketing-templates/multiple-videos-in-one/README.md +19 -0
  17. package/examples/marketing-templates/multiple-videos-in-one/package.json +7 -11
  18. package/examples/marketing-templates/multiple-videos-in-one/src/{scenes/example.tsx → project.tsx} +21 -3
  19. package/examples/marketing-templates/multiple-videos-in-one/src/render.ts +1 -1
  20. package/examples/marketing-templates/multiple-videos-in-one/tsconfig.json +2 -1
  21. package/examples/minimal-drag-drop/README.md +14 -18
  22. package/examples/minimal-drag-drop/{next/app → app}/page.tsx +51 -39
  23. package/examples/minimal-drag-drop/{next/next-env.d.ts → next-env.d.ts} +1 -1
  24. package/examples/minimal-drag-drop/{next/package.json → package.json} +9 -4
  25. package/examples/minimal-drag-drop/revideo/project.tsx +54 -0
  26. package/examples/parallelized-aws-lambda/Dockerfile +0 -2
  27. package/examples/parallelized-aws-lambda/README.md +331 -100
  28. package/examples/parallelized-aws-lambda/revideo-project/package.json +9 -11
  29. package/examples/parallelized-aws-lambda/revideo-project/src/lambda.ts +2 -3
  30. package/examples/parallelized-aws-lambda/revideo-project/src/{scenes/example.tsx → project.tsx} +9 -5
  31. package/examples/parallelized-aws-lambda/revideo-project/src/render.ts +1 -1
  32. package/examples/parallelized-aws-lambda/revideo-project/tsconfig.json +1 -0
  33. package/examples/rive-explanation-video/README.md +0 -3
  34. package/examples/rive-explanation-video/package.json +8 -12
  35. package/examples/rive-explanation-video/src/project.tsx +234 -0
  36. package/examples/rive-explanation-video/src/render.ts +1 -1
  37. package/examples/rive-explanation-video/tsconfig.json +2 -1
  38. package/examples/saas-template/package.json +39 -39
  39. package/examples/stitching-videos/README.md +15 -3
  40. package/examples/stitching-videos/package.json +7 -10
  41. package/examples/stitching-videos/src/{scenes/example.tsx → project.tsx} +36 -3
  42. package/examples/stitching-videos/src/render.ts +4 -16
  43. package/examples/stitching-videos/tsconfig.json +2 -1
  44. package/examples/three-js-example/package.json +10 -13
  45. package/examples/three-js-example/src/project.tsx +105 -0
  46. package/examples/three-js-example/src/render.ts +1 -1
  47. package/examples/three-js-example/tsconfig.json +2 -1
  48. package/examples/youtube-shorts/README.md +14 -60
  49. package/examples/youtube-shorts/package.json +8 -12
  50. package/examples/youtube-shorts/src/{scenes/example.tsx → project.tsx} +20 -3
  51. package/examples/youtube-shorts/src/render.ts +11 -8
  52. package/examples/youtube-shorts/src/utils.ts +1 -1
  53. package/examples/youtube-shorts/tsconfig.json +2 -1
  54. package/index.js +2 -26
  55. package/package.json +9 -9
  56. package/examples/avatar-with-background/src/project.meta +0 -31
  57. package/examples/avatar-with-background/src/project.ts +0 -6
  58. package/examples/avatar-with-background/src/revideo.d.ts +0 -1
  59. package/examples/avatar-with-background/src/scenes/example.meta +0 -5
  60. package/examples/avatar-with-background/vite.config.ts +0 -8
  61. package/examples/github-stars-celebration/src/project.meta +0 -28
  62. package/examples/github-stars-celebration/src/project.ts +0 -8
  63. package/examples/github-stars-celebration/src/revideo.d.ts +0 -1
  64. package/examples/github-stars-celebration/src/scenes/example.meta +0 -5
  65. package/examples/github-stars-celebration/vite.config.ts +0 -8
  66. package/examples/google-cloud-run-parallelized/README.md +0 -127
  67. package/examples/google-cloud-run-parallelized/render-orchestrator/Dockerfile +0 -56
  68. package/examples/google-cloud-run-parallelized/render-orchestrator/package.json +0 -22
  69. package/examples/google-cloud-run-parallelized/render-orchestrator/src/index.ts +0 -72
  70. package/examples/google-cloud-run-parallelized/render-orchestrator/src/revideo.d.ts +0 -1
  71. package/examples/google-cloud-run-parallelized/render-orchestrator/tsconfig.json +0 -10
  72. package/examples/google-cloud-run-parallelized/render-worker/.gcloudignore +0 -17
  73. package/examples/google-cloud-run-parallelized/render-worker/.puppeteerrc.cjs +0 -9
  74. package/examples/google-cloud-run-parallelized/render-worker/package.json +0 -30
  75. package/examples/google-cloud-run-parallelized/render-worker/src/index.ts +0 -45
  76. package/examples/google-cloud-run-parallelized/render-worker/src/project.meta +0 -31
  77. package/examples/google-cloud-run-parallelized/render-worker/src/project.ts +0 -6
  78. package/examples/google-cloud-run-parallelized/render-worker/src/render.ts +0 -14
  79. package/examples/google-cloud-run-parallelized/render-worker/src/revideo.d.ts +0 -1
  80. package/examples/google-cloud-run-parallelized/render-worker/src/scenes/example.tsx +0 -30
  81. package/examples/google-cloud-run-parallelized/render-worker/tsconfig.json +0 -13
  82. package/examples/google-cloud-run-parallelized/render-worker/vite.config.ts +0 -9
  83. package/examples/marketing-templates/marketing-template/src/globals.css +0 -0
  84. package/examples/marketing-templates/marketing-template/src/project.meta +0 -28
  85. package/examples/marketing-templates/marketing-template/src/project.ts +0 -9
  86. package/examples/marketing-templates/marketing-template/src/revideo.d.ts +0 -1
  87. package/examples/marketing-templates/marketing-template/src/scenes/example.meta +0 -5
  88. package/examples/marketing-templates/marketing-template/vite.config.ts +0 -9
  89. package/examples/marketing-templates/multiple-videos-in-one/src/project.meta +0 -28
  90. package/examples/marketing-templates/multiple-videos-in-one/src/project.ts +0 -9
  91. package/examples/marketing-templates/multiple-videos-in-one/src/revideo.d.ts +0 -1
  92. package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.meta +0 -5
  93. package/examples/marketing-templates/multiple-videos-in-one/vite.config.ts +0 -9
  94. package/examples/minimal-drag-drop/next/package-lock.json +0 -5577
  95. package/examples/minimal-drag-drop/next/public/favicon.ico +0 -0
  96. package/examples/minimal-drag-drop/next/public/next.svg +0 -1
  97. package/examples/minimal-drag-drop/next/public/vercel.svg +0 -1
  98. package/examples/minimal-drag-drop/revideo/package-lock.json +0 -3771
  99. package/examples/minimal-drag-drop/revideo/package.json +0 -24
  100. package/examples/minimal-drag-drop/revideo/src/project.meta +0 -28
  101. package/examples/minimal-drag-drop/revideo/src/project.ts +0 -9
  102. package/examples/minimal-drag-drop/revideo/src/render.ts +0 -15
  103. package/examples/minimal-drag-drop/revideo/src/revideo.d.ts +0 -1
  104. package/examples/minimal-drag-drop/revideo/src/scenes/example.meta +0 -5
  105. package/examples/minimal-drag-drop/revideo/src/scenes/example.tsx +0 -44
  106. package/examples/minimal-drag-drop/revideo/tsconfig.json +0 -9
  107. package/examples/minimal-drag-drop/revideo/vite.config.ts +0 -6
  108. package/examples/parallelized-aws-lambda/revideo-project/.puppeteerrc.cjs +0 -9
  109. package/examples/parallelized-aws-lambda/revideo-project/src/project.meta +0 -28
  110. package/examples/parallelized-aws-lambda/revideo-project/src/project.ts +0 -7
  111. package/examples/parallelized-aws-lambda/revideo-project/src/revideo.d.ts +0 -1
  112. package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.meta +0 -5
  113. package/examples/parallelized-aws-lambda/revideo-project/vite.config.ts +0 -9
  114. package/examples/reddit-post-video/README.md +0 -84
  115. package/examples/reddit-post-video/package-lock.json +0 -2941
  116. package/examples/reddit-post-video/package.json +0 -27
  117. package/examples/reddit-post-video/src/global.css +0 -1
  118. package/examples/reddit-post-video/src/metadata.json +0 -576
  119. package/examples/reddit-post-video/src/project.meta +0 -31
  120. package/examples/reddit-post-video/src/project.ts +0 -9
  121. package/examples/reddit-post-video/src/render.ts +0 -157
  122. package/examples/reddit-post-video/src/revideo.d.ts +0 -1
  123. package/examples/reddit-post-video/src/scenes/example.meta +0 -5
  124. package/examples/reddit-post-video/src/scenes/example.tsx +0 -74
  125. package/examples/reddit-post-video/tsconfig.json +0 -9
  126. package/examples/reddit-post-video/vite.config.ts +0 -6
  127. package/examples/rive-explanation-video/src/project.meta +0 -31
  128. package/examples/rive-explanation-video/src/project.ts +0 -8
  129. package/examples/rive-explanation-video/src/revideo.d.ts +0 -1
  130. package/examples/rive-explanation-video/src/scenes/example.meta +0 -5
  131. package/examples/rive-explanation-video/src/scenes/example.tsx +0 -218
  132. package/examples/rive-explanation-video/vite.config.ts +0 -8
  133. package/examples/stitching-videos/src/project.meta +0 -28
  134. package/examples/stitching-videos/src/project.ts +0 -20
  135. package/examples/stitching-videos/src/revideo.d.ts +0 -1
  136. package/examples/stitching-videos/vite.config.ts +0 -8
  137. package/examples/three-js-example/README.md +0 -8
  138. package/examples/three-js-example/src/project.meta +0 -31
  139. package/examples/three-js-example/src/project.ts +0 -8
  140. package/examples/three-js-example/src/revideo.d.ts +0 -1
  141. package/examples/three-js-example/src/scenes/basic3D.meta +0 -5
  142. package/examples/three-js-example/src/scenes/basic3D.tsx +0 -89
  143. package/examples/three-js-example/vite.config.ts +0 -6
  144. package/examples/youtube-shorts/src/project.meta +0 -28
  145. package/examples/youtube-shorts/src/project.ts +0 -9
  146. package/examples/youtube-shorts/src/revideo.d.ts +0 -1
  147. package/examples/youtube-shorts/vite.config.ts +0 -8
  148. /package/examples/minimal-drag-drop/{next/app → app}/api/render/route.ts +0 -0
  149. /package/examples/minimal-drag-drop/{next/app → app}/globals.css +0 -0
  150. /package/examples/minimal-drag-drop/{next/app → app}/layout.tsx +0 -0
  151. /package/examples/minimal-drag-drop/{next/next.config.mjs → next.config.mjs} +0 -0
  152. /package/examples/minimal-drag-drop/{next/postcss.config.js → postcss.config.js} +0 -0
  153. /package/examples/minimal-drag-drop/revideo/{src/global.css → global.css} +0 -0
  154. /package/examples/minimal-drag-drop/{next/tailwind.config.ts → tailwind.config.ts} +0 -0
  155. /package/examples/minimal-drag-drop/{next/tsconfig.json → tsconfig.json} +0 -0
  156. /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/player-react": "0.5.10",
14
- "@revideo/2d": "0.5.10",
15
+ "@revideo/2d": "0.10.0",
16
+ "@revideo/core": "0.10.0",
17
+ "@revideo/player-react": "0.10.0",
15
18
  "class-variance-authority": "^0.7.0",
16
19
  "lucide-react": "^0.378.0",
17
- "next": "14.2.3",
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.0",
29
+ "@revideo/ui": "0.10.0",
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
+ });
@@ -10,8 +10,6 @@
10
10
 
11
11
  ENV ROLLUP_CACHE=/tmp/rollup_cache
12
12
 
13
- RUN npm run build
14
-
15
13
  ENV FFMPEG_PATH=/var/task/node_modules/@ffmpeg-installer/linux-x64/ffmpeg
16
14
 
17
15
  ENV HOME=/tmp
@@ -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
- To deploy the example project to AWS Lambda, clone this repository and make sure that you have the AWS CLI and Docker installed. Then, follow these steps:
21
+ Here's how you can set up your example project on AWS Lambda:
22
22
 
23
- ### Create a public AWS bucket
23
+ ### Assign Permissions
24
24
 
25
- First, create a bucket:
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
- aws s3api create-bucket --bucket your-bucket-name --region your-region
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
- Now apply a bucket policy that makes the bucket public and lets your user write to it:
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
- aws s3api put-bucket-policy --bucket your-bucket-name --policy file://policy.json
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
- Here, `policy.json` refers to a file that contains the configuration below - note that `<your-user-arn>` should be replaced with the ARN of your user:
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": "AddPerm",
323
+ "Sid": "PublicReadGetObject",
45
324
  "Effect": "Allow",
46
325
  "Principal": "*",
47
326
  "Action": "s3:GetObject",
48
- "Resource": "arn:aws:s3:::your-bucket-name/*"
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:::your-bucket-name/*"
336
+ "Resource": "arn:aws:s3:::<your-bucket-name>/*"
58
337
  }
59
-
60
338
  ]
61
339
  }
62
340
  ```
63
341
 
64
- ### Configure an IAM role for your user
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
- "Version": "2012-10-17",
73
- "Statement": [
74
- {
75
- "Sid": "0",
76
- "Effect": "Allow",
77
- "Action": [
78
- "s3:ListAllMyBuckets"
79
- ],
80
- "Resource": [
81
- "*"
82
- ]
83
- },
84
- {
85
- "Sid": "1",
86
- "Effect": "Allow",
87
- "Action": [
88
- "s3:CreateBucket",
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
- ### Build the docker image and push it to ECR
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 my-revideo-project --region us-east-1
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 my-revideo-project:latest .
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 my-revideo-project:latest <your-ecr-uri>:latest
385
+ docker tag revideo-render-project:latest <your-ecr-uri>:latest
158
386
  ```
159
387
 
160
- Finally, push the image to your repository:
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 push <your-ecr-uri>:latest
391
+ aws ecr get-login-password --region <your-region> | docker login --username AWS --password-stdin <your-ecr-uri>
163
392
  ```
164
393
 
165
- ### Create a Lambda function from your docker image
394
+ Now push the image to your repository:
395
+ ```
396
+ docker push <your-ecr-uri>:latest
397
+ ```
166
398
 
167
- Finally, create a lambda function from your docker image:
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 my-revideo-render-function \
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 600 \
176
- --memory-size 4096 \
177
- --environment Variables={REVIDEO_BUCKET_NAME=your-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
- ### Test your function
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": 25,
422
+ "numWorkers": 5,
190
423
  "jobType": "fullRender",
191
424
  "variables": {"message": "Hello from Revideo!"}
192
425
  }
193
426
  ```
194
427
 
195
- The function should run and return a url to the rendered video inside your bucket.
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": "vite",
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.5.10",
13
- "@revideo/core": "0.5.10",
14
- "@revideo/ffmpeg": "0.5.10",
15
- "@revideo/renderer": "0.5.10",
16
- "@revideo/vite-plugin": "0.5.10",
10
+ "@revideo/2d": "0.10.0",
11
+ "@revideo/core": "0.10.0",
12
+ "@revideo/ffmpeg": "0.10.0",
13
+ "@revideo/renderer": "0.10.0",
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.5.10",
24
- "@revideo/ui": "0.5.10",
20
+ "@revideo/cli": "0.10.0",
21
+ "@revideo/ui": "0.10.0",
22
+ "@types/chroma-js": "^2.4.4",
25
23
  "typescript": "5.5.4",
26
- "vite": "^4.5"
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.ts',
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