@revideo/create 0.5.8-beta.1082 → 0.5.9-alpha.1086

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 (175) hide show
  1. package/examples/README.md +43 -0
  2. package/examples/avatar-with-background/package-lock.json +3223 -0
  3. package/examples/avatar-with-background/package.json +27 -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 +14 -0
  7. package/examples/avatar-with-background/src/revideo.d.ts +1 -0
  8. package/examples/avatar-with-background/src/scenes/example.meta +5 -0
  9. package/examples/avatar-with-background/src/scenes/example.tsx +27 -0
  10. package/examples/avatar-with-background/tsconfig.json +9 -0
  11. package/examples/avatar-with-background/vite.config.ts +8 -0
  12. package/examples/default/package.json +24 -0
  13. package/examples/default/src/project.meta +31 -0
  14. package/examples/default/src/project.ts +7 -0
  15. package/examples/default/src/render.ts +15 -0
  16. package/examples/default/src/revideo.d.ts +1 -0
  17. package/examples/default/src/scenes/example.tsx +38 -0
  18. package/examples/default/tsconfig.json +9 -0
  19. package/examples/default/vite.config.ts +8 -0
  20. package/examples/github-stars-celebration/package-lock.json +3833 -0
  21. package/examples/github-stars-celebration/package.json +24 -0
  22. package/examples/github-stars-celebration/src/global.css +1 -0
  23. package/examples/github-stars-celebration/src/project.meta +28 -0
  24. package/examples/github-stars-celebration/src/project.ts +8 -0
  25. package/examples/github-stars-celebration/src/render.ts +15 -0
  26. package/examples/github-stars-celebration/src/revideo.d.ts +1 -0
  27. package/examples/github-stars-celebration/src/scenes/example.meta +5 -0
  28. package/examples/github-stars-celebration/src/scenes/example.tsx +51 -0
  29. package/examples/github-stars-celebration/tsconfig.json +9 -0
  30. package/examples/github-stars-celebration/vite.config.ts +8 -0
  31. package/examples/google-cloud-run-parallelized/README.md +127 -0
  32. package/examples/google-cloud-run-parallelized/render-orchestrator/Dockerfile +56 -0
  33. package/examples/google-cloud-run-parallelized/render-orchestrator/package.json +22 -0
  34. package/examples/google-cloud-run-parallelized/render-orchestrator/src/index.ts +72 -0
  35. package/examples/google-cloud-run-parallelized/render-orchestrator/src/revideo.d.ts +1 -0
  36. package/examples/google-cloud-run-parallelized/render-orchestrator/tsconfig.json +10 -0
  37. package/examples/google-cloud-run-parallelized/render-worker/.gcloudignore +17 -0
  38. package/examples/google-cloud-run-parallelized/render-worker/.puppeteerrc.cjs +9 -0
  39. package/examples/google-cloud-run-parallelized/render-worker/package.json +30 -0
  40. package/examples/google-cloud-run-parallelized/render-worker/src/index.ts +45 -0
  41. package/examples/google-cloud-run-parallelized/render-worker/src/project.meta +31 -0
  42. package/examples/google-cloud-run-parallelized/render-worker/src/project.ts +6 -0
  43. package/examples/google-cloud-run-parallelized/render-worker/src/render.ts +14 -0
  44. package/examples/google-cloud-run-parallelized/render-worker/src/revideo.d.ts +1 -0
  45. package/examples/google-cloud-run-parallelized/render-worker/src/scenes/example.tsx +30 -0
  46. package/examples/google-cloud-run-parallelized/render-worker/tsconfig.json +13 -0
  47. package/examples/google-cloud-run-parallelized/render-worker/vite.config.ts +9 -0
  48. package/examples/logo.svg +6 -0
  49. package/examples/logo_dark.svg +6 -0
  50. package/examples/marketing-templates/README.md +10 -0
  51. package/examples/marketing-templates/marketing-template/package-lock.json +3824 -0
  52. package/examples/marketing-templates/marketing-template/package.json +24 -0
  53. package/examples/marketing-templates/marketing-template/src/globals.css +0 -0
  54. package/examples/marketing-templates/marketing-template/src/project.meta +28 -0
  55. package/examples/marketing-templates/marketing-template/src/project.ts +9 -0
  56. package/examples/marketing-templates/marketing-template/src/render.ts +15 -0
  57. package/examples/marketing-templates/marketing-template/src/revideo.d.ts +1 -0
  58. package/examples/marketing-templates/marketing-template/src/scenes/example.meta +5 -0
  59. package/examples/marketing-templates/marketing-template/src/scenes/example.tsx +67 -0
  60. package/examples/marketing-templates/marketing-template/tsconfig.json +9 -0
  61. package/examples/marketing-templates/marketing-template/vite.config.ts +9 -0
  62. package/examples/marketing-templates/multiple-videos-in-one/package-lock.json +3824 -0
  63. package/examples/marketing-templates/multiple-videos-in-one/package.json +24 -0
  64. package/examples/marketing-templates/multiple-videos-in-one/src/project.meta +28 -0
  65. package/examples/marketing-templates/multiple-videos-in-one/src/project.ts +9 -0
  66. package/examples/marketing-templates/multiple-videos-in-one/src/render.ts +15 -0
  67. package/examples/marketing-templates/multiple-videos-in-one/src/revideo.d.ts +1 -0
  68. package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.meta +5 -0
  69. package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.tsx +122 -0
  70. package/examples/marketing-templates/multiple-videos-in-one/tsconfig.json +9 -0
  71. package/examples/marketing-templates/multiple-videos-in-one/vite.config.ts +9 -0
  72. package/examples/parallelized-aws-lambda/.dockerignore +3 -0
  73. package/examples/parallelized-aws-lambda/Dockerfile +21 -0
  74. package/examples/parallelized-aws-lambda/Dockerfile.base +64 -0
  75. package/examples/parallelized-aws-lambda/README.md +197 -0
  76. package/examples/parallelized-aws-lambda/revideo-project/.puppeteerrc.cjs +9 -0
  77. package/examples/parallelized-aws-lambda/revideo-project/package-lock.json +4133 -0
  78. package/examples/parallelized-aws-lambda/revideo-project/package.json +31 -0
  79. package/examples/parallelized-aws-lambda/revideo-project/src/lambda.ts +144 -0
  80. package/examples/parallelized-aws-lambda/revideo-project/src/project.meta +28 -0
  81. package/examples/parallelized-aws-lambda/revideo-project/src/project.ts +7 -0
  82. package/examples/parallelized-aws-lambda/revideo-project/src/render.ts +16 -0
  83. package/examples/parallelized-aws-lambda/revideo-project/src/revideo.d.ts +1 -0
  84. package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.meta +5 -0
  85. package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.tsx +29 -0
  86. package/examples/parallelized-aws-lambda/revideo-project/tsconfig.json +10 -0
  87. package/examples/parallelized-aws-lambda/revideo-project/vite.config.ts +9 -0
  88. package/examples/reddit-post-video/README.md +84 -0
  89. package/examples/reddit-post-video/package-lock.json +2941 -0
  90. package/examples/reddit-post-video/package.json +27 -0
  91. package/examples/reddit-post-video/src/global.css +1 -0
  92. package/examples/reddit-post-video/src/metadata.json +576 -0
  93. package/examples/reddit-post-video/src/project.meta +31 -0
  94. package/examples/reddit-post-video/src/project.ts +9 -0
  95. package/examples/reddit-post-video/src/render.ts +157 -0
  96. package/examples/reddit-post-video/src/revideo.d.ts +1 -0
  97. package/examples/reddit-post-video/src/scenes/example.meta +5 -0
  98. package/examples/reddit-post-video/src/scenes/example.tsx +74 -0
  99. package/examples/reddit-post-video/tsconfig.json +9 -0
  100. package/examples/reddit-post-video/vite.config.ts +6 -0
  101. package/examples/rive-explanation-video/README.md +9 -0
  102. package/examples/rive-explanation-video/package-lock.json +3706 -0
  103. package/examples/rive-explanation-video/package.json +25 -0
  104. package/examples/rive-explanation-video/src/global.css +1 -0
  105. package/examples/rive-explanation-video/src/project.meta +31 -0
  106. package/examples/rive-explanation-video/src/project.ts +8 -0
  107. package/examples/rive-explanation-video/src/render.ts +15 -0
  108. package/examples/rive-explanation-video/src/revideo.d.ts +1 -0
  109. package/examples/rive-explanation-video/src/scenes/example.meta +5 -0
  110. package/examples/rive-explanation-video/src/scenes/example.tsx +218 -0
  111. package/examples/rive-explanation-video/tsconfig.json +9 -0
  112. package/examples/rive-explanation-video/vite.config.ts +8 -0
  113. package/examples/saas-template/.prettierrc +9 -0
  114. package/examples/saas-template/README.md +28 -0
  115. package/examples/saas-template/next/app/actions.tsx +113 -0
  116. package/examples/saas-template/next/app/api/render/route.ts +22 -0
  117. package/examples/saas-template/next/app/globals.css +3 -0
  118. package/examples/saas-template/next/app/layout.tsx +25 -0
  119. package/examples/saas-template/next/app/page.tsx +187 -0
  120. package/examples/saas-template/next/next.config.mjs +4 -0
  121. package/examples/saas-template/next/package.json +34 -0
  122. package/examples/saas-template/next/postcss.config.js +6 -0
  123. package/examples/saas-template/next/public/favicon.ico +0 -0
  124. package/examples/saas-template/next/public/next.svg +1 -0
  125. package/examples/saas-template/next/public/vercel.svg +1 -0
  126. package/examples/saas-template/next/tailwind.config.ts +30 -0
  127. package/examples/saas-template/next/tsconfig.json +26 -0
  128. package/examples/saas-template/next/utils/parse.ts +35 -0
  129. package/examples/saas-template/revideo/package.json +24 -0
  130. package/examples/saas-template/revideo/src/global.css +1 -0
  131. package/examples/saas-template/revideo/src/project.meta +27 -0
  132. package/examples/saas-template/revideo/src/project.ts +9 -0
  133. package/examples/saas-template/revideo/src/render.ts +15 -0
  134. package/examples/saas-template/revideo/src/revideo.d.ts +1 -0
  135. package/examples/saas-template/revideo/src/scenes/example.meta +5 -0
  136. package/examples/saas-template/revideo/src/scenes/example.tsx +178 -0
  137. package/examples/saas-template/revideo/tsconfig.json +9 -0
  138. package/examples/saas-template/revideo/vite.config.ts +6 -0
  139. package/examples/stitching-videos/README.md +7 -0
  140. package/examples/stitching-videos/package-lock.json +2801 -0
  141. package/examples/stitching-videos/package.json +23 -0
  142. package/examples/stitching-videos/src/project.meta +28 -0
  143. package/examples/stitching-videos/src/project.ts +20 -0
  144. package/examples/stitching-videos/src/render.ts +26 -0
  145. package/examples/stitching-videos/src/revideo.d.ts +1 -0
  146. package/examples/stitching-videos/src/scenes/example.tsx +30 -0
  147. package/examples/stitching-videos/tsconfig.json +9 -0
  148. package/examples/stitching-videos/vite.config.ts +8 -0
  149. package/examples/three-js-example/README.md +8 -0
  150. package/examples/three-js-example/package-lock.json +2753 -0
  151. package/examples/three-js-example/package.json +25 -0
  152. package/examples/three-js-example/src/components/Three.ts +166 -0
  153. package/examples/three-js-example/src/global.css +1 -0
  154. package/examples/three-js-example/src/project.meta +31 -0
  155. package/examples/three-js-example/src/project.ts +8 -0
  156. package/examples/three-js-example/src/render.ts +15 -0
  157. package/examples/three-js-example/src/revideo.d.ts +1 -0
  158. package/examples/three-js-example/src/scenes/basic3D.meta +5 -0
  159. package/examples/three-js-example/src/scenes/basic3D.tsx +89 -0
  160. package/examples/three-js-example/tsconfig.json +9 -0
  161. package/examples/three-js-example/vite.config.ts +6 -0
  162. package/examples/youtube-shorts/README.md +65 -0
  163. package/examples/youtube-shorts/package-lock.json +3914 -0
  164. package/examples/youtube-shorts/package.json +30 -0
  165. package/examples/youtube-shorts/src/global.css +3 -0
  166. package/examples/youtube-shorts/src/metadata.json +635 -0
  167. package/examples/youtube-shorts/src/project.meta +28 -0
  168. package/examples/youtube-shorts/src/project.ts +9 -0
  169. package/examples/youtube-shorts/src/render.ts +43 -0
  170. package/examples/youtube-shorts/src/revideo.d.ts +1 -0
  171. package/examples/youtube-shorts/src/scenes/example.tsx +211 -0
  172. package/examples/youtube-shorts/src/utils.ts +123 -0
  173. package/examples/youtube-shorts/tsconfig.json +9 -0
  174. package/examples/youtube-shorts/vite.config.ts +8 -0
  175. package/package.json +9 -9
