@revideo/create 0.4.1-cat.995 → 0.4.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.
Files changed (118) hide show
  1. package/examples/README.md +39 -0
  2. package/examples/avatar-with-background/package-lock.json +3162 -0
  3. package/examples/avatar-with-background/package.json +26 -0
  4. package/examples/avatar-with-background/src/project.meta +31 -0
  5. package/examples/avatar-with-background/src/project.ts +6 -0
  6. package/examples/avatar-with-background/src/render.ts +36 -0
  7. package/examples/avatar-with-background/src/revideo.d.ts +1 -0
  8. package/examples/avatar-with-background/src/scenes/example.tsx +28 -0
  9. package/examples/avatar-with-background/tsconfig.json +9 -0
  10. package/examples/avatar-with-background/vite.config.ts +8 -0
  11. package/examples/default/package.json +24 -0
  12. package/examples/default/src/project.meta +31 -0
  13. package/examples/default/src/project.ts +7 -0
  14. package/examples/default/src/render.ts +16 -0
  15. package/examples/default/src/revideo.d.ts +1 -0
  16. package/examples/default/src/scenes/example.tsx +38 -0
  17. package/examples/default/tsconfig.json +9 -0
  18. package/examples/default/vite.config.ts +8 -0
  19. package/examples/google-cloud-run/Dockerfile +56 -0
  20. package/examples/google-cloud-run/README.md +35 -0
  21. package/examples/google-cloud-run/package.json +28 -0
  22. package/examples/google-cloud-run/src/index.ts +39 -0
  23. package/examples/google-cloud-run/src/project.meta +31 -0
  24. package/examples/google-cloud-run/src/project.ts +7 -0
  25. package/examples/google-cloud-run/src/revideo.d.ts +1 -0
  26. package/examples/google-cloud-run/src/scenes/example.meta +5 -0
  27. package/examples/google-cloud-run/src/scenes/example.tsx +30 -0
  28. package/examples/google-cloud-run/tsconfig.json +9 -0
  29. package/examples/google-cloud-run/vite.config.ts +9 -0
  30. package/examples/google-cloud-run-parallelized/README.md +127 -0
  31. package/examples/google-cloud-run-parallelized/render-orchestrator/Dockerfile +56 -0
  32. package/examples/google-cloud-run-parallelized/render-orchestrator/package.json +22 -0
  33. package/examples/google-cloud-run-parallelized/render-orchestrator/src/index.ts +72 -0
  34. package/examples/google-cloud-run-parallelized/render-orchestrator/src/revideo.d.ts +1 -0
  35. package/examples/google-cloud-run-parallelized/render-orchestrator/tsconfig.json +10 -0
  36. package/examples/google-cloud-run-parallelized/render-worker/.gcloudignore +17 -0
  37. package/examples/google-cloud-run-parallelized/render-worker/.puppeteerrc.cjs +9 -0
  38. package/examples/google-cloud-run-parallelized/render-worker/package.json +30 -0
  39. package/examples/google-cloud-run-parallelized/render-worker/src/index.ts +39 -0
  40. package/examples/google-cloud-run-parallelized/render-worker/src/project.ts +6 -0
  41. package/examples/google-cloud-run-parallelized/render-worker/src/revideo.d.ts +1 -0
  42. package/examples/google-cloud-run-parallelized/render-worker/src/scenes/example.tsx +30 -0
  43. package/examples/google-cloud-run-parallelized/render-worker/tsconfig.json +13 -0
  44. package/examples/google-cloud-run-parallelized/render-worker/vite.config.ts +9 -0
  45. package/examples/logo.svg +6 -0
  46. package/examples/logo_dark.svg +6 -0
  47. package/examples/marketing-templates/README.md +10 -0
  48. package/examples/marketing-templates/marketing-template/package-lock.json +3824 -0
  49. package/examples/marketing-templates/marketing-template/package.json +24 -0
  50. package/examples/marketing-templates/marketing-template/src/globals.css +0 -0
  51. package/examples/marketing-templates/marketing-template/src/project.meta +31 -0
  52. package/examples/marketing-templates/marketing-template/src/project.ts +9 -0
  53. package/examples/marketing-templates/marketing-template/src/render.ts +17 -0
  54. package/examples/marketing-templates/marketing-template/src/revideo.d.ts +1 -0
  55. package/examples/marketing-templates/marketing-template/src/scenes/example.meta +5 -0
  56. package/examples/marketing-templates/marketing-template/src/scenes/example.tsx +67 -0
  57. package/examples/marketing-templates/marketing-template/tsconfig.json +9 -0
  58. package/examples/marketing-templates/marketing-template/vite.config.ts +9 -0
  59. package/examples/marketing-templates/multiple-videos-in-one/package-lock.json +3824 -0
  60. package/examples/marketing-templates/multiple-videos-in-one/package.json +24 -0
  61. package/examples/marketing-templates/multiple-videos-in-one/src/project.meta +31 -0
  62. package/examples/marketing-templates/multiple-videos-in-one/src/project.ts +9 -0
  63. package/examples/marketing-templates/multiple-videos-in-one/src/render.ts +17 -0
  64. package/examples/marketing-templates/multiple-videos-in-one/src/revideo.d.ts +1 -0
  65. package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.meta +5 -0
  66. package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.tsx +122 -0
  67. package/examples/marketing-templates/multiple-videos-in-one/tsconfig.json +9 -0
  68. package/examples/marketing-templates/multiple-videos-in-one/vite.config.ts +9 -0
  69. package/examples/saas-template/.prettierrc +9 -0
  70. package/examples/saas-template/README.md +28 -0
  71. package/examples/saas-template/next/app/actions.tsx +113 -0
  72. package/examples/saas-template/next/app/api/render/route.ts +22 -0
  73. package/examples/saas-template/next/app/globals.css +3 -0
  74. package/examples/saas-template/next/app/layout.tsx +25 -0
  75. package/examples/saas-template/next/app/page.tsx +182 -0
  76. package/examples/saas-template/next/next.config.mjs +4 -0
  77. package/examples/saas-template/next/package.json +34 -0
  78. package/examples/saas-template/next/postcss.config.js +6 -0
  79. package/examples/saas-template/next/public/favicon.ico +0 -0
  80. package/examples/saas-template/next/public/next.svg +1 -0
  81. package/examples/saas-template/next/public/vercel.svg +1 -0
  82. package/examples/saas-template/next/tailwind.config.ts +30 -0
  83. package/examples/saas-template/next/tsconfig.json +26 -0
  84. package/examples/saas-template/next/utils/parse.ts +35 -0
  85. package/examples/saas-template/revideo/package.json +24 -0
  86. package/examples/saas-template/revideo/src/global.css +1 -0
  87. package/examples/saas-template/revideo/src/project.meta +31 -0
  88. package/examples/saas-template/revideo/src/project.ts +9 -0
  89. package/examples/saas-template/revideo/src/render.ts +15 -0
  90. package/examples/saas-template/revideo/src/revideo.d.ts +1 -0
  91. package/examples/saas-template/revideo/src/scenes/example.meta +5 -0
  92. package/examples/saas-template/revideo/src/scenes/example.tsx +178 -0
  93. package/examples/saas-template/revideo/tsconfig.json +9 -0
  94. package/examples/saas-template/revideo/vite.config.ts +6 -0
  95. package/examples/stitching-videos/README.md +7 -0
  96. package/examples/stitching-videos/package-lock.json +2801 -0
  97. package/examples/stitching-videos/package.json +23 -0
  98. package/examples/stitching-videos/src/project.meta +31 -0
  99. package/examples/stitching-videos/src/project.ts +26 -0
  100. package/examples/stitching-videos/src/render.ts +58 -0
  101. package/examples/stitching-videos/src/revideo.d.ts +1 -0
  102. package/examples/stitching-videos/src/scenes/example.tsx +30 -0
  103. package/examples/stitching-videos/tsconfig.json +9 -0
  104. package/examples/stitching-videos/vite.config.ts +8 -0
  105. package/examples/youtube-shorts/README.md +65 -0
  106. package/examples/youtube-shorts/package-lock.json +3914 -0
  107. package/examples/youtube-shorts/package.json +30 -0
  108. package/examples/youtube-shorts/src/global.css +3 -0
  109. package/examples/youtube-shorts/src/metadata.json +635 -0
  110. package/examples/youtube-shorts/src/project.meta +31 -0
  111. package/examples/youtube-shorts/src/project.ts +9 -0
  112. package/examples/youtube-shorts/src/render.ts +40 -0
  113. package/examples/youtube-shorts/src/revideo.d.ts +1 -0
  114. package/examples/youtube-shorts/src/scenes/example.tsx +211 -0
  115. package/examples/youtube-shorts/src/utils.ts +123 -0
  116. package/examples/youtube-shorts/tsconfig.json +9 -0
  117. package/examples/youtube-shorts/vite.config.ts +8 -0
  118. package/package.json +9 -9
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "stitching-videos",
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/core": "0.3.1",
13
+ "@revideo/2d": "0.3.1",
14
+ "@revideo/renderer": "0.3.1",
15
+ "@revideo/vite-plugin": "0.3.1",
16
+ "@revideo/ffmpeg": "0.3.1"
17
+ },
18
+ "devDependencies": {
19
+ "@revideo/ui": "0.3.1",
20
+ "typescript": "^5.2.2",
21
+ "vite": "^4.5"
22
+ }
23
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "version": 0,
3
+ "shared": {
4
+ "background": "rgb(0,0,0)",
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,26 @@
1
+ import {makeProject} from '@revideo/core';
2
+
3
+ import example from './scenes/example?scene';
4
+
5
+ export default makeProject({
6
+ scenes: [example],
7
+ variables: {
8
+ videos: [
9
+ {
10
+ src: "https://revideo-example-assets.s3.amazonaws.com/beach-3.mp4",
11
+ start: 1,
12
+ duration: 6
13
+ },
14
+ {
15
+ src: "https://revideo-example-assets.s3.amazonaws.com/beach-2.mp4",
16
+ start: 2,
17
+ duration: 10
18
+ },
19
+ {
20
+ src: "https://revideo-example-assets.s3.amazonaws.com/beach-1.mp4",
21
+ start: 1,
22
+ duration: 7
23
+ }
24
+ ]
25
+ }
26
+ });
@@ -0,0 +1,58 @@
1
+ import {renderVideo} from '@revideo/renderer';
2
+
3
+ const progressTracker = new Map<number, number>();
4
+
5
+ function trackProgress(id: number, progress: number) {
6
+ progressTracker.set(id, progress);
7
+ }
8
+
9
+ function printProgress() {
10
+ let line = '';
11
+ for (const [key, value] of progressTracker.entries()) {
12
+ line += `${key}: ${(value * 100).toFixed(0)}% `;
13
+ }
14
+
15
+ if (line === '') {
16
+ return;
17
+ }
18
+
19
+ console.log(line);
20
+ }
21
+
22
+ async function render() {
23
+ console.log('Rendering video...');
24
+
25
+ const interval = setInterval(() => {
26
+ printProgress();
27
+ }, 1000);
28
+
29
+ // This is the main function that renders the video
30
+ const file = await renderVideo(
31
+ './vite.config.ts',
32
+ {
33
+ videos: [
34
+ {
35
+ src: "https://revideo-example-assets.s3.amazonaws.com/beach-3.mp4",
36
+ start: 2,
37
+ duration: 5
38
+ },
39
+ {
40
+ src: "https://revideo-example-assets.s3.amazonaws.com/beach-2.mp4",
41
+ start: 1,
42
+ duration: 4
43
+ },
44
+ {
45
+ src: "https://revideo-example-assets.s3.amazonaws.com/beach-1.mp4",
46
+ start: 3,
47
+ duration: 3
48
+ }
49
+ ]},
50
+ trackProgress,
51
+ );
52
+
53
+ clearInterval(interval);
54
+
55
+ console.log(`Rendered video to ${file}`);
56
+ }
57
+
58
+ render();
@@ -0,0 +1 @@
1
+ /// <reference types="@revideo/core/project" />
@@ -0,0 +1,30 @@
1
+ import { makeScene2D, Video } from '@revideo/2d';
2
+ import {createRef, waitFor, useScene} from '@revideo/core';
3
+
4
+ interface VideoObject {
5
+ src: string;
6
+ start: number;
7
+ duration: number;
8
+ }
9
+
10
+ export default makeScene2D(function* (view) {
11
+ const videos: VideoObject[] = useScene().variables.get('videos', [])();
12
+
13
+ for(const vid of videos){
14
+ const videoRef = createRef<Video>();
15
+ yield view.add(<Video src={vid.src} time={vid.start} play={true} opacity={0} ref={videoRef} />)
16
+
17
+ if(view.width() / view.height() > videoRef().width() / videoRef().height()){
18
+ videoRef().width("100%");
19
+ } else {
20
+ videoRef().height("100%");
21
+ }
22
+
23
+ // this is a fade-out / fade-in transition - the fade-out and in take 0.3 seconds each; just set the opacity of the video tag to 1 and only use yield* waitFor(vid.duration);
24
+ yield* videoRef().opacity(1,0.3);
25
+ yield* waitFor(vid.duration-0.6);
26
+ yield* videoRef().opacity(0,0.3);
27
+ videoRef().pause();
28
+ videoRef().remove();
29
+ }
30
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@revideo/2d/tsconfig.project.json",
3
+ "include": ["src"],
4
+ "compilerOptions": {
5
+ "noEmit": false,
6
+ "outDir": "dist",
7
+ "module": "CommonJS"
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ import {defineConfig} from 'vite';
2
+ import motionCanvas from '@revideo/vite-plugin';
3
+
4
+ export default defineConfig({
5
+ plugins: [
6
+ motionCanvas(),
7
+ ],
8
+ });
@@ -0,0 +1,65 @@
1
+ # Youtube Shorts with Subtitles
2
+
3
+ This example project lets you generate Youtube Shorts with AI.
4
+
5
+ https://github.com/redotvideo/revideo-examples/assets/122226645/98bc202d-6b7d-4b8a-9a7f-c41533d8c760
6
+
7
+
8
+ ## Project Structure
9
+
10
+ There are two main files you should look at in this project:
11
+
12
+ - `src/scenes/example.tsx`: This file defines the flow of the video and its animations. It accepts variables such as a list of background images, a voiceover audio file, as well as a list of words along with their timestamps to display the video captions.
13
+ - `src/render.ts`: This is a node.js process which generates assets (script, voiceover, etc.) using AI services and consequently calls `renderVideo()` to export a video that uses the assets it generated as an input.
14
+
15
+
16
+ ## Getting Started
17
+
18
+ After cloning the repo, go inside the project folder and install all dependencies using `npm install`. Now you can preview an example video.
19
+
20
+ ### Preview Video
21
+
22
+ You can start the editor using the following command:
23
+
24
+ ```
25
+ npm start
26
+ ```
27
+
28
+ 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.
29
+
30
+ 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. This will not be a problem when exporting the video though - when building a web app, this can also easily be avoided by preloading the assets (see our [docs](https://docs.re.video/preview-with-player/#preloading-assets) for info on this).
31
+
32
+
33
+ ## Rendering your own Videos
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 `npm run render`, which will execute `src/render.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
+ ```