@revideo/create 0.3.5-yellow.968 → 0.3.5
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 +39 -0
- package/examples/avatar-with-background/package-lock.json +3162 -0
- package/examples/avatar-with-background/package.json +26 -0
- package/examples/avatar-with-background/src/project.meta +31 -0
- package/examples/avatar-with-background/src/project.ts +6 -0
- package/examples/avatar-with-background/src/render.ts +36 -0
- package/examples/avatar-with-background/src/revideo.d.ts +1 -0
- package/examples/avatar-with-background/src/scenes/example.tsx +28 -0
- package/examples/avatar-with-background/tsconfig.json +9 -0
- package/examples/avatar-with-background/vite.config.ts +8 -0
- package/examples/default/package.json +24 -0
- package/examples/default/src/project.meta +31 -0
- package/examples/default/src/project.ts +7 -0
- package/examples/default/src/render.ts +17 -0
- package/examples/default/src/revideo.d.ts +1 -0
- package/examples/default/src/scenes/example.tsx +38 -0
- package/examples/default/tsconfig.json +9 -0
- package/examples/google-cloud-run/Dockerfile +56 -0
- package/examples/google-cloud-run/README.md +35 -0
- package/examples/google-cloud-run/package-lock.json +3862 -0
- package/examples/google-cloud-run/package.json +28 -0
- package/examples/google-cloud-run/src/index.ts +39 -0
- package/examples/google-cloud-run/src/project.meta +31 -0
- package/examples/google-cloud-run/src/project.ts +7 -0
- package/examples/google-cloud-run/src/revideo.d.ts +1 -0
- package/examples/google-cloud-run/src/scenes/example.meta +5 -0
- package/examples/google-cloud-run/src/scenes/example.tsx +30 -0
- package/examples/google-cloud-run/tsconfig.json +9 -0
- package/examples/google-cloud-run/vite.config.ts +9 -0
- package/examples/google-cloud-run-parallelized/README.md +127 -0
- package/examples/google-cloud-run-parallelized/render-orchestrator/Dockerfile +56 -0
- package/examples/google-cloud-run-parallelized/render-orchestrator/package-lock.json +2588 -0
- package/examples/google-cloud-run-parallelized/render-orchestrator/package.json +22 -0
- package/examples/google-cloud-run-parallelized/render-orchestrator/src/index.ts +72 -0
- package/examples/google-cloud-run-parallelized/render-orchestrator/src/revideo.d.ts +1 -0
- package/examples/google-cloud-run-parallelized/render-orchestrator/tsconfig.json +10 -0
- package/examples/google-cloud-run-parallelized/render-worker/.gcloudignore +17 -0
- package/examples/google-cloud-run-parallelized/render-worker/.puppeteerrc.cjs +9 -0
- package/examples/google-cloud-run-parallelized/render-worker/package-lock.json +4871 -0
- package/examples/google-cloud-run-parallelized/render-worker/package.json +30 -0
- package/examples/google-cloud-run-parallelized/render-worker/src/index.ts +39 -0
- package/examples/google-cloud-run-parallelized/render-worker/src/project.ts +6 -0
- package/examples/google-cloud-run-parallelized/render-worker/src/revideo.d.ts +1 -0
- package/examples/google-cloud-run-parallelized/render-worker/src/scenes/example.tsx +30 -0
- package/examples/google-cloud-run-parallelized/render-worker/tsconfig.json +13 -0
- package/examples/google-cloud-run-parallelized/render-worker/vite.config.ts +9 -0
- package/examples/logo.svg +6 -0
- package/examples/logo_dark.svg +6 -0
- package/examples/marketing-templates/README.md +10 -0
- package/examples/marketing-templates/marketing-template/package-lock.json +3824 -0
- package/examples/marketing-templates/marketing-template/package.json +24 -0
- package/examples/marketing-templates/marketing-template/src/globals.css +0 -0
- package/examples/marketing-templates/marketing-template/src/project.meta +31 -0
- package/examples/marketing-templates/marketing-template/src/project.ts +9 -0
- package/examples/marketing-templates/marketing-template/src/render.ts +17 -0
- package/examples/marketing-templates/marketing-template/src/revideo.d.ts +1 -0
- package/examples/marketing-templates/marketing-template/src/scenes/example.meta +5 -0
- package/examples/marketing-templates/marketing-template/src/scenes/example.tsx +67 -0
- package/examples/marketing-templates/marketing-template/tsconfig.json +9 -0
- package/examples/marketing-templates/marketing-template/vite.config.ts +9 -0
- package/examples/marketing-templates/multiple-videos-in-one/package-lock.json +3824 -0
- package/examples/marketing-templates/multiple-videos-in-one/package.json +24 -0
- package/examples/marketing-templates/multiple-videos-in-one/src/project.meta +31 -0
- package/examples/marketing-templates/multiple-videos-in-one/src/project.ts +9 -0
- package/examples/marketing-templates/multiple-videos-in-one/src/render.ts +17 -0
- package/examples/marketing-templates/multiple-videos-in-one/src/revideo.d.ts +1 -0
- package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.meta +5 -0
- package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.tsx +122 -0
- package/examples/marketing-templates/multiple-videos-in-one/tsconfig.json +9 -0
- package/examples/marketing-templates/multiple-videos-in-one/vite.config.ts +9 -0
- package/examples/saas-template/.prettierrc +9 -0
- package/examples/saas-template/README.md +28 -0
- package/examples/saas-template/next/app/actions.tsx +113 -0
- package/examples/saas-template/next/app/api/render/route.ts +22 -0
- package/examples/saas-template/next/app/globals.css +3 -0
- package/examples/saas-template/next/app/layout.tsx +25 -0
- package/examples/saas-template/next/app/page.tsx +182 -0
- package/examples/saas-template/next/next.config.mjs +4 -0
- package/examples/saas-template/next/package.json +34 -0
- package/examples/saas-template/next/postcss.config.js +6 -0
- package/examples/saas-template/next/public/favicon.ico +0 -0
- package/examples/saas-template/next/public/next.svg +1 -0
- package/examples/saas-template/next/public/vercel.svg +1 -0
- package/examples/saas-template/next/tailwind.config.ts +30 -0
- package/examples/saas-template/next/tsconfig.json +26 -0
- package/examples/saas-template/next/utils/parse.ts +35 -0
- package/examples/saas-template/revideo/package.json +24 -0
- package/examples/saas-template/revideo/src/global.css +1 -0
- package/examples/saas-template/revideo/src/project.meta +31 -0
- package/examples/saas-template/revideo/src/project.ts +9 -0
- package/examples/saas-template/revideo/src/render.ts +14 -0
- package/examples/saas-template/revideo/src/revideo.d.ts +1 -0
- package/examples/saas-template/revideo/src/scenes/example.meta +5 -0
- package/examples/saas-template/revideo/src/scenes/example.tsx +178 -0
- package/examples/saas-template/revideo/tsconfig.json +9 -0
- package/examples/saas-template/revideo/vite.config.ts +6 -0
- package/examples/stitching-videos/README.md +7 -0
- package/examples/stitching-videos/package-lock.json +2801 -0
- package/examples/stitching-videos/package.json +23 -0
- package/examples/stitching-videos/src/project.meta +31 -0
- package/examples/stitching-videos/src/project.ts +26 -0
- package/examples/stitching-videos/src/render.ts +58 -0
- package/examples/stitching-videos/src/revideo.d.ts +1 -0
- package/examples/stitching-videos/src/scenes/example.tsx +30 -0
- package/examples/stitching-videos/tsconfig.json +9 -0
- package/examples/stitching-videos/vite.config.ts +8 -0
- package/examples/youtube-shorts/README.md +65 -0
- package/examples/youtube-shorts/package-lock.json +3914 -0
- package/examples/youtube-shorts/package.json +30 -0
- package/examples/youtube-shorts/src/global.css +3 -0
- package/examples/youtube-shorts/src/metadata.json +635 -0
- package/examples/youtube-shorts/src/project.meta +31 -0
- package/examples/youtube-shorts/src/project.ts +9 -0
- package/examples/youtube-shorts/src/render.ts +40 -0
- package/examples/youtube-shorts/src/revideo.d.ts +1 -0
- package/examples/youtube-shorts/src/scenes/example.tsx +211 -0
- package/examples/youtube-shorts/src/utils.ts +123 -0
- package/examples/youtube-shorts/tsconfig.json +9 -0
- package/examples/youtube-shorts/vite.config.ts +8 -0
- package/index.js +33 -11
- package/package.json +9 -8
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "google-cloud-run",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "tsc && node dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@google-cloud/storage": "^7.11.0",
|
|
10
|
+
"@revideo/2d": "0.3.4",
|
|
11
|
+
"@revideo/core": "0.3.4",
|
|
12
|
+
"@revideo/ffmpeg": "0.3.4",
|
|
13
|
+
"express": "^4.19.2",
|
|
14
|
+
"uuid": "^9.0.1"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/express": "^4.17.21",
|
|
18
|
+
"@types/uuid": "^9.0.8",
|
|
19
|
+
"typescript": "^5.4.5",
|
|
20
|
+
"vite": "^4.5"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { mergeAudioWithVideo, concatenateMedia } from '@revideo/ffmpeg';
|
|
2
|
+
import { Storage } from '@google-cloud/storage';
|
|
3
|
+
import * as express from 'express';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import axios from 'axios';
|
|
6
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
7
|
+
|
|
8
|
+
const storage = new Storage();
|
|
9
|
+
|
|
10
|
+
const app = express();
|
|
11
|
+
app.use(express.json());
|
|
12
|
+
|
|
13
|
+
app.get('/', (req, res) => {
|
|
14
|
+
res.status(200).send(`Hello World!`);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
app.post('/render', async (req, res) => {
|
|
18
|
+
try {
|
|
19
|
+
const { variables, numWorkers } = req.body;
|
|
20
|
+
const jobId = uuidv4();
|
|
21
|
+
|
|
22
|
+
const renderPromises = [];
|
|
23
|
+
for (let i = 0; i < numWorkers; i++) {
|
|
24
|
+
renderPromises.push(makeRenderRequest(variables, i, numWorkers));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const results = await Promise.all(renderPromises);
|
|
28
|
+
const audios = results.map(result => result.audioUrl);
|
|
29
|
+
const videos = results.map(result => result.videoUrl);
|
|
30
|
+
|
|
31
|
+
await Promise.all([
|
|
32
|
+
concatenateMedia(audios, `${jobId}-audio.wav`),
|
|
33
|
+
concatenateMedia(videos, `${jobId}-visuals.mp4`)
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
await mergeAudioWithVideo(`${jobId}-audio.wav`, `${jobId}-visuals.mp4`, `${jobId}.mp4`);
|
|
37
|
+
|
|
38
|
+
const resultFileBuffer = fs.readFileSync(`${jobId}.mp4`);
|
|
39
|
+
await storage.bucket(process.env.GCP_BUCKET_NAME).file(`${jobId}.mp4`).save(resultFileBuffer);
|
|
40
|
+
|
|
41
|
+
res.status(200).json({
|
|
42
|
+
file: `https://storage.googleapis.com/${process.env.GCP_BUCKET_NAME}/${`${jobId}.mp4`}`
|
|
43
|
+
});
|
|
44
|
+
} catch (err) {
|
|
45
|
+
console.error('Error rendering video:', err);
|
|
46
|
+
res.status(500).send(`Error rendering video: ${err}`);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const port = parseInt(process.env.PORT) || 8080;
|
|
51
|
+
app.listen(port, () => {
|
|
52
|
+
console.log(`listening on port ${port}`);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
async function makeRenderRequest(variables: any, workerId: number, numWorkers: number) {
|
|
56
|
+
try {
|
|
57
|
+
const response = await axios.post(`${process.env.RENDER_WORKER_URL}`, {
|
|
58
|
+
variables,
|
|
59
|
+
workerId,
|
|
60
|
+
numWorkers
|
|
61
|
+
}, {
|
|
62
|
+
headers: {
|
|
63
|
+
'Content-Type': 'application/json'
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return response.data;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error('Error making render request:', error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="@revideo/core/project" />
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# This file specifies files that are *not* uploaded to Google Cloud
|
|
2
|
+
# using gcloud. It follows the same syntax as .gitignore, with the addition of
|
|
3
|
+
# "#!include" directives (which insert the entries of the given .gitignore-style
|
|
4
|
+
# file at that point).
|
|
5
|
+
#
|
|
6
|
+
# For more information, run:
|
|
7
|
+
# $ gcloud topic gcloudignore
|
|
8
|
+
#
|
|
9
|
+
.gcloudignore
|
|
10
|
+
# If you would like to upload your .git directory, .gitignore file or files
|
|
11
|
+
# from your .gitignore file, remove the corresponding line
|
|
12
|
+
# below:
|
|
13
|
+
.git
|
|
14
|
+
.gitignore
|
|
15
|
+
|
|
16
|
+
node_modules
|
|
17
|
+
#!include:.gitignore
|