@remotion/cloudrun 4.1.0-alpha2 → 4.1.0-alpha3
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/dist/api/get-service-info.js +7 -9
- package/dist/api/get-services.js +13 -13
- package/dist/api/helpers/parse-service-name.d.ts +8 -0
- package/dist/api/helpers/parse-service-name.js +24 -0
- package/dist/api/test/service-names.test.d.ts +1 -0
- package/dist/api/test/service-names.test.js +28 -0
- package/dist/cli/commands/render/index.d.ts +1 -1
- package/dist/cli/commands/render/index.js +146 -26
- package/dist/cli/commands/still.d.ts +2 -0
- package/dist/cli/commands/still.js +123 -0
- package/dist/cli/help.js +5 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/log.d.ts +3 -3
- package/dist/functions/helpers/get-composition-from-body.d.ts +1 -0
- package/dist/functions/helpers/get-composition-from-body.js +13 -0
- package/dist/functions/helpers/io.d.ts +11 -0
- package/dist/functions/helpers/io.js +17 -0
- package/dist/functions/helpers/payloads.d.ts +262 -0
- package/dist/functions/helpers/payloads.js +91 -0
- package/dist/functions/index.d.ts +3 -0
- package/dist/functions/index.js +38 -0
- package/dist/functions/render-media-single-thread.d.ts +3 -0
- package/dist/functions/render-media-single-thread.js +79 -0
- package/dist/functions/render-still-single-thread.d.ts +3 -0
- package/dist/functions/render-still-single-thread.js +66 -0
- package/dist/shared/generate-service-name.js +2 -2
- package/dist/shared/service-version-string.js +1 -1
- package/package.json +8 -10
- package/readme.md +2 -305
- package/tsconfig.tsbuildinfo +1 -1
- package/readmeImages/createSA.png +0 -0
- package/readmeImages/downloadEnv.jpg +0 -0
- package/readmeImages/downloadEnvFolder.png +0 -0
- package/readmeImages/saRole.png +0 -0
- package/readmeImages/selectCloudShell.jpg +0 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"media">;
|
|
4
|
+
serveUrl: z.ZodString;
|
|
5
|
+
composition: z.ZodString;
|
|
6
|
+
forceHeight: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
7
|
+
forceWidth: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
8
|
+
codec: z.ZodEnum<["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"]>;
|
|
9
|
+
inputProps: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodUndefined]>;
|
|
10
|
+
jpegQuality: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
audioCodec: z.ZodNullable<z.ZodOptional<z.ZodEnum<["pcm-16", "aac", "mp3", "opus"]>>>;
|
|
12
|
+
audioBitrate: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
13
|
+
videoBitrate: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
14
|
+
crf: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
15
|
+
pixelFormat: z.ZodOptional<z.ZodEnum<["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"]>>;
|
|
16
|
+
imageFormat: z.ZodOptional<z.ZodEnum<["png", "jpeg", "none"]>>;
|
|
17
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
proResProfile: z.ZodOptional<z.ZodEnum<["4444-xq", "4444", "hq", "standard", "light", "proxy"]>>;
|
|
19
|
+
everyNthFrame: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
numberOfGifLoops: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
21
|
+
frameRange: z.ZodOptional<z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodNumber]>>;
|
|
22
|
+
envVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
23
|
+
chromiumOptions: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
ignoreCertificateErrors: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
disableWebSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
gl: z.ZodNullable<z.ZodOptional<z.ZodEnum<["swangle", "angle", "egl", "swiftshader"]>>>;
|
|
27
|
+
headless: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
userAgent: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
31
|
+
disableWebSecurity?: boolean | undefined;
|
|
32
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
33
|
+
headless?: boolean | undefined;
|
|
34
|
+
userAgent?: string | null | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
37
|
+
disableWebSecurity?: boolean | undefined;
|
|
38
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
39
|
+
headless?: boolean | undefined;
|
|
40
|
+
userAgent?: string | null | undefined;
|
|
41
|
+
}>>;
|
|
42
|
+
muted: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
outputBucket: z.ZodString;
|
|
44
|
+
outName: z.ZodOptional<z.ZodString>;
|
|
45
|
+
privacy: z.ZodOptional<z.ZodEnum<["public", "private"]>>;
|
|
46
|
+
logLevel: z.ZodEnum<["verbose", "info", "warn", "error"]>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
serveUrl: string;
|
|
49
|
+
codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
50
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
51
|
+
composition: string;
|
|
52
|
+
type: "media";
|
|
53
|
+
outputBucket: string;
|
|
54
|
+
forceHeight?: number | null | undefined;
|
|
55
|
+
forceWidth?: number | null | undefined;
|
|
56
|
+
inputProps?: Record<string, unknown> | undefined;
|
|
57
|
+
jpegQuality?: number | undefined;
|
|
58
|
+
audioCodec?: "mp3" | "aac" | "pcm-16" | "opus" | null | undefined;
|
|
59
|
+
audioBitrate?: string | null | undefined;
|
|
60
|
+
videoBitrate?: string | null | undefined;
|
|
61
|
+
crf?: number | null | undefined;
|
|
62
|
+
pixelFormat?: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le" | undefined;
|
|
63
|
+
imageFormat?: "png" | "jpeg" | "none" | undefined;
|
|
64
|
+
scale?: number | undefined;
|
|
65
|
+
proResProfile?: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined;
|
|
66
|
+
everyNthFrame?: number | undefined;
|
|
67
|
+
numberOfGifLoops?: number | null | undefined;
|
|
68
|
+
frameRange?: number | [number, number] | undefined;
|
|
69
|
+
envVariables?: Record<string, string> | undefined;
|
|
70
|
+
chromiumOptions?: {
|
|
71
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
72
|
+
disableWebSecurity?: boolean | undefined;
|
|
73
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
74
|
+
headless?: boolean | undefined;
|
|
75
|
+
userAgent?: string | null | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
muted?: boolean | undefined;
|
|
78
|
+
outName?: string | undefined;
|
|
79
|
+
privacy?: "public" | "private" | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
serveUrl: string;
|
|
82
|
+
codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
83
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
84
|
+
composition: string;
|
|
85
|
+
type: "media";
|
|
86
|
+
outputBucket: string;
|
|
87
|
+
forceHeight?: number | null | undefined;
|
|
88
|
+
forceWidth?: number | null | undefined;
|
|
89
|
+
inputProps?: Record<string, unknown> | undefined;
|
|
90
|
+
jpegQuality?: number | undefined;
|
|
91
|
+
audioCodec?: "mp3" | "aac" | "pcm-16" | "opus" | null | undefined;
|
|
92
|
+
audioBitrate?: string | null | undefined;
|
|
93
|
+
videoBitrate?: string | null | undefined;
|
|
94
|
+
crf?: number | null | undefined;
|
|
95
|
+
pixelFormat?: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le" | undefined;
|
|
96
|
+
imageFormat?: "png" | "jpeg" | "none" | undefined;
|
|
97
|
+
scale?: number | undefined;
|
|
98
|
+
proResProfile?: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined;
|
|
99
|
+
everyNthFrame?: number | undefined;
|
|
100
|
+
numberOfGifLoops?: number | null | undefined;
|
|
101
|
+
frameRange?: number | [number, number] | undefined;
|
|
102
|
+
envVariables?: Record<string, string> | undefined;
|
|
103
|
+
chromiumOptions?: {
|
|
104
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
105
|
+
disableWebSecurity?: boolean | undefined;
|
|
106
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
107
|
+
headless?: boolean | undefined;
|
|
108
|
+
userAgent?: string | null | undefined;
|
|
109
|
+
} | undefined;
|
|
110
|
+
muted?: boolean | undefined;
|
|
111
|
+
outName?: string | undefined;
|
|
112
|
+
privacy?: "public" | "private" | undefined;
|
|
113
|
+
}>, z.ZodObject<{
|
|
114
|
+
type: z.ZodLiteral<"still">;
|
|
115
|
+
serveUrl: z.ZodString;
|
|
116
|
+
composition: z.ZodString;
|
|
117
|
+
forceHeight: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
118
|
+
forceWidth: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
119
|
+
inputProps: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodUndefined]>;
|
|
120
|
+
jpegQuality: z.ZodOptional<z.ZodNumber>;
|
|
121
|
+
imageFormat: z.ZodOptional<z.ZodEnum<["png", "jpeg", "pdf", "webp"]>>;
|
|
122
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
privacy: z.ZodOptional<z.ZodEnum<["public", "private"]>>;
|
|
124
|
+
envVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
125
|
+
chromiumOptions: z.ZodOptional<z.ZodObject<{
|
|
126
|
+
ignoreCertificateErrors: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
disableWebSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
128
|
+
gl: z.ZodNullable<z.ZodOptional<z.ZodEnum<["swangle", "angle", "egl", "swiftshader"]>>>;
|
|
129
|
+
headless: z.ZodOptional<z.ZodBoolean>;
|
|
130
|
+
userAgent: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
133
|
+
disableWebSecurity?: boolean | undefined;
|
|
134
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
135
|
+
headless?: boolean | undefined;
|
|
136
|
+
userAgent?: string | null | undefined;
|
|
137
|
+
}, {
|
|
138
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
139
|
+
disableWebSecurity?: boolean | undefined;
|
|
140
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
141
|
+
headless?: boolean | undefined;
|
|
142
|
+
userAgent?: string | null | undefined;
|
|
143
|
+
}>>;
|
|
144
|
+
outputBucket: z.ZodString;
|
|
145
|
+
outName: z.ZodOptional<z.ZodString>;
|
|
146
|
+
frame: z.ZodNumber;
|
|
147
|
+
logLevel: z.ZodEnum<["verbose", "info", "warn", "error"]>;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
serveUrl: string;
|
|
150
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
151
|
+
composition: string;
|
|
152
|
+
type: "still";
|
|
153
|
+
frame: number;
|
|
154
|
+
outputBucket: string;
|
|
155
|
+
forceHeight?: number | null | undefined;
|
|
156
|
+
forceWidth?: number | null | undefined;
|
|
157
|
+
inputProps?: Record<string, unknown> | undefined;
|
|
158
|
+
jpegQuality?: number | undefined;
|
|
159
|
+
imageFormat?: "png" | "jpeg" | "pdf" | "webp" | undefined;
|
|
160
|
+
scale?: number | undefined;
|
|
161
|
+
privacy?: "public" | "private" | undefined;
|
|
162
|
+
envVariables?: Record<string, string> | undefined;
|
|
163
|
+
chromiumOptions?: {
|
|
164
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
165
|
+
disableWebSecurity?: boolean | undefined;
|
|
166
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
167
|
+
headless?: boolean | undefined;
|
|
168
|
+
userAgent?: string | null | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
outName?: string | undefined;
|
|
171
|
+
}, {
|
|
172
|
+
serveUrl: string;
|
|
173
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
174
|
+
composition: string;
|
|
175
|
+
type: "still";
|
|
176
|
+
frame: number;
|
|
177
|
+
outputBucket: string;
|
|
178
|
+
forceHeight?: number | null | undefined;
|
|
179
|
+
forceWidth?: number | null | undefined;
|
|
180
|
+
inputProps?: Record<string, unknown> | undefined;
|
|
181
|
+
jpegQuality?: number | undefined;
|
|
182
|
+
imageFormat?: "png" | "jpeg" | "pdf" | "webp" | undefined;
|
|
183
|
+
scale?: number | undefined;
|
|
184
|
+
privacy?: "public" | "private" | undefined;
|
|
185
|
+
envVariables?: Record<string, string> | undefined;
|
|
186
|
+
chromiumOptions?: {
|
|
187
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
188
|
+
disableWebSecurity?: boolean | undefined;
|
|
189
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
190
|
+
headless?: boolean | undefined;
|
|
191
|
+
userAgent?: string | null | undefined;
|
|
192
|
+
} | undefined;
|
|
193
|
+
outName?: string | undefined;
|
|
194
|
+
}>]>;
|
|
195
|
+
declare const renderFailResponsePayload: z.ZodObject<{
|
|
196
|
+
status: z.ZodLiteral<"error">;
|
|
197
|
+
error: z.ZodString;
|
|
198
|
+
stack: z.ZodString;
|
|
199
|
+
}, "strip", z.ZodTypeAny, {
|
|
200
|
+
error: string;
|
|
201
|
+
status: "error";
|
|
202
|
+
stack: string;
|
|
203
|
+
}, {
|
|
204
|
+
error: string;
|
|
205
|
+
status: "error";
|
|
206
|
+
stack: string;
|
|
207
|
+
}>;
|
|
208
|
+
declare const renderStillOnCloudrunResponsePayload: z.ZodObject<{
|
|
209
|
+
publicUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
210
|
+
cloudStorageUri: z.ZodString;
|
|
211
|
+
size: z.ZodNumber;
|
|
212
|
+
bucketName: z.ZodString;
|
|
213
|
+
renderId: z.ZodString;
|
|
214
|
+
status: z.ZodLiteral<"success">;
|
|
215
|
+
privacy: z.ZodEnum<["public-read", "project-private"]>;
|
|
216
|
+
}, "strip", z.ZodTypeAny, {
|
|
217
|
+
privacy: "public-read" | "project-private";
|
|
218
|
+
cloudStorageUri: string;
|
|
219
|
+
size: number;
|
|
220
|
+
bucketName: string;
|
|
221
|
+
renderId: string;
|
|
222
|
+
status: "success";
|
|
223
|
+
publicUrl?: string | null | undefined;
|
|
224
|
+
}, {
|
|
225
|
+
privacy: "public-read" | "project-private";
|
|
226
|
+
cloudStorageUri: string;
|
|
227
|
+
size: number;
|
|
228
|
+
bucketName: string;
|
|
229
|
+
renderId: string;
|
|
230
|
+
status: "success";
|
|
231
|
+
publicUrl?: string | null | undefined;
|
|
232
|
+
}>;
|
|
233
|
+
declare const renderMediaOnCloudrunResponsePayload: z.ZodObject<{
|
|
234
|
+
publicUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
235
|
+
cloudStorageUri: z.ZodString;
|
|
236
|
+
size: z.ZodNumber;
|
|
237
|
+
bucketName: z.ZodString;
|
|
238
|
+
renderId: z.ZodString;
|
|
239
|
+
status: z.ZodLiteral<"success">;
|
|
240
|
+
privacy: z.ZodEnum<["public-read", "project-private"]>;
|
|
241
|
+
}, "strip", z.ZodTypeAny, {
|
|
242
|
+
privacy: "public-read" | "project-private";
|
|
243
|
+
cloudStorageUri: string;
|
|
244
|
+
size: number;
|
|
245
|
+
bucketName: string;
|
|
246
|
+
renderId: string;
|
|
247
|
+
status: "success";
|
|
248
|
+
publicUrl?: string | null | undefined;
|
|
249
|
+
}, {
|
|
250
|
+
privacy: "public-read" | "project-private";
|
|
251
|
+
cloudStorageUri: string;
|
|
252
|
+
size: number;
|
|
253
|
+
bucketName: string;
|
|
254
|
+
renderId: string;
|
|
255
|
+
status: "success";
|
|
256
|
+
publicUrl?: string | null | undefined;
|
|
257
|
+
}>;
|
|
258
|
+
export declare type CloudRunPayloadType = z.infer<typeof CloudRunPayload>;
|
|
259
|
+
export declare type RenderStillOnCloudrunOutput = z.infer<typeof renderStillOnCloudrunResponsePayload>;
|
|
260
|
+
export declare type RenderMediaOnCloudrunOutput = z.infer<typeof renderMediaOnCloudrunResponsePayload>;
|
|
261
|
+
export declare type ErrorResponsePayload = z.infer<typeof renderFailResponsePayload>;
|
|
262
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudRunPayload = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const client_1 = require("@remotion/renderer/client");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const codec = zod_1.z.enum(renderer_1.RenderInternals.validCodecs);
|
|
8
|
+
const audioCodec = zod_1.z.enum(renderer_1.RenderInternals.validAudioCodecs);
|
|
9
|
+
const pixelFormat = zod_1.z.enum(renderer_1.RenderInternals.validPixelFormats);
|
|
10
|
+
const videoImageFormat = zod_1.z.enum(renderer_1.RenderInternals.validVideoImageFormats);
|
|
11
|
+
const stillImageFormat = zod_1.z.enum(renderer_1.RenderInternals.validStillImageFormats);
|
|
12
|
+
const proResProfile = zod_1.z.enum(client_1.BrowserSafeApis.proResProfileOptions);
|
|
13
|
+
const chromiumOptions = zod_1.z.object({
|
|
14
|
+
ignoreCertificateErrors: zod_1.z.boolean().optional(),
|
|
15
|
+
disableWebSecurity: zod_1.z.boolean().optional(),
|
|
16
|
+
gl: zod_1.z.enum(renderer_1.RenderInternals.validOpenGlRenderers).optional().nullable(),
|
|
17
|
+
headless: zod_1.z.boolean().optional(),
|
|
18
|
+
userAgent: zod_1.z.string().optional().nullable(),
|
|
19
|
+
});
|
|
20
|
+
const logLevel = zod_1.z.enum(renderer_1.RenderInternals.logLevels);
|
|
21
|
+
exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
|
|
22
|
+
zod_1.z.object({
|
|
23
|
+
type: zod_1.z.literal('media'),
|
|
24
|
+
serveUrl: zod_1.z.string(),
|
|
25
|
+
composition: zod_1.z.string(),
|
|
26
|
+
forceHeight: zod_1.z.number().optional().nullable(),
|
|
27
|
+
forceWidth: zod_1.z.number().optional().nullable(),
|
|
28
|
+
codec,
|
|
29
|
+
inputProps: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).or(zod_1.z.undefined()),
|
|
30
|
+
jpegQuality: zod_1.z.number().optional(),
|
|
31
|
+
audioCodec: audioCodec.optional().nullable(),
|
|
32
|
+
audioBitrate: zod_1.z.string().optional().nullable(),
|
|
33
|
+
videoBitrate: zod_1.z.string().optional().nullable(),
|
|
34
|
+
crf: zod_1.z.number().optional().nullable(),
|
|
35
|
+
pixelFormat: pixelFormat.optional(),
|
|
36
|
+
imageFormat: videoImageFormat.optional(),
|
|
37
|
+
scale: zod_1.z.number().optional(),
|
|
38
|
+
proResProfile: proResProfile.optional(),
|
|
39
|
+
everyNthFrame: zod_1.z.number().optional(),
|
|
40
|
+
numberOfGifLoops: zod_1.z.number().optional().nullable(),
|
|
41
|
+
frameRange: zod_1.z.tuple([zod_1.z.number(), zod_1.z.number()]).or(zod_1.z.number()).optional(),
|
|
42
|
+
envVariables: zod_1.z.record(zod_1.z.string()).optional(),
|
|
43
|
+
chromiumOptions: chromiumOptions.optional(),
|
|
44
|
+
muted: zod_1.z.boolean().optional(),
|
|
45
|
+
outputBucket: zod_1.z.string(),
|
|
46
|
+
outName: zod_1.z.string().optional(),
|
|
47
|
+
privacy: zod_1.z.enum(['public', 'private']).optional(),
|
|
48
|
+
logLevel,
|
|
49
|
+
}),
|
|
50
|
+
zod_1.z.object({
|
|
51
|
+
type: zod_1.z.literal('still'),
|
|
52
|
+
serveUrl: zod_1.z.string(),
|
|
53
|
+
composition: zod_1.z.string(),
|
|
54
|
+
forceHeight: zod_1.z.number().optional().nullable(),
|
|
55
|
+
forceWidth: zod_1.z.number().optional().nullable(),
|
|
56
|
+
inputProps: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).or(zod_1.z.undefined()),
|
|
57
|
+
jpegQuality: zod_1.z.number().optional(),
|
|
58
|
+
imageFormat: stillImageFormat.optional(),
|
|
59
|
+
scale: zod_1.z.number().optional(),
|
|
60
|
+
privacy: zod_1.z.enum(['public', 'private']).optional(),
|
|
61
|
+
envVariables: zod_1.z.record(zod_1.z.string()).optional(),
|
|
62
|
+
chromiumOptions: chromiumOptions.optional(),
|
|
63
|
+
outputBucket: zod_1.z.string(),
|
|
64
|
+
outName: zod_1.z.string().optional(),
|
|
65
|
+
frame: zod_1.z.number(),
|
|
66
|
+
logLevel,
|
|
67
|
+
}),
|
|
68
|
+
]);
|
|
69
|
+
const renderFailResponsePayload = zod_1.z.object({
|
|
70
|
+
status: zod_1.z.literal('error'),
|
|
71
|
+
error: zod_1.z.string(),
|
|
72
|
+
stack: zod_1.z.string(),
|
|
73
|
+
});
|
|
74
|
+
const renderStillOnCloudrunResponsePayload = zod_1.z.object({
|
|
75
|
+
publicUrl: zod_1.z.string().optional().nullable(),
|
|
76
|
+
cloudStorageUri: zod_1.z.string(),
|
|
77
|
+
size: zod_1.z.number(),
|
|
78
|
+
bucketName: zod_1.z.string(),
|
|
79
|
+
renderId: zod_1.z.string(),
|
|
80
|
+
status: zod_1.z.literal('success'),
|
|
81
|
+
privacy: zod_1.z.enum(['public-read', 'project-private']),
|
|
82
|
+
});
|
|
83
|
+
const renderMediaOnCloudrunResponsePayload = zod_1.z.object({
|
|
84
|
+
publicUrl: zod_1.z.string().optional().nullable(),
|
|
85
|
+
cloudStorageUri: zod_1.z.string(),
|
|
86
|
+
size: zod_1.z.number(),
|
|
87
|
+
bucketName: zod_1.z.string(),
|
|
88
|
+
renderId: zod_1.z.string(),
|
|
89
|
+
status: zod_1.z.literal('success'),
|
|
90
|
+
privacy: zod_1.z.enum(['public-read', 'project-private']),
|
|
91
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderOnCloudRun = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const log_1 = require("../cli/log");
|
|
6
|
+
const payloads_1 = require("./helpers/payloads");
|
|
7
|
+
const render_media_single_thread_1 = require("./render-media-single-thread");
|
|
8
|
+
const render_still_single_thread_1 = require("./render-still-single-thread");
|
|
9
|
+
const renderOnCloudRun = async (req, res) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const body = payloads_1.CloudRunPayload.parse(req.body);
|
|
12
|
+
const renderType = body.type;
|
|
13
|
+
renderer_1.RenderInternals.setLogLevel(body.logLevel);
|
|
14
|
+
try {
|
|
15
|
+
switch (renderType) {
|
|
16
|
+
case 'media':
|
|
17
|
+
await (0, render_media_single_thread_1.renderMediaSingleThread)(body, res);
|
|
18
|
+
break;
|
|
19
|
+
case 'still':
|
|
20
|
+
await (0, render_still_single_thread_1.renderStillSingleThread)(body, res);
|
|
21
|
+
break;
|
|
22
|
+
default:
|
|
23
|
+
res
|
|
24
|
+
.status(400)
|
|
25
|
+
.send('Invalid render type, must be either "media" or "still"');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
log_1.Log.error('Error while rendering', err);
|
|
30
|
+
const response = {
|
|
31
|
+
error: err.message,
|
|
32
|
+
status: 'error',
|
|
33
|
+
stack: (_a = err.stack) !== null && _a !== void 0 ? _a : '',
|
|
34
|
+
};
|
|
35
|
+
res.status(500).send(JSON.stringify(response));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.renderOnCloudRun = renderOnCloudRun;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderMediaSingleThread = void 0;
|
|
4
|
+
const storage_1 = require("@google-cloud/storage");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const random_hash_1 = require("../shared/random-hash");
|
|
7
|
+
const get_composition_from_body_1 = require("./helpers/get-composition-from-body");
|
|
8
|
+
const renderMediaSingleThread = async (body, res) => {
|
|
9
|
+
var _a, _b, _c, _d, _e;
|
|
10
|
+
if (body.type !== 'media') {
|
|
11
|
+
throw new Error('expected type media');
|
|
12
|
+
}
|
|
13
|
+
const composition = await (0, get_composition_from_body_1.getCompositionFromBody)(body.serveUrl, body.composition);
|
|
14
|
+
const tempFilePath = '/tmp/output.mp4';
|
|
15
|
+
const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
|
|
16
|
+
let previousProgress = 2;
|
|
17
|
+
const onProgress = ({ progress }) => {
|
|
18
|
+
if (previousProgress !== progress) {
|
|
19
|
+
res.write(JSON.stringify({ onProgress: progress }));
|
|
20
|
+
previousProgress = progress;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
24
|
+
const actualChromiumOptions = {
|
|
25
|
+
...body.chromiumOptions,
|
|
26
|
+
// Override the `null` value, which might come from CLI with swANGLE
|
|
27
|
+
gl: (_b = (_a = body.chromiumOptions) === null || _a === void 0 ? void 0 : _a.gl) !== null && _b !== void 0 ? _b : 'swangle',
|
|
28
|
+
};
|
|
29
|
+
await (0, renderer_1.renderMedia)({
|
|
30
|
+
composition: {
|
|
31
|
+
...composition,
|
|
32
|
+
height: (_c = body.forceHeight) !== null && _c !== void 0 ? _c : composition.height,
|
|
33
|
+
width: (_d = body.forceWidth) !== null && _d !== void 0 ? _d : composition.width,
|
|
34
|
+
},
|
|
35
|
+
serveUrl: body.serveUrl,
|
|
36
|
+
codec: body.codec,
|
|
37
|
+
outputLocation: tempFilePath,
|
|
38
|
+
inputProps: body.inputProps,
|
|
39
|
+
jpegQuality: body.jpegQuality,
|
|
40
|
+
audioCodec: body.audioCodec,
|
|
41
|
+
audioBitrate: body.audioBitrate,
|
|
42
|
+
videoBitrate: body.videoBitrate,
|
|
43
|
+
crf: body.crf,
|
|
44
|
+
pixelFormat: body.pixelFormat,
|
|
45
|
+
imageFormat: body.imageFormat,
|
|
46
|
+
scale: body.scale,
|
|
47
|
+
proResProfile: body.proResProfile,
|
|
48
|
+
everyNthFrame: body.everyNthFrame,
|
|
49
|
+
numberOfGifLoops: body.numberOfGifLoops,
|
|
50
|
+
onProgress,
|
|
51
|
+
frameRange: body.frameRange,
|
|
52
|
+
envVariables: body.envVariables,
|
|
53
|
+
chromiumOptions: actualChromiumOptions,
|
|
54
|
+
muted: body.muted,
|
|
55
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(body.logLevel, 'verbose'),
|
|
56
|
+
});
|
|
57
|
+
const storage = new storage_1.Storage();
|
|
58
|
+
const publicUpload = body.privacy === 'public' || !body.privacy;
|
|
59
|
+
const uploadedResponse = await storage
|
|
60
|
+
.bucket(body.outputBucket)
|
|
61
|
+
.upload(tempFilePath, {
|
|
62
|
+
destination: `renders/${renderId}/${(_e = body.outName) !== null && _e !== void 0 ? _e : 'out.mp4'}`,
|
|
63
|
+
predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
|
|
64
|
+
});
|
|
65
|
+
const uploadedFile = uploadedResponse[0];
|
|
66
|
+
const renderMetadata = await uploadedFile.getMetadata();
|
|
67
|
+
const responseData = {
|
|
68
|
+
status: 'success',
|
|
69
|
+
publicUrl: publicUpload ? uploadedFile.publicUrl() : null,
|
|
70
|
+
cloudStorageUri: uploadedFile.cloudStorageURI.href,
|
|
71
|
+
size: renderMetadata[0].size,
|
|
72
|
+
bucketName: body.outputBucket,
|
|
73
|
+
renderId,
|
|
74
|
+
privacy: publicUpload ? 'public-read' : 'project-private',
|
|
75
|
+
};
|
|
76
|
+
renderer_1.RenderInternals.Log.info('Render Completed:', responseData);
|
|
77
|
+
res.end(JSON.stringify({ response: responseData }));
|
|
78
|
+
};
|
|
79
|
+
exports.renderMediaSingleThread = renderMediaSingleThread;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderStillSingleThread = void 0;
|
|
4
|
+
const storage_1 = require("@google-cloud/storage");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const log_1 = require("../cli/log");
|
|
7
|
+
const random_hash_1 = require("../shared/random-hash");
|
|
8
|
+
const get_composition_from_body_1 = require("./helpers/get-composition-from-body");
|
|
9
|
+
const renderStillSingleThread = async (body, res) => {
|
|
10
|
+
var _a, _b, _c, _d, _e;
|
|
11
|
+
if (body.type !== 'still') {
|
|
12
|
+
throw new Error('expected type still');
|
|
13
|
+
}
|
|
14
|
+
log_1.Log.verbose('Rendering still frame', body);
|
|
15
|
+
const composition = await (0, get_composition_from_body_1.getCompositionFromBody)(body.serveUrl, body.composition);
|
|
16
|
+
log_1.Log.verbose('Composition loaded', composition);
|
|
17
|
+
const tempFilePath = '/tmp/still.png';
|
|
18
|
+
const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
|
|
19
|
+
const actualChromiumOptions = {
|
|
20
|
+
...body.chromiumOptions,
|
|
21
|
+
// Override the `null` value, which might come from CLI with swANGLE
|
|
22
|
+
gl: (_b = (_a = body.chromiumOptions) === null || _a === void 0 ? void 0 : _a.gl) !== null && _b !== void 0 ? _b : 'swangle',
|
|
23
|
+
};
|
|
24
|
+
await (0, renderer_1.renderStill)({
|
|
25
|
+
composition: {
|
|
26
|
+
...composition,
|
|
27
|
+
height: (_c = body.forceHeight) !== null && _c !== void 0 ? _c : composition.height,
|
|
28
|
+
width: (_d = body.forceWidth) !== null && _d !== void 0 ? _d : composition.width,
|
|
29
|
+
},
|
|
30
|
+
serveUrl: body.serveUrl,
|
|
31
|
+
output: tempFilePath,
|
|
32
|
+
inputProps: body.inputProps,
|
|
33
|
+
jpegQuality: body.jpegQuality,
|
|
34
|
+
imageFormat: body.imageFormat,
|
|
35
|
+
scale: body.scale,
|
|
36
|
+
envVariables: body.envVariables,
|
|
37
|
+
chromiumOptions: actualChromiumOptions,
|
|
38
|
+
frame: body.frame,
|
|
39
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(body.logLevel, 'verbose'),
|
|
40
|
+
});
|
|
41
|
+
log_1.Log.info('Still rendered');
|
|
42
|
+
const storage = new storage_1.Storage();
|
|
43
|
+
const publicUpload = body.privacy === 'public' || !body.privacy;
|
|
44
|
+
const uploadedResponse = await storage
|
|
45
|
+
.bucket(body.outputBucket)
|
|
46
|
+
.upload(tempFilePath, {
|
|
47
|
+
destination: `renders/${renderId}/${(_e = body.outName) !== null && _e !== void 0 ? _e : 'out.png'}`,
|
|
48
|
+
predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
|
|
49
|
+
});
|
|
50
|
+
log_1.Log.info('Still uploaded');
|
|
51
|
+
const uploadedFile = uploadedResponse[0];
|
|
52
|
+
const renderMetadata = await uploadedFile.getMetadata();
|
|
53
|
+
const responseData = {
|
|
54
|
+
publicUrl: uploadedFile.publicUrl(),
|
|
55
|
+
cloudStorageUri: uploadedFile.cloudStorageURI.href,
|
|
56
|
+
size: renderMetadata[0].size,
|
|
57
|
+
bucketName: body.outputBucket,
|
|
58
|
+
renderId,
|
|
59
|
+
status: 'success',
|
|
60
|
+
privacy: publicUpload ? 'public-read' : 'project-private',
|
|
61
|
+
};
|
|
62
|
+
renderer_1.RenderInternals.Log.info('Render Completed:', responseData);
|
|
63
|
+
const jsonContent = JSON.stringify(responseData);
|
|
64
|
+
res.end(jsonContent);
|
|
65
|
+
};
|
|
66
|
+
exports.renderStillSingleThread = renderStillSingleThread;
|
|
@@ -14,7 +14,7 @@ const generateServiceName = ({ memoryLimit, cpuLimit, timeoutSeconds, }) => {
|
|
|
14
14
|
(0, service_version_string_1.serviceVersionString)(),
|
|
15
15
|
`mem${sanitisedMem}`,
|
|
16
16
|
`cpu${sanitisedCPU}`,
|
|
17
|
-
`t
|
|
18
|
-
].join('
|
|
17
|
+
`t${String(timeoutSeconds)}`,
|
|
18
|
+
].join('-');
|
|
19
19
|
};
|
|
20
20
|
exports.generateServiceName = generateServiceName;
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.serviceVersionString = void 0;
|
|
4
4
|
const version_1 = require("remotion/version");
|
|
5
5
|
const serviceVersionString = () => {
|
|
6
|
-
return version_1.VERSION.replace(/\./g, '-').replace(/\+/g, '-')
|
|
6
|
+
return version_1.VERSION.replace(/\./g, '-').replace(/\+/g, '-');
|
|
7
7
|
};
|
|
8
8
|
exports.serviceVersionString = serviceVersionString;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/cloudrun",
|
|
3
|
-
"version": "4.1.0-
|
|
3
|
+
"version": "4.1.0-alpha3",
|
|
4
4
|
"description": "GCP Cloud Run alternative to lambda rendering",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"@google-cloud/resource-manager": "^4.3.0",
|
|
12
12
|
"google-auth-library": "^8.7.0",
|
|
13
13
|
"zod": "^3.21.4",
|
|
14
|
-
"@remotion/bundler": "4.1.0-
|
|
15
|
-
"@remotion/
|
|
16
|
-
"@remotion/
|
|
17
|
-
"remotion": "4.1.0-
|
|
14
|
+
"@remotion/bundler": "4.1.0-alpha3",
|
|
15
|
+
"@remotion/renderer": "4.1.0-alpha3",
|
|
16
|
+
"@remotion/cli": "4.1.0-alpha3",
|
|
17
|
+
"remotion": "4.1.0-alpha3"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@jonny/eslint-config": "3.0.266",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"ts-node": "^10.8.0",
|
|
27
27
|
"typescript": "4.7.2",
|
|
28
28
|
"vitest": "0.24.3",
|
|
29
|
-
"@remotion/compositor-linux-x64-gnu": "4.1.0-
|
|
29
|
+
"@remotion/compositor-linux-x64-gnu": "4.1.0-alpha3"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
"./package.json": "./package.json",
|
|
@@ -45,15 +45,13 @@
|
|
|
45
45
|
]
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
"publishConfig": {
|
|
49
|
-
"access": "public"
|
|
50
|
-
},
|
|
51
48
|
"scripts": {
|
|
52
49
|
"build": "tsc -d && cp src/shared/sa-permissions.json dist/shared/sa-permissions.json && pnpm run buildContainer && pnpm run tarInstaller",
|
|
53
50
|
"buildContainer": "ts-node src/admin/bundle-renderLogic.ts",
|
|
54
51
|
"tarInstaller": "ts-node src/admin/bundle-installer.ts",
|
|
55
52
|
"start": "functions-framework --target=TypescriptFunction",
|
|
56
53
|
"watch": "tsc -w",
|
|
57
|
-
"lint": "eslint src --ext ts,tsx"
|
|
54
|
+
"lint": "eslint src --ext ts,tsx",
|
|
55
|
+
"test": "vitest --run"
|
|
58
56
|
}
|
|
59
57
|
}
|