@revideo/create 0.5.10-alpha.1094 → 0.5.10
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 +8 -8
- package/examples/avatar-with-background/src/scenes/example.tsx +1 -0
- package/examples/default/package.json +8 -8
- package/examples/github-stars-celebration/package.json +7 -7
- package/examples/github-stars-celebration/src/scenes/example.tsx +2 -2
- package/examples/google-cloud-run-parallelized/render-orchestrator/package.json +21 -21
- package/examples/google-cloud-run-parallelized/render-worker/package.json +8 -8
- package/examples/marketing-templates/marketing-template/package.json +7 -7
- package/examples/marketing-templates/multiple-videos-in-one/package.json +7 -7
- package/examples/minimal-drag-drop/README.md +27 -0
- package/examples/minimal-drag-drop/next/app/api/render/route.ts +22 -0
- package/examples/minimal-drag-drop/next/app/globals.css +3 -0
- package/examples/minimal-drag-drop/next/app/layout.tsx +25 -0
- package/examples/minimal-drag-drop/next/app/page.tsx +277 -0
- package/examples/minimal-drag-drop/next/next-env.d.ts +5 -0
- package/examples/minimal-drag-drop/next/next.config.mjs +4 -0
- package/examples/minimal-drag-drop/next/package-lock.json +5577 -0
- package/examples/minimal-drag-drop/next/package.json +35 -0
- package/examples/minimal-drag-drop/next/postcss.config.js +6 -0
- package/examples/minimal-drag-drop/next/public/favicon.ico +0 -0
- package/examples/minimal-drag-drop/next/public/next.svg +1 -0
- package/examples/minimal-drag-drop/next/public/vercel.svg +1 -0
- package/examples/minimal-drag-drop/next/tailwind.config.ts +30 -0
- package/examples/minimal-drag-drop/next/tsconfig.json +26 -0
- package/examples/minimal-drag-drop/next/utils/parse.ts +35 -0
- package/examples/minimal-drag-drop/revideo/package-lock.json +3771 -0
- package/examples/minimal-drag-drop/revideo/package.json +24 -0
- package/examples/minimal-drag-drop/revideo/src/global.css +1 -0
- package/examples/minimal-drag-drop/revideo/src/project.meta +28 -0
- package/examples/minimal-drag-drop/revideo/src/project.ts +9 -0
- package/examples/minimal-drag-drop/revideo/src/render.ts +15 -0
- package/examples/minimal-drag-drop/revideo/src/revideo.d.ts +1 -0
- package/examples/minimal-drag-drop/revideo/src/scenes/example.meta +5 -0
- package/examples/minimal-drag-drop/revideo/src/scenes/example.tsx +44 -0
- package/examples/minimal-drag-drop/revideo/tsconfig.json +9 -0
- package/examples/minimal-drag-drop/revideo/vite.config.ts +6 -0
- package/examples/parallelized-aws-lambda/revideo-project/package.json +8 -11
- package/examples/parallelized-aws-lambda/revideo-project/src/lambda.ts +15 -2
- package/examples/parallelized-aws-lambda/revideo-project/src/render.ts +2 -1
- package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.tsx +1 -0
- package/examples/reddit-post-video/package.json +7 -7
- package/examples/reddit-post-video/src/project.meta +2 -2
- package/examples/rive-explanation-video/package.json +8 -8
- package/examples/saas-template/next/package.json +33 -33
- package/examples/saas-template/revideo/package.json +23 -23
- package/examples/stitching-videos/package.json +6 -6
- package/examples/stitching-videos/src/render.ts +2 -1
- package/examples/three-js-example/package-lock.json +41 -41
- package/examples/three-js-example/package.json +7 -7
- package/examples/youtube-shorts/README.md +7 -7
- package/examples/youtube-shorts/package-lock.json +332 -365
- package/examples/youtube-shorts/package.json +8 -8
- package/examples/youtube-shorts/src/get-assets.ts +34 -0
- package/examples/youtube-shorts/src/render.ts +4 -35
- package/examples/youtube-shorts/src/scenes/example.tsx +25 -12
- package/index.js +8 -1
- package/package.json +9 -9
- package/examples/avatar-with-background/package-lock.json +0 -3223
- package/examples/marketing-templates/marketing-template/package-lock.json +0 -3824
- package/examples/marketing-templates/multiple-videos-in-one/package-lock.json +0 -3824
- package/examples/rive-explanation-video/package-lock.json +0 -3706
- package/examples/stitching-videos/package-lock.json +0 -2801
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@deepgram/sdk": "^3.3.1",
|
|
13
|
-
"@revideo/2d": "0.5.
|
|
14
|
-
"@revideo/cli": "0.5.
|
|
15
|
-
"@revideo/core": "0.5.
|
|
16
|
-
"@revideo/ffmpeg": "0.5.
|
|
17
|
-
"@revideo/renderer": "0.5.
|
|
18
|
-
"@revideo/vite-plugin": "0.5.
|
|
13
|
+
"@revideo/2d": "0.5.10",
|
|
14
|
+
"@revideo/cli": "0.5.10",
|
|
15
|
+
"@revideo/core": "0.5.10",
|
|
16
|
+
"@revideo/ffmpeg": "0.5.10",
|
|
17
|
+
"@revideo/renderer": "0.5.10",
|
|
18
|
+
"@revideo/vite-plugin": "0.5.10",
|
|
19
19
|
"dotenv": "^16.4.5",
|
|
20
20
|
"express": "^4.19.2",
|
|
21
21
|
"openai": "^4.40.2",
|
|
22
22
|
"uuid": "^9.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@revideo/ui": "0.5.
|
|
25
|
+
"@revideo/ui": "0.5.10",
|
|
26
26
|
"@types/uuid": "^9.0.8",
|
|
27
27
|
"typescript": "5.5.4",
|
|
28
28
|
"vite": "^4.5"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require('dotenv').config();
|
|
2
|
+
|
|
3
|
+
import { getVideoScript, generateAudio, getWordTimestamps, dalleGenerate, getImagePromptFromScript } from './utils';
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
|
|
7
|
+
async function createAssets(topic: string, voiceName: string){
|
|
8
|
+
const jobId = uuidv4();
|
|
9
|
+
|
|
10
|
+
console.log("Generating assets...")
|
|
11
|
+
const script = await getVideoScript(topic);
|
|
12
|
+
console.log("script", script);
|
|
13
|
+
|
|
14
|
+
await generateAudio(script, voiceName, `./public/${jobId}-audio.wav`);
|
|
15
|
+
const words = await getWordTimestamps(`./public/${jobId}-audio.wav`);
|
|
16
|
+
|
|
17
|
+
console.log("Generating images...")
|
|
18
|
+
const imagePromises = Array.from({ length: 5 }).map(async (_, index) => {
|
|
19
|
+
const imagePrompt = await getImagePromptFromScript(script);
|
|
20
|
+
await dalleGenerate(imagePrompt, `./public/${jobId}-image-${index}.png`);
|
|
21
|
+
return `/${jobId}-image-${index}.png`;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const imageFileNames = await Promise.all(imagePromises);
|
|
25
|
+
const metadata = {
|
|
26
|
+
audioUrl: `${jobId}-audio.wav`,
|
|
27
|
+
images: imageFileNames,
|
|
28
|
+
words: words
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
await fs.promises.writeFile(`./public/${jobId}-metadata.json`, JSON.stringify(metadata, null, 2));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
createAssets("The moon landing", "Sarah")
|
|
@@ -1,43 +1,12 @@
|
|
|
1
|
-
require('dotenv').config();
|
|
2
|
-
|
|
3
1
|
import {renderVideo} from '@revideo/renderer';
|
|
4
2
|
import metadata from './metadata.json';
|
|
5
|
-
import { getVideoScript, generateAudio, getWordTimestamps, dalleGenerate, getImagePromptFromScript } from './utils';
|
|
6
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
7
|
-
import * as fs from 'fs';
|
|
8
|
-
|
|
9
|
-
async function createVideo(topic: string, voiceName: string){
|
|
10
|
-
const jobId = uuidv4();
|
|
11
|
-
|
|
12
|
-
console.log("Generating assets...")
|
|
13
|
-
const script = await getVideoScript(topic);
|
|
14
|
-
console.log("script", script);
|
|
15
|
-
|
|
16
|
-
await generateAudio(script, voiceName, `./public/${jobId}-audio.wav`);
|
|
17
|
-
const words = await getWordTimestamps(`./public/${jobId}-audio.wav`);
|
|
18
|
-
|
|
19
|
-
console.log("Generating images...")
|
|
20
|
-
const imagePromises = Array.from({ length: 5 }).map(async (_, index) => {
|
|
21
|
-
const imagePrompt = await getImagePromptFromScript(script);
|
|
22
|
-
await dalleGenerate(imagePrompt, `./public/${jobId}-image-${index}.png`);
|
|
23
|
-
return `/${jobId}-image-${index}.png`;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const imageFileNames = await Promise.all(imagePromises);
|
|
27
|
-
const metadata = {
|
|
28
|
-
audioUrl: `${jobId}-audio.wav`,
|
|
29
|
-
images: imageFileNames,
|
|
30
|
-
words: words
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
await fs.promises.writeFile(`./public/${jobId}-metadata.json`, JSON.stringify(metadata, null, 2));
|
|
34
3
|
|
|
35
|
-
|
|
4
|
+
async function render(){
|
|
36
5
|
await renderVideo({
|
|
37
6
|
projectFile: './src/project.ts',
|
|
38
|
-
variables: metadata
|
|
7
|
+
variables: metadata,
|
|
8
|
+
settings: {logProgress: true}
|
|
39
9
|
});
|
|
40
|
-
console.log("Render finished");
|
|
41
10
|
}
|
|
42
11
|
|
|
43
|
-
|
|
12
|
+
render();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Audio, Img, makeScene2D, Txt,
|
|
1
|
+
import {Audio, Img, makeScene2D, Txt, Rect, Layout} from '@revideo/2d';
|
|
2
2
|
import {all, createRef, waitFor, useScene, Reference, createSignal} from '@revideo/core';
|
|
3
3
|
|
|
4
4
|
interface Word {
|
|
@@ -49,8 +49,19 @@ export default makeScene2D(function* (view) {
|
|
|
49
49
|
|
|
50
50
|
const duration = words[words.length-1].end + 0.5;
|
|
51
51
|
|
|
52
|
+
const imageContainer = createRef<Layout>();
|
|
53
|
+
const textContainer = createRef<Layout>();
|
|
54
|
+
|
|
52
55
|
yield view.add(
|
|
53
56
|
<>
|
|
57
|
+
<Layout
|
|
58
|
+
size={"100%"}
|
|
59
|
+
ref={imageContainer}
|
|
60
|
+
/>
|
|
61
|
+
<Layout
|
|
62
|
+
size={"100%"}
|
|
63
|
+
ref={textContainer}
|
|
64
|
+
/>
|
|
54
65
|
<Audio
|
|
55
66
|
src={audioUrl}
|
|
56
67
|
play={true}
|
|
@@ -64,19 +75,19 @@ export default makeScene2D(function* (view) {
|
|
|
64
75
|
);
|
|
65
76
|
|
|
66
77
|
yield* all(
|
|
67
|
-
displayImages(
|
|
78
|
+
displayImages(imageContainer, images, duration),
|
|
68
79
|
displayWords(
|
|
69
|
-
|
|
80
|
+
textContainer,
|
|
70
81
|
words,
|
|
71
82
|
textSettings
|
|
72
83
|
)
|
|
73
84
|
)
|
|
74
85
|
});
|
|
75
86
|
|
|
76
|
-
function* displayImages(
|
|
87
|
+
function* displayImages(container: Reference<Layout>, images: string[], totalDuration: number){
|
|
77
88
|
for(const img of images){
|
|
78
89
|
const ref = createRef<Img>();
|
|
79
|
-
|
|
90
|
+
container().add(<Img
|
|
80
91
|
src={img}
|
|
81
92
|
size={["100%", "100%"]}
|
|
82
93
|
ref={ref}
|
|
@@ -87,7 +98,7 @@ function* displayImages(view: View2D, images: string[], totalDuration: number){
|
|
|
87
98
|
}
|
|
88
99
|
}
|
|
89
100
|
|
|
90
|
-
function* displayWords(
|
|
101
|
+
function* displayWords(container: Reference<Layout>, words: Word[], settings: captionSettings){
|
|
91
102
|
let waitBefore = words[0].start;
|
|
92
103
|
|
|
93
104
|
for (let i = 0; i < words.length; i += settings.numSimultaneousWords) {
|
|
@@ -101,7 +112,7 @@ function* displayWords(view: View2D, words: Word[], settings: captionSettings){
|
|
|
101
112
|
|
|
102
113
|
if(settings.stream){
|
|
103
114
|
let nextWordStart = 0;
|
|
104
|
-
yield
|
|
115
|
+
yield container().add(<Txt width={`${settings.textBoxWidthInPercent}%`} textWrap={true} zIndex={2} textAlign={settings.textAlign} ref={textRef}/>);
|
|
105
116
|
|
|
106
117
|
for(let j = 0; j < currentBatch.length; j++){
|
|
107
118
|
const word = currentBatch[j];
|
|
@@ -130,7 +141,7 @@ function* displayWords(view: View2D, words: Word[], settings: captionSettings){
|
|
|
130
141
|
</Txt>
|
|
131
142
|
);
|
|
132
143
|
textRef().add(<Txt fontSize={settings.fontSize}>{optionalSpace}</Txt>);
|
|
133
|
-
|
|
144
|
+
container().add(<Rect fill={settings.currentWordBackgroundColor} zIndex={1} size={wordRef().size} position={wordRef().position} radius={10} padding={10} ref={backgroundRef} />);
|
|
134
145
|
yield* all(waitFor(word.end-word.start), opacitySignal(1, Math.min((word.end-word.start)*0.5, 0.1)));
|
|
135
146
|
wordRef().fill(settings.textColor);
|
|
136
147
|
backgroundRef().remove();
|
|
@@ -139,7 +150,7 @@ function* displayWords(view: View2D, words: Word[], settings: captionSettings){
|
|
|
139
150
|
textRef().remove();
|
|
140
151
|
|
|
141
152
|
} else {
|
|
142
|
-
yield
|
|
153
|
+
yield container().add(<Txt width={`${settings.textBoxWidthInPercent}%`} textAlign={settings.textAlign} ref={textRef} textWrap={true} zIndex={2}/>);
|
|
143
154
|
|
|
144
155
|
const wordRefs = [];
|
|
145
156
|
const opacitySignal = createSignal(settings.fadeInAnimation ? 0.5 : 1);
|
|
@@ -177,7 +188,7 @@ function* displayWords(view: View2D, words: Word[], settings: captionSettings){
|
|
|
177
188
|
|
|
178
189
|
yield* all(
|
|
179
190
|
opacitySignal(1, Math.min(0.1, (currentBatch[0].end-currentBatch[0].start)*0.5)),
|
|
180
|
-
highlightCurrentWord(
|
|
191
|
+
highlightCurrentWord(container, currentBatch, wordRefs, settings.currentWordColor, settings.currentWordBackgroundColor),
|
|
181
192
|
waitFor(currentBatch[currentBatch.length-1].end - currentBatch[0].start + waitAfter),
|
|
182
193
|
);
|
|
183
194
|
textRef().remove();
|
|
@@ -186,7 +197,7 @@ function* displayWords(view: View2D, words: Word[], settings: captionSettings){
|
|
|
186
197
|
}
|
|
187
198
|
}
|
|
188
199
|
|
|
189
|
-
function* highlightCurrentWord(
|
|
200
|
+
function* highlightCurrentWord(container: Reference<Layout>, currentBatch: Word[], wordRefs: Reference<Txt>[], wordColor: string, backgroundColor: string){
|
|
190
201
|
let nextWordStart = 0;
|
|
191
202
|
|
|
192
203
|
for(let i = 0; i < currentBatch.length; i++){
|
|
@@ -194,14 +205,16 @@ function* highlightCurrentWord(view: View2D, currentBatch: Word[], wordRefs: Ref
|
|
|
194
205
|
const word = currentBatch[i];
|
|
195
206
|
const originalColor = wordRefs[i]().fill();
|
|
196
207
|
nextWordStart = currentBatch[i+1]?.start - word.end || 0;
|
|
208
|
+
wordRefs[i]().text(wordRefs[i]().text());
|
|
197
209
|
wordRefs[i]().fill(wordColor);
|
|
198
210
|
|
|
199
211
|
const backgroundRef = createRef<Rect>();
|
|
200
212
|
if(backgroundColor){
|
|
201
|
-
|
|
213
|
+
container().add(<Rect fill={backgroundColor} zIndex={1} size={wordRefs[i]().size} position={wordRefs[i]().position} radius={10} padding={10} ref={backgroundRef} />);
|
|
202
214
|
}
|
|
203
215
|
|
|
204
216
|
yield* waitFor(word.end-word.start);
|
|
217
|
+
wordRefs[i]().text(wordRefs[i]().text());
|
|
205
218
|
wordRefs[i]().fill(originalColor);
|
|
206
219
|
|
|
207
220
|
if(backgroundColor){
|
package/index.js
CHANGED
|
@@ -47,6 +47,13 @@ const templates = [
|
|
|
47
47
|
description: 'A collection of templates for marketing videos.',
|
|
48
48
|
startcommands: 'readme',
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
value: 'minimal-drag-drop',
|
|
52
|
+
title: 'Drag and Drop Example',
|
|
53
|
+
description:
|
|
54
|
+
'A minimal example of an editor with drag-and-drop editing functionality.',
|
|
55
|
+
startcommands: 'next',
|
|
56
|
+
},
|
|
50
57
|
{
|
|
51
58
|
value: 'parallelized-aws-lambda',
|
|
52
59
|
title: 'Parallelized AWS Lambda',
|
|
@@ -219,7 +226,7 @@ async function run() {
|
|
|
219
226
|
if (selectedTemplate.startcommands === 'default') {
|
|
220
227
|
console.log(installCommand);
|
|
221
228
|
console.log(` ${boldManager} start`);
|
|
222
|
-
} else if (selectedTemplate.
|
|
229
|
+
} else if (selectedTemplate.startcommands === 'next') {
|
|
223
230
|
console.log(kleur.blue('\n√ Start the NextJS server:'));
|
|
224
231
|
console.log(` ${kleur.bold('cd')} next`);
|
|
225
232
|
console.log(installCommand);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revideo/create",
|
|
3
|
-
"version": "0.5.10
|
|
3
|
+
"version": "0.5.10",
|
|
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.5.10",
|
|
24
|
+
"@revideo/core": "0.5.10",
|
|
25
|
+
"@revideo/ffmpeg": "0.5.10",
|
|
26
|
+
"@revideo/renderer": "0.5.10",
|
|
27
|
+
"@revideo/ui": "0.5.10",
|
|
28
|
+
"@revideo/vite-plugin": "0.5.10"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@revideo/telemetry": "
|
|
31
|
+
"@revideo/telemetry": "0.5.10",
|
|
32
32
|
"minimist": "^1.2.8",
|
|
33
33
|
"prompts": "^2.4.2"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "56d48446d0f2dd2146bf594516b880b38a6e36a9"
|
|
36
36
|
}
|