@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
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {Three} from './components/Three';
|
|
2
|
+
import { makeScene2D, Txt } from '@revideo/2d';
|
|
3
|
+
import { makeProject, tween, waitFor, delay, createRef, all, chain, linear} from '@revideo/core';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import './global.css';
|
|
6
|
+
|
|
7
|
+
function setup3DScene() {
|
|
8
|
+
const threeScene = new THREE.Scene();
|
|
9
|
+
|
|
10
|
+
const geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
|
|
11
|
+
const material = new THREE.MeshNormalMaterial();
|
|
12
|
+
|
|
13
|
+
const mesh = new THREE.Mesh( geometry, material );
|
|
14
|
+
threeScene.add(mesh);
|
|
15
|
+
|
|
16
|
+
const camera = new THREE.PerspectiveCamera(90);
|
|
17
|
+
|
|
18
|
+
mesh.position.set(0, 0, 0);
|
|
19
|
+
mesh.scale.set(1, 1, 1);
|
|
20
|
+
camera.rotation.set(0, 0, 0);
|
|
21
|
+
camera.position.set(0, 0, 0.5);
|
|
22
|
+
|
|
23
|
+
return {threeScene, camera, mesh};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The Revideo scene
|
|
28
|
+
*/
|
|
29
|
+
const scene = makeScene2D('scene', function* (view) {
|
|
30
|
+
const {threeScene, camera, mesh} = setup3DScene();
|
|
31
|
+
|
|
32
|
+
const threeRef = createRef<Three>();
|
|
33
|
+
const txtRef = createRef<Txt>();
|
|
34
|
+
|
|
35
|
+
yield view.add(
|
|
36
|
+
<>
|
|
37
|
+
<Three
|
|
38
|
+
width={1920}
|
|
39
|
+
height={1080}
|
|
40
|
+
camera={camera}
|
|
41
|
+
scene={threeScene}
|
|
42
|
+
opacity={0}
|
|
43
|
+
fontWeight={900}
|
|
44
|
+
ref={threeRef}
|
|
45
|
+
/>
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
yield view.add(<Txt fill={"black"} fontFamily={"Lexend"} ref={txtRef} fontSize={80}/>)
|
|
50
|
+
|
|
51
|
+
yield* chain(
|
|
52
|
+
txtRef().text("Revideo x 3D with Three.js", 1),
|
|
53
|
+
all(
|
|
54
|
+
txtRef().position.y(-300, 1),
|
|
55
|
+
delay(0.5, threeRef().opacity(1, 0.5))
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
yield tween(4, value => {
|
|
60
|
+
mesh.rotation.set(
|
|
61
|
+
0,
|
|
62
|
+
linear(value, 0, 2*3.14),
|
|
63
|
+
0
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
yield* waitFor(2);
|
|
68
|
+
|
|
69
|
+
yield addRotatingCube(threeRef().scene(), 0.1, 0.3, -0.2, 0.1);
|
|
70
|
+
yield addRotatingCube(threeRef().scene(), 0.1, -0.3, -0.2, 0.1);
|
|
71
|
+
|
|
72
|
+
yield* waitFor(2);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
function* addRotatingCube(threeScene: THREE.Scene, size: number, x: number, y: number, z: number){
|
|
76
|
+
const geometry = new THREE.BoxGeometry( size, size, size );
|
|
77
|
+
const material = new THREE.MeshNormalMaterial();
|
|
78
|
+
const mesh = new THREE.Mesh( geometry, material );
|
|
79
|
+
|
|
80
|
+
mesh.position.set(x, y, z);
|
|
81
|
+
mesh.scale.set(1, 1, 1);
|
|
82
|
+
|
|
83
|
+
threeScene.add(mesh);
|
|
84
|
+
|
|
85
|
+
yield* tween(4, value => {
|
|
86
|
+
mesh.rotation.set(
|
|
87
|
+
0,
|
|
88
|
+
linear(value, 0, 2*3.14),
|
|
89
|
+
0
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The final revideo project
|
|
96
|
+
*/
|
|
97
|
+
export default makeProject({
|
|
98
|
+
scenes: [scene],
|
|
99
|
+
settings: {
|
|
100
|
+
// Example settings:
|
|
101
|
+
shared: {
|
|
102
|
+
size: {x: 1920, y: 1080}
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -1,65 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Revideo Minimal Starter Template
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This is a minimal Revideo starter project. It can be bootstrapped using
|
|
4
|
+
`npm init @revideo@latest` and selecting the minimal template.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
It includes a simple scene with a background video, music and the Revideo logo.
|
|
7
|
+
You can get started by editing the `project.tsx` file in the `src` folder.
|
|
6
8
|
|
|
9
|
+
You can run the Revideo editor using `npm start` and render the final video
|
|
10
|
+
using `npm run render`.
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
If you want to see what's possible with Revideo, check out the other templates
|
|
13
|
+
in the [Revideo Examples repository](https://github.com/redotvideo/examples), or
|
|
14
|
+
the [Revideo documentation](https://docs.re.video).
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- `src/render.ts`: This code calls `renderVideo()` with variables from a metadata file to export the final video.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Getting Started
|
|
18
|
-
|
|
19
|
-
After cloning the repo, go inside the project folder and install all dependencies using `npm install`. Now you can preview an example video.
|
|
20
|
-
|
|
21
|
-
### Preview Video
|
|
22
|
-
|
|
23
|
-
You can start the editor using the following command:
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
npm start
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
The editor preview uses example assets (images and voiceovers) specified in `src/metadata.json` which are located in an AWS bucket we own. This way, you can test the template without having to generate your own assets. To render the video with the example asseets, click the render button in the UI or run `npm run render`.
|
|
30
|
-
|
|
31
|
-
When previewing the video in the editor, your browser will first have to load the assets, which can cause a bit of a lag - you might have to wait a few seconds.
|
|
32
|
-
|
|
33
|
-
## Rendering Videos with your own AI assets
|
|
34
|
-
If you want to render your own videos using ChatGPT, Dall-E and Elevenlabs voiceovers, you need to create a `.env` file in the project root directory and add the following environment variables:
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
OPENAI_API_KEY=<your-openai-key>
|
|
38
|
-
ELEVEN_API_KEY=<your-elevenlabs-key>
|
|
39
|
-
DEEPGRAM_API_KEY=<your-deepgram-key>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Now you can run `tsc && node dist/get-assets.ts`, which will create a new metadata file that you can use in `render.ts` and `project.ts`.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## Animating Subtitles
|
|
46
|
-
|
|
47
|
-
This project has a heavy emphasis on animating subtitles. It provides the option to stream subtitles word-by-word, to highlight the currently spoken word, or to let words fade into the image as they appear. To play around with the different caption animation options, you can modify the `textSettings` object in `src/scenes/example.tsx`:
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
const textSettings: captionSettings = {
|
|
51
|
-
fontSize: 80,
|
|
52
|
-
numSimultaneousWords: 4, // how many words are shown at most simultaneously
|
|
53
|
-
textColor: "white",
|
|
54
|
-
fontWeight: 800,
|
|
55
|
-
fontFamily: "Mulish",
|
|
56
|
-
stream: false, // if true, words appear one by one
|
|
57
|
-
textAlign: "center",
|
|
58
|
-
textBoxWidthInPercent: 70,
|
|
59
|
-
fadeInAnimation: true,
|
|
60
|
-
currentWordColor: "cyan",
|
|
61
|
-
currentWordBackgroundColor: "red", // adds a colored box to the word currently spoken
|
|
62
|
-
shadowColor: "black",
|
|
63
|
-
shadowBlur: 30
|
|
64
|
-
}
|
|
65
|
-
```
|
|
16
|
+
If you want to include your Revideo project in a website, you can use the
|
|
17
|
+
Next.js template. It can be found in the Revideo Examples repository or
|
|
18
|
+
bootstrapped using `npm init @revideo@latest` and selecting the Next.js
|
|
19
|
+
template.
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "revideo",
|
|
2
|
+
"name": "revideo-app",
|
|
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
10
|
"@deepgram/sdk": "^3.3.1",
|
|
13
|
-
"@revideo/2d": "0.
|
|
14
|
-
"@revideo/
|
|
15
|
-
"@revideo/
|
|
16
|
-
"@revideo/ffmpeg": "0.5.10",
|
|
17
|
-
"@revideo/renderer": "0.5.10",
|
|
18
|
-
"@revideo/vite-plugin": "0.5.10",
|
|
11
|
+
"@revideo/2d": "0.10.1",
|
|
12
|
+
"@revideo/core": "0.10.1",
|
|
13
|
+
"@revideo/renderer": "0.10.1",
|
|
19
14
|
"dotenv": "^16.4.5",
|
|
20
15
|
"express": "^4.19.2",
|
|
21
16
|
"openai": "^4.40.2",
|
|
22
17
|
"uuid": "^9.0.1"
|
|
23
18
|
},
|
|
24
19
|
"devDependencies": {
|
|
25
|
-
"@revideo/
|
|
26
|
-
"@
|
|
20
|
+
"@revideo/cli": "0.10.1",
|
|
21
|
+
"@revideo/ui": "0.10.1",
|
|
22
|
+
"@types/uuid": "^10.0.0",
|
|
27
23
|
"typescript": "5.5.4",
|
|
28
24
|
"vite": "^4.5"
|
|
29
25
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {Audio, Img, makeScene2D, Txt, Rect, Layout} from '@revideo/2d';
|
|
2
|
-
import {all, createRef, waitFor, useScene, Reference, createSignal} from '@revideo/core';
|
|
2
|
+
import {all, createRef, waitFor, useScene, Reference, createSignal, makeProject} from '@revideo/core';
|
|
3
|
+
import metadata from './metadata.json';
|
|
4
|
+
import './global.css';
|
|
3
5
|
|
|
4
6
|
interface Word {
|
|
5
7
|
punctuated_word: string;
|
|
@@ -41,8 +43,10 @@ const textSettings: captionSettings = {
|
|
|
41
43
|
shadowBlur: 30
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
/**
|
|
47
|
+
* The Revideo scene
|
|
48
|
+
*/
|
|
49
|
+
const scene = makeScene2D('scene', function* (view) {
|
|
46
50
|
const images = useScene().variables.get('images', [])();
|
|
47
51
|
const audioUrl = useScene().variables.get('audioUrl', 'none')();
|
|
48
52
|
const words = useScene().variables.get('words', [])();
|
|
@@ -222,3 +226,16 @@ function* highlightCurrentWord(container: Reference<Layout>, currentBatch: Word[
|
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* The final revideo project
|
|
232
|
+
*/
|
|
233
|
+
export default makeProject({
|
|
234
|
+
scenes: [scene],
|
|
235
|
+
variables: metadata,
|
|
236
|
+
settings: {
|
|
237
|
+
shared: {
|
|
238
|
+
size: {x: 1920, y: 1080},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
});
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {renderVideo} from '@revideo/renderer';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
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.tsx',
|
|
9
|
+
settings: {logProgress: true},
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
console.log(`Rendered video to ${file}`);
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
render();
|
package/index.js
CHANGED
|
@@ -21,7 +21,7 @@ const templates = [
|
|
|
21
21
|
title: 'Revideo with Next.js',
|
|
22
22
|
description: 'A minimal web app built with Revideo and Next.js.',
|
|
23
23
|
recommended: true,
|
|
24
|
-
|
|
24
|
+
startcommands: 'readme',
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
value: 'avatar-with-background',
|
|
@@ -35,12 +35,6 @@ const templates = [
|
|
|
35
35
|
description: 'Animate a celebration of GitHub repository stars.',
|
|
36
36
|
startcommands: 'default',
|
|
37
37
|
},
|
|
38
|
-
{
|
|
39
|
-
value: 'google-cloud-run-parallelized',
|
|
40
|
-
title: 'Google Cloud Run Parallelized',
|
|
41
|
-
description: 'Example of parallelized rendering using Google Cloud Run.',
|
|
42
|
-
startcommands: 'readme',
|
|
43
|
-
},
|
|
44
38
|
{
|
|
45
39
|
value: 'marketing-templates',
|
|
46
40
|
title: 'Marketing Templates',
|
|
@@ -52,7 +46,7 @@ const templates = [
|
|
|
52
46
|
title: 'Drag and Drop Example',
|
|
53
47
|
description:
|
|
54
48
|
'A minimal example of an editor with drag-and-drop editing functionality.',
|
|
55
|
-
startcommands: '
|
|
49
|
+
startcommands: 'readme',
|
|
56
50
|
},
|
|
57
51
|
{
|
|
58
52
|
value: 'parallelized-aws-lambda',
|
|
@@ -60,12 +54,6 @@ const templates = [
|
|
|
60
54
|
description: 'Example of parallelized rendering using AWS Lambda.',
|
|
61
55
|
startcommands: 'readme',
|
|
62
56
|
},
|
|
63
|
-
{
|
|
64
|
-
value: 'reddit-post-video',
|
|
65
|
-
title: 'Reddit Post Video',
|
|
66
|
-
description: 'Generate a video from a Reddit post.',
|
|
67
|
-
startcommands: 'default',
|
|
68
|
-
},
|
|
69
57
|
{
|
|
70
58
|
value: 'rive-explanation-video',
|
|
71
59
|
title: 'Rive Explanation Video',
|
|
@@ -226,18 +214,6 @@ async function run() {
|
|
|
226
214
|
if (selectedTemplate.startcommands === 'default') {
|
|
227
215
|
console.log(installCommand);
|
|
228
216
|
console.log(` ${boldManager} start`);
|
|
229
|
-
} else if (selectedTemplate.startcommands === 'next') {
|
|
230
|
-
console.log(kleur.blue('\n√ Start the NextJS server:'));
|
|
231
|
-
console.log(` ${kleur.bold('cd')} next`);
|
|
232
|
-
console.log(installCommand);
|
|
233
|
-
console.log(` ${boldManager} run dev`);
|
|
234
|
-
|
|
235
|
-
console.log(
|
|
236
|
-
kleur.blue('\nIn another terminal, serve your revideo project:'),
|
|
237
|
-
);
|
|
238
|
-
console.log(` ${kleur.bold('cd')} revideo`);
|
|
239
|
-
console.log(installCommand);
|
|
240
|
-
console.log(` ${kleur.bold('npx')} revideo serve`);
|
|
241
217
|
} else {
|
|
242
218
|
console.log(kleur.blue('\nNow find the setup instructions in README.md'));
|
|
243
219
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revideo/create",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
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.10.1",
|
|
24
|
+
"@revideo/core": "0.10.1",
|
|
25
|
+
"@revideo/ffmpeg": "0.10.1",
|
|
26
|
+
"@revideo/renderer": "0.10.1",
|
|
27
|
+
"@revideo/ui": "0.10.1",
|
|
28
|
+
"@revideo/vite-plugin": "0.10.1"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@revideo/telemetry": "
|
|
31
|
+
"@revideo/telemetry": "0.10.1",
|
|
32
32
|
"minimist": "^1.2.8",
|
|
33
33
|
"prompts": "^2.4.2"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "f7082a9efe18e2c2bfd726fa77df7e3be1af1080"
|
|
36
36
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 0,
|
|
3
|
-
"shared": {
|
|
4
|
-
"background": null,
|
|
5
|
-
"range": [
|
|
6
|
-
0,
|
|
7
|
-
null
|
|
8
|
-
],
|
|
9
|
-
"size": {
|
|
10
|
-
"x": 1080,
|
|
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/wasm",
|
|
25
|
-
"options": {
|
|
26
|
-
"fastStart": true,
|
|
27
|
-
"includeAudio": true
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@revideo/core/project" />
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 0,
|
|
3
|
-
"shared": {
|
|
4
|
-
"background": "rgb(20,20,20)",
|
|
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/wasm",
|
|
25
|
-
"options": {}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@revideo/core/project" />
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# Parallel Rendering with Cloud Functions
|
|
2
|
-
|
|
3
|
-
This project shows you how you can parallelize rendering across multiple Google Cloud functions to get much faster rendering speeds. Instead of rendering, say, 60 seconds of video in one process, we can also use 30 cloud functions to render 2s of video each, and afterwards stitch together the resulting partial videos.
|
|
4
|
-
|
|
5
|
-
In this example, we are going to deploy two services to Google Cloud:
|
|
6
|
-
|
|
7
|
-
- `/render-worker`: This is a Google Cloud Function that is responsible for rendering a partial video. It has access to your video template (`/render-worker/src/scenes`) and receives the number of total workers as well as its worker ID as an input. It accordingly exports the audio and visuals of the partial video.
|
|
8
|
-
|
|
9
|
-
- `/render-orchestrator`: This is a minimal Google Cloud Run service that manages the render workers and is your entrypoint to start rendering jobs. It receives rendering requests along with the number of desired workers, accordingly sends partial render requests to the render workers and merges their results together to obtain the final video
|
|
10
|
-
|
|
11
|
-
## Getting Started
|
|
12
|
-
|
|
13
|
-
To get started, clone the `revideo-examples` repository and navigate to the `google-cloud-run-parallelized` directory.
|
|
14
|
-
|
|
15
|
-
### Enable gcloud services
|
|
16
|
-
|
|
17
|
-
To set up your Google Cloud services, ensure that you have the gcloud CLI installed ([guide](https://cloud.google.com/sdk/docs/install)). Then, enable the required services to deploy Cloud Functions:
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
gcloud services enable run.googleapis.com
|
|
21
|
-
gcloud services enable cloudfunctions.googleapis.com
|
|
22
|
-
gcloud services enable storage.googleapis.com
|
|
23
|
-
gcloud services enable cloudbuild.googleapis.com
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Create Storage Bucket
|
|
27
|
-
|
|
28
|
-
You'll need a storage bucket to save your videos as well as partial videos to. To create one, run the following command and replace `<your-region>` with your desired region (e.g. `us-east1`):
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
gsutil mb -l <your-region> gs://<your-bucket-name>/
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Now enable public read access by running the following command:
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
gsutil iam ch allUsers:objectViewer gs://<your-bucket-name>/
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Finally, you need to modify the CORS settings of your bucket. To do so, create the following file `cors_config.json`:
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
[
|
|
44
|
-
{
|
|
45
|
-
"origin": ["*"],
|
|
46
|
-
"responseHeader": ["Content-Type"],
|
|
47
|
-
"method": ["GET", "HEAD", "DELETE"],
|
|
48
|
-
"maxAgeSeconds": 3600
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Now run:
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
gsutil cors set cors_config.json gs://<your-bucket-name>/
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Now you can deploy your render worker cloud function.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
### Deploy Render Worker Cloud Function
|
|
63
|
-
|
|
64
|
-
To deploy the render worker cloud function, navigate to `/render-worker` and run `npm install`. Now run the following command:
|
|
65
|
-
|
|
66
|
-
🚨 **Note:** In the commands below, make sure to select the same region (<your-region>) as the bucket you just created. Otherwise, your render jobs will run much slower.
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
gcloud functions deploy render-worker \
|
|
70
|
-
--runtime nodejs18 \
|
|
71
|
-
--trigger-http \
|
|
72
|
-
--allow-unauthenticated \
|
|
73
|
-
--gen2 \
|
|
74
|
-
--memory 4Gi \
|
|
75
|
-
--cpu 2 \
|
|
76
|
-
--concurrency=1 \
|
|
77
|
-
--timeout=3600s \
|
|
78
|
-
--region=<your-region> \
|
|
79
|
-
--set-env-vars=FFMPEG_PATH=ffmpeg,FFPROBE_PATH=ffprobe,GCP_BUCKET_NAME=<your-bucket-name>
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
You'll now have to wait some time for the deployment. Once your cloud function is deployed, its URL will be logged to the terminal (we will reference it as `<your-render-function-url>`). You will need this URL to configure your cloud run service that calls the cloud function you just deployed.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
### Deploy Render Orchestrator Cloud Run Service
|
|
86
|
-
|
|
87
|
-
To deploy the service that orchestrates the cloud functions, navigate to `/render-orchestrator`, then run `npm install` and the following command:
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
gcloud run deploy render-orchestrator \
|
|
91
|
-
--source . \
|
|
92
|
-
--memory 8Gi \
|
|
93
|
-
--cpu 4 \
|
|
94
|
-
--allow-unauthenticated \
|
|
95
|
-
--concurrency=1 \
|
|
96
|
-
--timeout=3600s \
|
|
97
|
-
--region <your-region> \
|
|
98
|
-
--set-env-vars=FFMPEG_PATH=ffmpeg,FFPROBE_PATH=ffprobe,GCP_BUCKET_NAME=<your-bucket-name>,RENDER_WORKER_URL=<your-render-function-url>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Again, you'll have to wait a bit for the service to be deployed. Once that is done, you can send a request to its url `<your-render-orchestrator-url>`.
|
|
102
|
-
|
|
103
|
-
### Sending a Request
|
|
104
|
-
|
|
105
|
-
Once the render worker and orchestrator are running, you can send a render request as follows:
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
curl -X POST <your-render-orchestrator-url>/render \
|
|
109
|
-
-H "Content-Type: application/json" \
|
|
110
|
-
-d '{"variables": {"username": "John"}, "numWorkers": 5}'
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
This will distribute the rendering work across five cloud functions. You can check out the logs and rendering progress in the Google Cloud Function logs.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
## Usage Notes
|
|
117
|
-
|
|
118
|
-
Some useful information, as well as considerations on what parameters to use:
|
|
119
|
-
|
|
120
|
-
**Cold Start times:**
|
|
121
|
-
Depending on your previous usage, your Google Cloud account & project might not be prioritized for cold start times, and thus the bottleneck of your render speeds might be cold start tiems. You can check the logs of your render worker function to see how fast the render workers spin up after sending the request. For example, we have noticed that after creating a new Google Cloud project, we sometimes had to wait for 30s+ for a render worker to spin up, whereas cold start times were very fast on a project that we had been using for a lot of time already.
|
|
122
|
-
|
|
123
|
-
**Video Duration:**
|
|
124
|
-
Parallel rendering is especially effective for longer videos (>1 min). For short videos, the overhead of waiting for a bunch of cloud functions to cold boot may not be worth it
|
|
125
|
-
|
|
126
|
-
**Choosing the number of workers:**
|
|
127
|
-
Depending on the length of the video you're going to render, you might want to adjust the `numWorkers` parameter. A single worker should not render less than a second of video
|