@@ -0,0 +1,157 @@
1
+ import { createClient } from "@deepgram/sdk";
2
+ import { renderVideo } from "@revideo/renderer";
3
+ import axios from "axios";
4
+ import * as fs from "fs";
5
+ import yargs from "yargs";
6
+ import { hideBin } from "yargs/helpers";
7
+
8
+ export interface Word {
9
+ punctuated_word: string;
10
+ start: number;
11
+ end: number;
12
+ }
13
+
14
+ export interface MetaData {
15
+ audioFile: string;
16
+ text: Word[];
17
+ textColor: string;
18
+ }
19
+
20
+ export const deepgramClient = createClient(
21
+ process.env.DEEPGRAM_API_KEY,
22
+ );
23
+
24
+ async function getPostText(postUrl: string) {
25
+ const response = await axios.get(postUrl + ".json");
26
+ const responseData = response.data;
27
+
28
+ return (
29
+ responseData[0].data.children[0].data.title +
30
+ ".\n" +
31
+ responseData[0].data.children[0].data.selftext
32
+ );
33
+ }
34
+
35
+ async function voiceNameToId(voiceName: string): Promise<string | null> {
36
+ const url = "https://api.elevenlabs.io/v1/voices";
37
+ const headers = {
38
+ "Content-Type": "application/json",
39
+ "xi-api-key": process.env.ELEVEN_API_KEY,
40
+ };
41
+
42
+ try {
43
+ const response = await axios.get(url, { headers });
44
+ const voices = response.data.voices;
45
+ const voice = voices.find((v: any) => v.name === voiceName);
46
+ return voice ? voice.voice_id : null;
47
+ } catch (error) {
48
+ console.error("Error fetching voices:", error);
49
+ throw error;
50
+ }
51
+ }
52
+
53
+ async function textToSpeech(post: string, voiceId: string, modelId: string) {
54
+ const url = `https://api.elevenlabs.io/v1/text-to-speech/${voiceId}`;
55
+ const headers = {
56
+ "Content-Type": "application/json",
57
+ "xi-api-key": process.env.ELEVEN_API_KEY,
58
+ };
59
+ const data = {
60
+ model_id: modelId,
61
+ text: post,
62
+ };
63
+
64
+ try {
65
+ const response = await axios.post(url, data, {
66
+ headers,
67
+ responseType: "arraybuffer",
68
+ });
69
+ return response.data;
70
+ } catch (error) {
71
+ console.error("Error making text-to-speech request:", error);
72
+ throw error;
73
+ }
74
+ }
75
+
76
+ export async function speechToText(filePath: string) {
77
+ const { result } = await deepgramClient.listen.prerecorded.transcribeFile(
78
+ fs.readFileSync(filePath),
79
+ {
80
+ model: "nova-2",
81
+ smart_format: true,
82
+ },
83
+ );
84
+
85
+ return result;
86
+ }
87
+
88
+ async function main() {
89
+ const argv = await yargs(hideBin(process.argv)).options({
90
+ voice: {
91
+ alias: "v",
92
+ describe: "The name of the eleven labs voice to use",
93
+ type: "string",
94
+ default: "Sarah",
95
+ },
96
+ post: {
97
+ alias: "p",
98
+ describe: "The Reddit post URL",
99
+ type: "string",
100
+ default:
101
+ "https://www.reddit.com/r/TrueOffMyChest/comments/1bllfgk/i_hate_having_old_parents/",
102
+ },
103
+ textcolor: {
104
+ alias: "c",
105
+ describe: "color of the text",
106
+ type: "string",
107
+ default: "red",
108
+ },
109
+ onlyMetadata: {
110
+ alias: "m",
111
+ describe: "only save metadata and do not render the video",
112
+ type: "boolean",
113
+ default: false,
114
+ },
115
+ }).argv;
116
+
117
+ const url = argv.post;
118
+ const voiceName = argv.voice;
119
+ const textColor = argv.textcolor;
120
+
121
+ const post = await getPostText(url);
122
+ const voiceId = await voiceNameToId(voiceName);
123
+ const ttsRes = await textToSpeech(post, voiceId, "eleven_multilingual_v2");
124
+
125
+ await fs.writeFileSync("./output/audio.wav", ttsRes);
126
+
127
+ const transcriptionResponse = await speechToText("./output/audio.wav");
128
+ const words =
129
+ transcriptionResponse.results.channels[0].alternatives[0].words.map(
130
+ (word: any) => ({
131
+ punctuated_word: word.punctuated_word,
132
+ start: word.start,
133
+ end: word.end,
134
+ }),
135
+ );
136
+
137
+ const metaData: MetaData = {
138
+ audioFile: "./output/audio.wav",
139
+ text: words,
140
+ textColor: textColor,
141
+ };
142
+
143
+ fs.writeFileSync("./metadata.json", JSON.stringify(metaData, null, 2));
144
+ console.log("saved metadata to ./metadata.json");
145
+
146
+ if (!argv.onlyMetadata) {
147
+ const file = renderVideo({
148
+ projectFile: "./vite.config.ts",
149
+ variables: { data: metaData },
150
+ settings: { logProgress: true }
151
+ });
152
+
153
+ console.log(`rendered video to ${file}`)
154
+ }
155
+ }
156
+
157
+ main();
@@ -0,0 +1 @@
1
+ /// <reference types="@revideo/core/project" />
@@ -0,0 +1,5 @@
1
+ {
2
+ "version": 0,
3
+ "timeEvents": [],
4
+ "seed": 3377806303
5
+ }
@@ -0,0 +1,74 @@
1
+ import { Audio, Txt, Video, View2D, makeScene2D } from "@revideo/2d";
2
+ import { createRef, useScene, waitFor } from "@revideo/core";
3
+ import { MetaData, Word } from "../render";
4
+
5
+ export default makeScene2D(function* (view) {
6
+ const videoRef = createRef<Video>();
7
+ const data: MetaData = useScene().variables.get("data", {
8
+ audioFile: "hi",
9
+ text: [],
10
+ textColor: "red",
11
+ })();
12
+
13
+ yield view.add(
14
+ <>
15
+ <Video
16
+ ref={videoRef}
17
+ volume={0}
18
+ src={"https://revideo-example-assets.s3.amazonaws.com/minecraft.mp4"}
19
+ play={true}
20
+ size={"100%"}
21
+ />
22
+ <Audio src={data.audioFile} play={true} />
23
+ </>,
24
+ );
25
+
26
+ let waitBefore = data.text[0].start;
27
+
28
+ for (let i = 0; i < data.text.length; i++) {
29
+ const currentClip = data.text[i];
30
+ const nextClipStart =
31
+ i < data.text.length - 1 ? data.text[i + 1].start : null;
32
+ const isLastClip = i === data.text.length - 1;
33
+ const waitAfter = isLastClip ? 1 : 0;
34
+ yield* displayTextClip(
35
+ currentClip,
36
+ waitBefore,
37
+ waitAfter,
38
+ view,
39
+ data.textColor,
40
+ );
41
+ waitBefore = nextClipStart !== null ? nextClipStart - currentClip.end : 0;
42
+ }
43
+ });
44
+
45
+ function* displayTextClip(
46
+ textClip: Word,
47
+ waitBefore: number,
48
+ waitAfter: number,
49
+ view: View2D,
50
+ textColor: string,
51
+ ) {
52
+ const textRef = createRef<Txt>();
53
+ yield* waitFor(waitBefore);
54
+ view.add(
55
+ <Txt
56
+ fontSize={100}
57
+ fontWeight={800}
58
+ ref={textRef}
59
+ fontFamily={"Raleway"}
60
+ textWrap={true}
61
+ textAlign={"center"}
62
+ fill={textColor}
63
+ width={"70%"}
64
+ lineWidth={2}
65
+ shadowOffset={10}
66
+ shadowBlur={30}
67
+ shadowColor={"black"}
68
+ >
69
+ {textClip.punctuated_word}
70
+ </Txt>,
71
+ );
72
+ yield* waitFor(textClip.end - textClip.start + waitAfter);
73
+ textRef().remove();
74
+ }
@@ -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,6 @@
1
+ import { defineConfig } from "vite";
2
+ import motionCanvas from "@revideo/vite-plugin";
3
+
4
+ export default defineConfig({
5
+ plugins: [motionCanvas()],
6
+ });
@@ -0,0 +1,9 @@
1
+ # Rive Explanation Video
2
+
3
+ This is the code for a small video showing how you can use Rive animations in Revideo using the `<Rive />` component.
4
+
5
+
6
+ https://github.com/user-attachments/assets/0302a3c2-65e4-4392-8b6c-90c4a505d23d
7
+
8
+
9
+