@revideo/create 0.4.3-alpha.1002 → 0.4.4
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/README.md +5 -2
- package/examples/default/package.json +7 -7
- package/examples/github-stars-celebration/package-lock.json +3833 -0
- package/examples/github-stars-celebration/package.json +24 -0
- package/examples/github-stars-celebration/src/global.css +1 -0
- package/examples/github-stars-celebration/src/project.meta +31 -0
- package/examples/github-stars-celebration/src/project.ts +8 -0
- package/examples/github-stars-celebration/src/render.ts +15 -0
- package/examples/github-stars-celebration/src/revideo.d.ts +1 -0
- package/examples/github-stars-celebration/src/scenes/example.meta +5 -0
- package/examples/github-stars-celebration/src/scenes/example.tsx +51 -0
- package/examples/github-stars-celebration/tsconfig.json +9 -0
- package/examples/github-stars-celebration/vite.config.ts +8 -0
- package/examples/google-cloud-run-parallelized/render-orchestrator/Dockerfile +1 -1
- package/examples/google-cloud-run-parallelized/render-orchestrator/package.json +3 -3
- package/examples/google-cloud-run-parallelized/render-worker/package.json +8 -8
- package/examples/google-cloud-run-parallelized/render-worker/src/index.ts +7 -1
- package/examples/google-cloud-run-parallelized/render-worker/src/project.meta +31 -0
- package/examples/google-cloud-run-parallelized/render-worker/src/project.ts +1 -1
- package/examples/google-cloud-run-parallelized/render-worker/src/render.ts +14 -0
- package/examples/parallelized-aws-lambda/.dockerignore +2 -0
- package/examples/parallelized-aws-lambda/Dockerfile +21 -0
- package/examples/parallelized-aws-lambda/Dockerfile.base +64 -0
- package/examples/parallelized-aws-lambda/README.md +197 -0
- package/examples/parallelized-aws-lambda/revideo-project/.puppeteerrc.cjs +9 -0
- package/examples/parallelized-aws-lambda/revideo-project/package-lock.json +4133 -0
- package/examples/parallelized-aws-lambda/revideo-project/package.json +31 -0
- package/examples/parallelized-aws-lambda/revideo-project/src/lambda.ts +144 -0
- package/examples/parallelized-aws-lambda/revideo-project/src/project.meta +31 -0
- package/examples/parallelized-aws-lambda/revideo-project/src/project.ts +7 -0
- package/examples/parallelized-aws-lambda/revideo-project/src/render.ts +16 -0
- package/examples/parallelized-aws-lambda/revideo-project/src/revideo.d.ts +1 -0
- package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.meta +5 -0
- package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.tsx +29 -0
- package/examples/parallelized-aws-lambda/revideo-project/tsconfig.json +10 -0
- package/examples/parallelized-aws-lambda/revideo-project/vite.config.ts +9 -0
- package/examples/saas-template/next/package.json +1 -1
- package/examples/saas-template/revideo/package.json +7 -7
- package/examples/saas-template/revideo/src/project.meta +1 -5
- package/package.json +9 -9
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "test-revideo-project",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "vite",
|
|
7
|
+
"serve": "vite",
|
|
8
|
+
"build": "tsc && vite build",
|
|
9
|
+
"render": "tsc && node dist/render.js"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@revideo/2d": "0.4.3",
|
|
13
|
+
"@revideo/core": "0.4.3",
|
|
14
|
+
"@revideo/ffmpeg": "0.4.3",
|
|
15
|
+
"@revideo/renderer": "0.4.3",
|
|
16
|
+
"@revideo/vite-plugin": "0.4.3",
|
|
17
|
+
"@sparticuz/chromium": "^123.0.1",
|
|
18
|
+
"aws-lambda": "^1.0.7",
|
|
19
|
+
"aws-sdk": "^2.1642.0",
|
|
20
|
+
"ffmpeg-static": "^5.2.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@revideo/cli": "^0.4.3",
|
|
24
|
+
"@revideo/ui": "0.4.3",
|
|
25
|
+
"typescript": "^5.2.2",
|
|
26
|
+
"vite": "^4.5"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { renderPartialVideo } from '@revideo/renderer';
|
|
2
|
+
import { mergeAudioWithVideo, concatenateMedia } from '@revideo/ffmpeg';
|
|
3
|
+
import chromium from '@sparticuz/chromium';
|
|
4
|
+
import * as AWS from "aws-sdk";
|
|
5
|
+
import * as fs from "fs";
|
|
6
|
+
|
|
7
|
+
AWS.config.update({ region: 'us-east-1' });
|
|
8
|
+
chromium.setHeadlessMode = true;
|
|
9
|
+
|
|
10
|
+
const s3 = new AWS.S3();
|
|
11
|
+
const lambda = new AWS.Lambda();
|
|
12
|
+
|
|
13
|
+
export const handler = async (event: any, context: any) => {
|
|
14
|
+
const { jobType, jobId } = event;
|
|
15
|
+
|
|
16
|
+
if(jobType == "partialRender"){
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const { workerId, numWorkers, variables } = event;
|
|
20
|
+
|
|
21
|
+
const { audioFile, videoFile } = await renderPartialVideo({
|
|
22
|
+
projectFile: './src/project.ts',
|
|
23
|
+
workerId: workerId,
|
|
24
|
+
numWorkers: numWorkers,
|
|
25
|
+
variables: variables,
|
|
26
|
+
settings: { logProgress: true, viteBasePort: 5000, outDir: "/tmp/output", viteConfig: { cacheDir: "/tmp/.vite"}, puppeteer: { args: chromium.args, headless: chromium.headless }}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
await Promise.all([uploadFileToBucket(audioFile, `${jobId}-audio-${workerId}.wav`), uploadFileToBucket(videoFile, `${jobId}-video-${workerId}.mp4`)]);
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
statusCode: 200,
|
|
33
|
+
body: JSON.stringify({
|
|
34
|
+
audioUrl: `https://${process.env.REVIDEO_BUCKET_NAME}.s3.amazonaws.com/${jobId}-audio-${workerId}.wav`,
|
|
35
|
+
videoUrl: `https://${process.env.REVIDEO_BUCKET_NAME}.s3.amazonaws.com/${jobId}-video-${workerId}.mp4`
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
} catch(err) {
|
|
39
|
+
return {
|
|
40
|
+
statusCode: 500,
|
|
41
|
+
body: JSON.stringify({
|
|
42
|
+
error: `Error during partial render: ${err}`
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
} else {
|
|
49
|
+
const { numWorkers, variables, jobId } = event;
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
|
|
53
|
+
const renderPromises = [];
|
|
54
|
+
for (let i = 0; i < numWorkers; i++) {
|
|
55
|
+
console.log("invoking worker", i);
|
|
56
|
+
renderPromises.push(invokePartialRender(variables, i, numWorkers, jobId));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
console.log("now waiting");
|
|
60
|
+
|
|
61
|
+
const results = await Promise.all(renderPromises);
|
|
62
|
+
console.log("obtained results", results);
|
|
63
|
+
const audios = results.map(result => result.audioUrl);
|
|
64
|
+
const videos = results.map(result => result.videoUrl);
|
|
65
|
+
|
|
66
|
+
console.log("videos", videos);
|
|
67
|
+
await Promise.all([
|
|
68
|
+
concatenateMedia(audios, `/tmp/${jobId}-audio.wav`),
|
|
69
|
+
concatenateMedia(videos, `/tmp/${jobId}-visuals.mp4`)
|
|
70
|
+
]);
|
|
71
|
+
|
|
72
|
+
await mergeAudioWithVideo(`/tmp/${jobId}-audio.wav`, `/tmp/${jobId}-visuals.mp4`, `/tmp/${jobId}.mp4`);
|
|
73
|
+
await uploadFileToBucket(`/tmp/${jobId}.mp4`, `${jobId}.mp4`);
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
statusCode: 200,
|
|
77
|
+
body: JSON.stringify({
|
|
78
|
+
resultUrl: `https://${process.env.REVIDEO_BUCKET_NAME}.s3.amazonaws.com/${jobId}.mp4`,
|
|
79
|
+
}),
|
|
80
|
+
};
|
|
81
|
+
} catch(err){
|
|
82
|
+
return {
|
|
83
|
+
statusCode: 500,
|
|
84
|
+
body: JSON.stringify({
|
|
85
|
+
error: `An error occured during rendering: ${err}`
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
async function uploadFileToBucket(localPath: string, destinationPath: string) {
|
|
96
|
+
const fileContent = await fs.promises.readFile(localPath);
|
|
97
|
+
|
|
98
|
+
const params = {
|
|
99
|
+
Bucket: process.env.REVIDEO_BUCKET_NAME,
|
|
100
|
+
Key: destinationPath,
|
|
101
|
+
Body: fileContent,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
const data = await s3.upload(params).promise();
|
|
106
|
+
console.log(`File uploaded successfully. ${data.Location}`);
|
|
107
|
+
} catch (err) {
|
|
108
|
+
console.error("Error uploading file: ", err);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async function invokePartialRender(variables: any, workerId: number, numWorkers: number, jobId: string){
|
|
113
|
+
const params = {
|
|
114
|
+
FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
115
|
+
InvocationType: 'RequestResponse',
|
|
116
|
+
LogType: 'None',
|
|
117
|
+
Payload: JSON.stringify({
|
|
118
|
+
variables: variables,
|
|
119
|
+
workerId: workerId,
|
|
120
|
+
numWorkers: numWorkers,
|
|
121
|
+
jobId: jobId,
|
|
122
|
+
jobType: "partialRender"
|
|
123
|
+
}),
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
try {
|
|
127
|
+
const data = await lambda.invoke(params).promise();
|
|
128
|
+
const payload = JSON.parse(data.Payload as string);
|
|
129
|
+
console.log('Lambda invoke result:', payload);
|
|
130
|
+
|
|
131
|
+
// Parse the body string to JSON to access the audioUrl and videoUrl
|
|
132
|
+
const body = JSON.parse(payload.body);
|
|
133
|
+
|
|
134
|
+
if(payload.statusCode !== 200){
|
|
135
|
+
throw Error(body.message); // Use the parsed body for error messages
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return { audioUrl: body.audioUrl, videoUrl: body.videoUrl };
|
|
139
|
+
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.error("Error during partial render:", error);
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 0,
|
|
3
|
+
"shared": {
|
|
4
|
+
"background": null,
|
|
5
|
+
"range": [
|
|
6
|
+
0,
|
|
7
|
+
null
|
|
8
|
+
],
|
|
9
|
+
"size": {
|
|
10
|
+
"x": 1920,
|
|
11
|
+
"y": 1080
|
|
12
|
+
},
|
|
13
|
+
"audioOffset": 0
|
|
14
|
+
},
|
|
15
|
+
"preview": {
|
|
16
|
+
"fps": 30,
|
|
17
|
+
"resolutionScale": 1
|
|
18
|
+
},
|
|
19
|
+
"rendering": {
|
|
20
|
+
"fps": 30,
|
|
21
|
+
"resolutionScale": 1,
|
|
22
|
+
"colorSpace": "srgb",
|
|
23
|
+
"exporter": {
|
|
24
|
+
"name": "@revideo/core/ffmpeg",
|
|
25
|
+
"options": {
|
|
26
|
+
"fastStart": true,
|
|
27
|
+
"includeAudio": true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {renderVideo} from '@revideo/renderer';
|
|
2
|
+
|
|
3
|
+
async function render() {
|
|
4
|
+
console.log('Rendering video...');
|
|
5
|
+
|
|
6
|
+
// This is the main function that renders the video
|
|
7
|
+
const file = await renderVideo({
|
|
8
|
+
projectFile: './src/project.ts',
|
|
9
|
+
variables: {message: 'Hi!'},
|
|
10
|
+
settings: {logProgress: true},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
console.log(`Rendered video to ${file}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
render();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="@revideo/core/project" />
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {Audio, Img, Txt, Video, makeScene2D} from '@revideo/2d';
|
|
2
|
+
import {createRef, createSignal, useScene, waitFor} from '@revideo/core';
|
|
3
|
+
|
|
4
|
+
export default makeScene2D(function* (view) {
|
|
5
|
+
const fontSize = createSignal(50);
|
|
6
|
+
|
|
7
|
+
yield view.add(
|
|
8
|
+
<>
|
|
9
|
+
<Video
|
|
10
|
+
src={'https://revideo-example-assets.s3.amazonaws.com/beach-4.mp4'}
|
|
11
|
+
size={['100%', '100%']}
|
|
12
|
+
play={true}
|
|
13
|
+
/>
|
|
14
|
+
<Audio
|
|
15
|
+
src={'https://revideo-example-assets.s3.amazonaws.com/chill-beat-2.mp3'}
|
|
16
|
+
play={true}
|
|
17
|
+
/>
|
|
18
|
+
</>,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
yield* waitFor(1);
|
|
22
|
+
|
|
23
|
+
yield view.add(<Txt fill={"white"} fontSize={fontSize}>{useScene().variables.get("message", "Hello World!")()}</Txt>);
|
|
24
|
+
|
|
25
|
+
yield* fontSize(100, 4); // increase font size to 100 in 4 seconds
|
|
26
|
+
|
|
27
|
+
yield* waitFor(25); // wait for 25 seconds more
|
|
28
|
+
|
|
29
|
+
});
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"render": "tsc && node dist/render.js"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@revideo/core": "0.4.
|
|
13
|
-
"@revideo/2d": "0.4.
|
|
14
|
-
"@revideo/renderer": "0.4.
|
|
15
|
-
"@revideo/vite-plugin": "0.4.
|
|
16
|
-
"@revideo/ffmpeg": "0.4.
|
|
12
|
+
"@revideo/core": "0.4.4",
|
|
13
|
+
"@revideo/2d": "0.4.4",
|
|
14
|
+
"@revideo/renderer": "0.4.4",
|
|
15
|
+
"@revideo/vite-plugin": "0.4.4",
|
|
16
|
+
"@revideo/ffmpeg": "0.4.4"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@revideo/ui": "0.4.
|
|
20
|
-
"@revideo/cli": "0.4.
|
|
19
|
+
"@revideo/ui": "0.4.4",
|
|
20
|
+
"@revideo/cli": "0.4.4",
|
|
21
21
|
"typescript": "^5.2.2",
|
|
22
22
|
"vite": "^4.5"
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revideo/create",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Quickly scaffold revideo projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "revideo",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"url": "https://github.com/havenhq/revideo.git"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@revideo/2d": "
|
|
24
|
-
"@revideo/core": "
|
|
25
|
-
"@revideo/ffmpeg": "
|
|
26
|
-
"@revideo/renderer": "
|
|
27
|
-
"@revideo/ui": "
|
|
28
|
-
"@revideo/vite-plugin": "
|
|
23
|
+
"@revideo/2d": "0.4.4",
|
|
24
|
+
"@revideo/core": "0.4.4",
|
|
25
|
+
"@revideo/ffmpeg": "0.4.4",
|
|
26
|
+
"@revideo/renderer": "0.4.4",
|
|
27
|
+
"@revideo/ui": "0.4.4",
|
|
28
|
+
"@revideo/vite-plugin": "0.4.4"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@revideo/telemetry": "
|
|
31
|
+
"@revideo/telemetry": "0.4.4",
|
|
32
32
|
"minimist": "^1.2.8",
|
|
33
33
|
"prompts": "^2.4.2"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "af1de76d3f454f2b2b9452ef19d6f91096d6791c"
|
|
36
36
|
}
|