@remotion/cloudrun 4.1.0-alpha2 → 4.1.0-alpha4
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/.turbo/turbo-build.log +3 -3
- package/dist/api/check-if-service-exists.js +0 -1
- 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/render-media-on-cloudrun.d.ts +9 -1
- package/dist/api/render-media-on-cloudrun.js +25 -16
- package/dist/api/render-still-on-cloudrun.d.ts +3 -1
- package/dist/api/render-still-on-cloudrun.js +8 -5
- 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 +152 -26
- package/dist/cli/commands/still.d.ts +2 -0
- package/dist/cli/commands/still.js +124 -0
- package/dist/cli/help.js +5 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/log.d.ts +0 -1
- 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 +277 -0
- package/dist/functions/helpers/payloads.js +96 -0
- package/dist/functions/index.d.ts +3 -0
- package/dist/functions/index.js +39 -0
- package/dist/functions/render-media-single-thread.d.ts +3 -0
- package/dist/functions/render-media-single-thread.js +96 -0
- package/dist/functions/render-still-single-thread.d.ts +3 -0
- package/dist/functions/render-still-single-thread.js +76 -0
- package/dist/shared/generate-service-name.js +2 -2
- package/dist/shared/service-version-string.js +1 -1
- package/package.json +9 -12
- 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,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stillCommand = exports.STILL_COMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const config_1 = require("@remotion/cli/config");
|
|
6
|
+
const renderer_1 = require("@remotion/renderer");
|
|
7
|
+
const download_file_1 = require("../../api/download-file");
|
|
8
|
+
const render_still_on_cloudrun_1 = require("../../api/render-still-on-cloudrun");
|
|
9
|
+
const validate_serveurl_1 = require("../../shared/validate-serveurl");
|
|
10
|
+
const log_1 = require("../log");
|
|
11
|
+
const renderArgsCheck_1 = require("./render/helpers/renderArgsCheck");
|
|
12
|
+
exports.STILL_COMMAND = 'still';
|
|
13
|
+
const stillCommand = async (args, remotionRoot) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const { serveUrl, cloudRunUrl, outName, forceBucketName, privacy, downloadName, region, } = await (0, renderArgsCheck_1.renderArgsCheck)(exports.STILL_COMMAND, args);
|
|
16
|
+
const { chromiumOptions, envVariables, inputProps, puppeteerTimeout, jpegQuality, stillFrame, scale, height, width, browserExecutable, port, logLevel, } = await cli_1.CliInternals.getCliOptions({
|
|
17
|
+
type: 'still',
|
|
18
|
+
isLambda: true,
|
|
19
|
+
remotionRoot,
|
|
20
|
+
});
|
|
21
|
+
let composition = args[1];
|
|
22
|
+
if (!composition) {
|
|
23
|
+
log_1.Log.info('No compositions passed. Fetching compositions...');
|
|
24
|
+
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
25
|
+
const server = renderer_1.RenderInternals.prepareServer({
|
|
26
|
+
concurrency: 1,
|
|
27
|
+
indent: false,
|
|
28
|
+
port,
|
|
29
|
+
remotionRoot,
|
|
30
|
+
logLevel,
|
|
31
|
+
webpackConfigOrServeUrl: serveUrl,
|
|
32
|
+
});
|
|
33
|
+
const { compositionId } = await cli_1.CliInternals.getCompositionWithDimensionOverride({
|
|
34
|
+
args,
|
|
35
|
+
compositionIdFromUi: null,
|
|
36
|
+
indent: false,
|
|
37
|
+
serveUrlOrWebpackUrl: serveUrl,
|
|
38
|
+
logLevel,
|
|
39
|
+
browserExecutable,
|
|
40
|
+
chromiumOptions,
|
|
41
|
+
envVariables,
|
|
42
|
+
inputProps,
|
|
43
|
+
port,
|
|
44
|
+
puppeteerInstance: undefined,
|
|
45
|
+
timeoutInMilliseconds: puppeteerTimeout,
|
|
46
|
+
height,
|
|
47
|
+
width,
|
|
48
|
+
server: await server,
|
|
49
|
+
});
|
|
50
|
+
composition = compositionId;
|
|
51
|
+
}
|
|
52
|
+
const { format: imageFormat, source: imageFormatReason } = cli_1.CliInternals.determineFinalStillImageFormat({
|
|
53
|
+
downloadName,
|
|
54
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
55
|
+
cliFlag: (_a = cli_1.CliInternals.parsedCli['image-format']) !== null && _a !== void 0 ? _a : null,
|
|
56
|
+
isLambda: true,
|
|
57
|
+
fromUi: null,
|
|
58
|
+
configImageFormat: (_b = config_1.ConfigInternals.getUserPreferredStillImageFormat()) !== null && _b !== void 0 ? _b : null,
|
|
59
|
+
});
|
|
60
|
+
log_1.Log.verbose(`Image format: (${imageFormat}), ${imageFormatReason}`);
|
|
61
|
+
// Todo: Check cloudRunUrl is valid, as the error message is obtuse
|
|
62
|
+
cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray(`
|
|
63
|
+
Cloud Run Service URL = ${cloudRunUrl}
|
|
64
|
+
Region = ${region}
|
|
65
|
+
Type = still
|
|
66
|
+
Composition = ${composition}
|
|
67
|
+
Output Bucket = ${forceBucketName}
|
|
68
|
+
Output File = ${outName !== null && outName !== void 0 ? outName : 'out.png'}
|
|
69
|
+
Output File Privacy = ${privacy}
|
|
70
|
+
${downloadName ? ` Downloaded File = ${downloadName}` : ''}
|
|
71
|
+
`.trim()));
|
|
72
|
+
log_1.Log.info();
|
|
73
|
+
const renderStart = Date.now();
|
|
74
|
+
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
75
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
76
|
+
cancelSignal: null,
|
|
77
|
+
updatesDontOverwrite: false,
|
|
78
|
+
indent: false,
|
|
79
|
+
});
|
|
80
|
+
let doneIn = null;
|
|
81
|
+
const updateProgress = (newline) => {
|
|
82
|
+
progressBar.update([
|
|
83
|
+
`Rendering on Cloud Run:`,
|
|
84
|
+
`${doneIn === null ? '...' : `Rendered in ${doneIn}ms`}`,
|
|
85
|
+
].join(' '), newline);
|
|
86
|
+
};
|
|
87
|
+
const res = await (0, render_still_on_cloudrun_1.renderStillOnCloudrun)({
|
|
88
|
+
cloudRunUrl,
|
|
89
|
+
serveUrl,
|
|
90
|
+
region,
|
|
91
|
+
inputProps,
|
|
92
|
+
imageFormat,
|
|
93
|
+
composition,
|
|
94
|
+
privacy,
|
|
95
|
+
envVariables,
|
|
96
|
+
frame: stillFrame,
|
|
97
|
+
jpegQuality,
|
|
98
|
+
chromiumOptions,
|
|
99
|
+
scale,
|
|
100
|
+
forceHeight: height,
|
|
101
|
+
forceWidth: width,
|
|
102
|
+
forceBucketName,
|
|
103
|
+
outName,
|
|
104
|
+
logLevel: config_1.ConfigInternals.Logging.getLogLevel(),
|
|
105
|
+
delayRenderTimeoutInMilliseconds: puppeteerTimeout,
|
|
106
|
+
});
|
|
107
|
+
doneIn = Date.now() - renderStart;
|
|
108
|
+
updateProgress(true);
|
|
109
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`Cloud Storage Uri = ${res.cloudStorageUri}`));
|
|
110
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`Render ID = ${res.renderId}`));
|
|
111
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`${Math.round(Number(res.size) / 1000)} KB, Privacy: ${res.privacy}, Bucket: ${res.bucketName}`));
|
|
112
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blue(`○ ${res.publicUrl}`));
|
|
113
|
+
if (downloadName) {
|
|
114
|
+
log_1.Log.info('');
|
|
115
|
+
log_1.Log.info('downloading file...');
|
|
116
|
+
const destination = await (0, download_file_1.downloadFile)({
|
|
117
|
+
bucketName: res.bucketName,
|
|
118
|
+
gsutilURI: res.cloudStorageUri,
|
|
119
|
+
downloadName,
|
|
120
|
+
});
|
|
121
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Downloaded file to ${destination}!`));
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
exports.stillCommand = stillCommand;
|
package/dist/cli/help.js
CHANGED
|
@@ -8,6 +8,7 @@ const regions_1 = require("./commands/regions");
|
|
|
8
8
|
const render_1 = require("./commands/render");
|
|
9
9
|
const services_1 = require("./commands/services");
|
|
10
10
|
const sites_1 = require("./commands/sites");
|
|
11
|
+
const still_1 = require("./commands/still");
|
|
11
12
|
const log_1 = require("./log");
|
|
12
13
|
const packagejson = require('../../package.json');
|
|
13
14
|
const printHelp = () => {
|
|
@@ -17,7 +18,10 @@ const printHelp = () => {
|
|
|
17
18
|
log_1.Log.info('');
|
|
18
19
|
log_1.Log.info();
|
|
19
20
|
log_1.Log.info(`${constants_1.BINARY_NAME} ${render_1.RENDER_COMMAND}`);
|
|
20
|
-
log_1.Log.info(cli_1.CliInternals.chalk.gray('Render Remotion media
|
|
21
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray('Render Remotion media on GCP Cloud Run.'));
|
|
22
|
+
log_1.Log.info();
|
|
23
|
+
log_1.Log.info(`${constants_1.BINARY_NAME} ${still_1.STILL_COMMAND}`);
|
|
24
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray('Render Remotion still on GCP Cloud Run.'));
|
|
21
25
|
log_1.Log.info();
|
|
22
26
|
log_1.Log.info(`${constants_1.BINARY_NAME} ${services_1.SERVICES_COMMAND}`);
|
|
23
27
|
log_1.Log.info(cli_1.CliInternals.chalk.gray('Deploy and manage Cloud Run services on GCP.'));
|
package/dist/cli/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const args_1 = require("./args");
|
|
|
5
5
|
const permissions_1 = require("./commands/permissions");
|
|
6
6
|
const regions_1 = require("./commands/regions");
|
|
7
7
|
const render_1 = require("./commands/render");
|
|
8
|
+
const still_1 = require("./commands/still");
|
|
8
9
|
const services_1 = require("./commands/services");
|
|
9
10
|
const sites_1 = require("./commands/sites");
|
|
10
11
|
const help_1 = require("./help");
|
|
@@ -18,6 +19,9 @@ const matchCommand = (args, remotionRoot) => {
|
|
|
18
19
|
if (args[0] === render_1.RENDER_COMMAND) {
|
|
19
20
|
return (0, render_1.renderCommand)(args.slice(1), remotionRoot);
|
|
20
21
|
}
|
|
22
|
+
if (args[0] === still_1.STILL_COMMAND) {
|
|
23
|
+
return (0, still_1.stillCommand)(args.slice(1), remotionRoot);
|
|
24
|
+
}
|
|
21
25
|
if (args[0] === services_1.SERVICES_COMMAND) {
|
|
22
26
|
return (0, services_1.servicesCommand)(args.slice(1));
|
|
23
27
|
}
|
package/dist/cli/log.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export declare const Log: {
|
|
|
5
5
|
logLevel: "error" | "verbose" | "info" | "warn";
|
|
6
6
|
} & {
|
|
7
7
|
tag?: string | undefined;
|
|
8
|
-
secondTag?: string | undefined;
|
|
9
8
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
10
9
|
info: (message?: any, ...optionalParams: any[]) => void;
|
|
11
10
|
infoAdvanced: (options: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCompositionFromBody: (serveUrl: string, compositionName: string) => Promise<import("remotion").AnyCompMetadata>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCompositionFromBody = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const getCompositionFromBody = async (serveUrl, compositionName) => {
|
|
6
|
+
const comps = await (0, renderer_1.getCompositions)(serveUrl);
|
|
7
|
+
const composition = comps.find((comp) => comp.id === compositionName);
|
|
8
|
+
if (composition) {
|
|
9
|
+
return composition;
|
|
10
|
+
}
|
|
11
|
+
throw new Error(`Composition not found: ${compositionName}`);
|
|
12
|
+
};
|
|
13
|
+
exports.getCompositionFromBody = getCompositionFromBody;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { File } from '@google-cloud/storage';
|
|
2
|
+
export declare type CloudrunLSInput = {
|
|
3
|
+
bucketName: string;
|
|
4
|
+
prefix: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type CloudrunLsReturnType = Promise<File[]>;
|
|
7
|
+
export declare const cloudrunLs: ({ bucketName, prefix, }: CloudrunLSInput) => CloudrunLsReturnType;
|
|
8
|
+
export declare const cloudrunDeleteFile: ({ bucketName, key, }: {
|
|
9
|
+
bucketName: string;
|
|
10
|
+
key: string;
|
|
11
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cloudrunDeleteFile = exports.cloudrunLs = void 0;
|
|
4
|
+
const get_cloud_storage_client_1 = require("../../api/helpers/get-cloud-storage-client");
|
|
5
|
+
const cloudrunLs = async ({ bucketName, prefix, }) => {
|
|
6
|
+
const cloudStorageClient = (0, get_cloud_storage_client_1.getCloudStorageClient)();
|
|
7
|
+
const [files] = await cloudStorageClient
|
|
8
|
+
.bucket(bucketName)
|
|
9
|
+
.getFiles({ prefix, autoPaginate: true });
|
|
10
|
+
return files;
|
|
11
|
+
};
|
|
12
|
+
exports.cloudrunLs = cloudrunLs;
|
|
13
|
+
const cloudrunDeleteFile = async ({ bucketName, key, }) => {
|
|
14
|
+
const cloudStorageClient = (0, get_cloud_storage_client_1.getCloudStorageClient)();
|
|
15
|
+
await cloudStorageClient.bucket(bucketName).file(key).delete();
|
|
16
|
+
};
|
|
17
|
+
exports.cloudrunDeleteFile = cloudrunDeleteFile;
|
|
@@ -0,0 +1,277 @@
|
|
|
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.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
10
|
+
jpegQuality: z.ZodNumber;
|
|
11
|
+
audioCodec: z.ZodNullable<z.ZodEnum<["pcm-16", "aac", "mp3", "opus"]>>;
|
|
12
|
+
audioBitrate: z.ZodNullable<z.ZodString>;
|
|
13
|
+
videoBitrate: z.ZodNullable<z.ZodString>;
|
|
14
|
+
crf: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
pixelFormat: z.ZodEnum<["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"]>;
|
|
16
|
+
imageFormat: z.ZodEnum<["png", "jpeg", "none"]>;
|
|
17
|
+
scale: z.ZodNumber;
|
|
18
|
+
proResProfile: z.ZodNullable<z.ZodEnum<["4444-xq", "4444", "hq", "standard", "light", "proxy"]>>;
|
|
19
|
+
everyNthFrame: z.ZodNumber;
|
|
20
|
+
numberOfGifLoops: z.ZodNullable<z.ZodNumber>;
|
|
21
|
+
frameRange: z.ZodNullable<z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodNumber]>>;
|
|
22
|
+
envVariables: 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.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
|
+
delayRenderTimeoutInMilliseconds: z.ZodNumber;
|
|
48
|
+
concurrency: z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
49
|
+
enforceAudioTrack: z.ZodBoolean;
|
|
50
|
+
preferLossless: z.ZodBoolean;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
serveUrl: string;
|
|
53
|
+
type: "media";
|
|
54
|
+
composition: string;
|
|
55
|
+
codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
56
|
+
inputProps: Record<string, unknown>;
|
|
57
|
+
jpegQuality: number;
|
|
58
|
+
audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
|
|
59
|
+
audioBitrate: string | null;
|
|
60
|
+
videoBitrate: string | null;
|
|
61
|
+
crf: number | null;
|
|
62
|
+
pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
63
|
+
imageFormat: "png" | "jpeg" | "none";
|
|
64
|
+
scale: number;
|
|
65
|
+
proResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | null;
|
|
66
|
+
everyNthFrame: number;
|
|
67
|
+
numberOfGifLoops: number | null;
|
|
68
|
+
frameRange: ((number | [number, number]) & (number | [number, number] | undefined)) | null;
|
|
69
|
+
envVariables: Record<string, string>;
|
|
70
|
+
muted: boolean;
|
|
71
|
+
outputBucket: string;
|
|
72
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
73
|
+
delayRenderTimeoutInMilliseconds: number;
|
|
74
|
+
concurrency: string | number | null;
|
|
75
|
+
enforceAudioTrack: boolean;
|
|
76
|
+
preferLossless: boolean;
|
|
77
|
+
forceHeight?: number | null | undefined;
|
|
78
|
+
forceWidth?: number | null | undefined;
|
|
79
|
+
chromiumOptions?: {
|
|
80
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
81
|
+
disableWebSecurity?: boolean | undefined;
|
|
82
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
83
|
+
headless?: boolean | undefined;
|
|
84
|
+
userAgent?: string | null | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
outName?: string | undefined;
|
|
87
|
+
privacy?: "public" | "private" | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
serveUrl: string;
|
|
90
|
+
type: "media";
|
|
91
|
+
composition: string;
|
|
92
|
+
codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
93
|
+
inputProps: Record<string, unknown>;
|
|
94
|
+
jpegQuality: number;
|
|
95
|
+
audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
|
|
96
|
+
audioBitrate: string | null;
|
|
97
|
+
videoBitrate: string | null;
|
|
98
|
+
crf: number | null;
|
|
99
|
+
pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
100
|
+
imageFormat: "png" | "jpeg" | "none";
|
|
101
|
+
scale: number;
|
|
102
|
+
proResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | null;
|
|
103
|
+
everyNthFrame: number;
|
|
104
|
+
numberOfGifLoops: number | null;
|
|
105
|
+
frameRange: ((number | [number, number]) & (number | [number, number] | undefined)) | null;
|
|
106
|
+
envVariables: Record<string, string>;
|
|
107
|
+
muted: boolean;
|
|
108
|
+
outputBucket: string;
|
|
109
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
110
|
+
delayRenderTimeoutInMilliseconds: number;
|
|
111
|
+
concurrency: string | number | null;
|
|
112
|
+
enforceAudioTrack: boolean;
|
|
113
|
+
preferLossless: boolean;
|
|
114
|
+
forceHeight?: number | null | undefined;
|
|
115
|
+
forceWidth?: number | null | undefined;
|
|
116
|
+
chromiumOptions?: {
|
|
117
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
118
|
+
disableWebSecurity?: boolean | undefined;
|
|
119
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
120
|
+
headless?: boolean | undefined;
|
|
121
|
+
userAgent?: string | null | undefined;
|
|
122
|
+
} | undefined;
|
|
123
|
+
outName?: string | undefined;
|
|
124
|
+
privacy?: "public" | "private" | undefined;
|
|
125
|
+
}>, z.ZodObject<{
|
|
126
|
+
type: z.ZodLiteral<"still">;
|
|
127
|
+
serveUrl: z.ZodString;
|
|
128
|
+
composition: z.ZodString;
|
|
129
|
+
forceHeight: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
130
|
+
forceWidth: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
131
|
+
inputProps: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
132
|
+
jpegQuality: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
imageFormat: z.ZodEnum<["png", "jpeg", "pdf", "webp"]>;
|
|
134
|
+
scale: z.ZodNumber;
|
|
135
|
+
privacy: z.ZodEnum<["public", "private"]>;
|
|
136
|
+
envVariables: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
137
|
+
chromiumOptions: z.ZodOptional<z.ZodObject<{
|
|
138
|
+
ignoreCertificateErrors: z.ZodOptional<z.ZodBoolean>;
|
|
139
|
+
disableWebSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
+
gl: z.ZodNullable<z.ZodOptional<z.ZodEnum<["swangle", "angle", "egl", "swiftshader"]>>>;
|
|
141
|
+
headless: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
userAgent: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
143
|
+
}, "strip", z.ZodTypeAny, {
|
|
144
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
145
|
+
disableWebSecurity?: boolean | undefined;
|
|
146
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
147
|
+
headless?: boolean | undefined;
|
|
148
|
+
userAgent?: string | null | undefined;
|
|
149
|
+
}, {
|
|
150
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
151
|
+
disableWebSecurity?: boolean | undefined;
|
|
152
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
153
|
+
headless?: boolean | undefined;
|
|
154
|
+
userAgent?: string | null | undefined;
|
|
155
|
+
}>>;
|
|
156
|
+
outputBucket: z.ZodString;
|
|
157
|
+
outName: z.ZodOptional<z.ZodString>;
|
|
158
|
+
frame: z.ZodNumber;
|
|
159
|
+
delayRenderTimeoutInMilliseconds: z.ZodNumber;
|
|
160
|
+
logLevel: z.ZodEnum<["verbose", "info", "warn", "error"]>;
|
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
|
162
|
+
serveUrl: string;
|
|
163
|
+
type: "still";
|
|
164
|
+
composition: string;
|
|
165
|
+
inputProps: Record<string, unknown>;
|
|
166
|
+
imageFormat: "png" | "jpeg" | "pdf" | "webp";
|
|
167
|
+
scale: number;
|
|
168
|
+
envVariables: Record<string, string>;
|
|
169
|
+
outputBucket: string;
|
|
170
|
+
privacy: "public" | "private";
|
|
171
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
172
|
+
delayRenderTimeoutInMilliseconds: number;
|
|
173
|
+
frame: number;
|
|
174
|
+
forceHeight?: number | null | undefined;
|
|
175
|
+
forceWidth?: number | null | undefined;
|
|
176
|
+
jpegQuality?: number | undefined;
|
|
177
|
+
chromiumOptions?: {
|
|
178
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
179
|
+
disableWebSecurity?: boolean | undefined;
|
|
180
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
181
|
+
headless?: boolean | undefined;
|
|
182
|
+
userAgent?: string | null | undefined;
|
|
183
|
+
} | undefined;
|
|
184
|
+
outName?: string | undefined;
|
|
185
|
+
}, {
|
|
186
|
+
serveUrl: string;
|
|
187
|
+
type: "still";
|
|
188
|
+
composition: string;
|
|
189
|
+
inputProps: Record<string, unknown>;
|
|
190
|
+
imageFormat: "png" | "jpeg" | "pdf" | "webp";
|
|
191
|
+
scale: number;
|
|
192
|
+
envVariables: Record<string, string>;
|
|
193
|
+
outputBucket: string;
|
|
194
|
+
privacy: "public" | "private";
|
|
195
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
196
|
+
delayRenderTimeoutInMilliseconds: number;
|
|
197
|
+
frame: number;
|
|
198
|
+
forceHeight?: number | null | undefined;
|
|
199
|
+
forceWidth?: number | null | undefined;
|
|
200
|
+
jpegQuality?: number | undefined;
|
|
201
|
+
chromiumOptions?: {
|
|
202
|
+
ignoreCertificateErrors?: boolean | undefined;
|
|
203
|
+
disableWebSecurity?: boolean | undefined;
|
|
204
|
+
gl?: "swangle" | "angle" | "egl" | "swiftshader" | null | undefined;
|
|
205
|
+
headless?: boolean | undefined;
|
|
206
|
+
userAgent?: string | null | undefined;
|
|
207
|
+
} | undefined;
|
|
208
|
+
outName?: string | undefined;
|
|
209
|
+
}>]>;
|
|
210
|
+
declare const renderFailResponsePayload: z.ZodObject<{
|
|
211
|
+
status: z.ZodLiteral<"error">;
|
|
212
|
+
error: z.ZodString;
|
|
213
|
+
stack: z.ZodString;
|
|
214
|
+
}, "strip", z.ZodTypeAny, {
|
|
215
|
+
error: string;
|
|
216
|
+
status: "error";
|
|
217
|
+
stack: string;
|
|
218
|
+
}, {
|
|
219
|
+
error: string;
|
|
220
|
+
status: "error";
|
|
221
|
+
stack: string;
|
|
222
|
+
}>;
|
|
223
|
+
declare const renderStillOnCloudrunResponsePayload: z.ZodObject<{
|
|
224
|
+
publicUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
225
|
+
cloudStorageUri: z.ZodString;
|
|
226
|
+
size: z.ZodNumber;
|
|
227
|
+
bucketName: z.ZodString;
|
|
228
|
+
renderId: z.ZodString;
|
|
229
|
+
status: z.ZodLiteral<"success">;
|
|
230
|
+
privacy: z.ZodEnum<["public-read", "project-private"]>;
|
|
231
|
+
}, "strip", z.ZodTypeAny, {
|
|
232
|
+
bucketName: string;
|
|
233
|
+
size: number;
|
|
234
|
+
status: "success";
|
|
235
|
+
privacy: "public-read" | "project-private";
|
|
236
|
+
cloudStorageUri: string;
|
|
237
|
+
renderId: string;
|
|
238
|
+
publicUrl?: string | null | undefined;
|
|
239
|
+
}, {
|
|
240
|
+
bucketName: string;
|
|
241
|
+
size: number;
|
|
242
|
+
status: "success";
|
|
243
|
+
privacy: "public-read" | "project-private";
|
|
244
|
+
cloudStorageUri: string;
|
|
245
|
+
renderId: string;
|
|
246
|
+
publicUrl?: string | null | undefined;
|
|
247
|
+
}>;
|
|
248
|
+
declare const renderMediaOnCloudrunResponsePayload: z.ZodObject<{
|
|
249
|
+
publicUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
250
|
+
cloudStorageUri: z.ZodString;
|
|
251
|
+
size: z.ZodNumber;
|
|
252
|
+
bucketName: z.ZodString;
|
|
253
|
+
renderId: z.ZodString;
|
|
254
|
+
status: z.ZodLiteral<"success">;
|
|
255
|
+
privacy: z.ZodEnum<["public-read", "project-private"]>;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
bucketName: string;
|
|
258
|
+
size: number;
|
|
259
|
+
status: "success";
|
|
260
|
+
privacy: "public-read" | "project-private";
|
|
261
|
+
cloudStorageUri: string;
|
|
262
|
+
renderId: string;
|
|
263
|
+
publicUrl?: string | null | undefined;
|
|
264
|
+
}, {
|
|
265
|
+
bucketName: string;
|
|
266
|
+
size: number;
|
|
267
|
+
status: "success";
|
|
268
|
+
privacy: "public-read" | "project-private";
|
|
269
|
+
cloudStorageUri: string;
|
|
270
|
+
renderId: string;
|
|
271
|
+
publicUrl?: string | null | undefined;
|
|
272
|
+
}>;
|
|
273
|
+
export declare type CloudRunPayloadType = z.infer<typeof CloudRunPayload>;
|
|
274
|
+
export declare type RenderStillOnCloudrunOutput = z.infer<typeof renderStillOnCloudrunResponsePayload>;
|
|
275
|
+
export declare type RenderMediaOnCloudrunOutput = z.infer<typeof renderMediaOnCloudrunResponsePayload>;
|
|
276
|
+
export declare type ErrorResponsePayload = z.infer<typeof renderFailResponsePayload>;
|
|
277
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
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).nullable();
|
|
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()),
|
|
30
|
+
jpegQuality: zod_1.z.number(),
|
|
31
|
+
audioCodec: audioCodec.nullable(),
|
|
32
|
+
audioBitrate: zod_1.z.string().nullable(),
|
|
33
|
+
videoBitrate: zod_1.z.string().nullable(),
|
|
34
|
+
crf: zod_1.z.number().nullable(),
|
|
35
|
+
pixelFormat,
|
|
36
|
+
imageFormat: videoImageFormat,
|
|
37
|
+
scale: zod_1.z.number(),
|
|
38
|
+
proResProfile,
|
|
39
|
+
everyNthFrame: zod_1.z.number(),
|
|
40
|
+
numberOfGifLoops: zod_1.z.number().nullable(),
|
|
41
|
+
frameRange: zod_1.z.tuple([zod_1.z.number(), zod_1.z.number()]).or(zod_1.z.number()).nullable(),
|
|
42
|
+
envVariables: zod_1.z.record(zod_1.z.string()),
|
|
43
|
+
chromiumOptions: chromiumOptions.optional(),
|
|
44
|
+
muted: zod_1.z.boolean(),
|
|
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
|
+
delayRenderTimeoutInMilliseconds: zod_1.z.number(),
|
|
50
|
+
concurrency: zod_1.z.number().or(zod_1.z.string()).nullable(),
|
|
51
|
+
enforceAudioTrack: zod_1.z.boolean(),
|
|
52
|
+
preferLossless: zod_1.z.boolean(),
|
|
53
|
+
}),
|
|
54
|
+
zod_1.z.object({
|
|
55
|
+
type: zod_1.z.literal('still'),
|
|
56
|
+
serveUrl: zod_1.z.string(),
|
|
57
|
+
composition: zod_1.z.string(),
|
|
58
|
+
forceHeight: zod_1.z.number().optional().nullable(),
|
|
59
|
+
forceWidth: zod_1.z.number().optional().nullable(),
|
|
60
|
+
inputProps: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
61
|
+
jpegQuality: zod_1.z.number().optional(),
|
|
62
|
+
imageFormat: stillImageFormat,
|
|
63
|
+
scale: zod_1.z.number(),
|
|
64
|
+
privacy: zod_1.z.enum(['public', 'private']),
|
|
65
|
+
envVariables: zod_1.z.record(zod_1.z.string()),
|
|
66
|
+
chromiumOptions: chromiumOptions.optional(),
|
|
67
|
+
outputBucket: zod_1.z.string(),
|
|
68
|
+
outName: zod_1.z.string().optional(),
|
|
69
|
+
frame: zod_1.z.number(),
|
|
70
|
+
delayRenderTimeoutInMilliseconds: zod_1.z.number(),
|
|
71
|
+
logLevel,
|
|
72
|
+
}),
|
|
73
|
+
]);
|
|
74
|
+
const renderFailResponsePayload = zod_1.z.object({
|
|
75
|
+
status: zod_1.z.literal('error'),
|
|
76
|
+
error: zod_1.z.string(),
|
|
77
|
+
stack: zod_1.z.string(),
|
|
78
|
+
});
|
|
79
|
+
const renderStillOnCloudrunResponsePayload = zod_1.z.object({
|
|
80
|
+
publicUrl: zod_1.z.string().optional().nullable(),
|
|
81
|
+
cloudStorageUri: zod_1.z.string(),
|
|
82
|
+
size: zod_1.z.number(),
|
|
83
|
+
bucketName: zod_1.z.string(),
|
|
84
|
+
renderId: zod_1.z.string(),
|
|
85
|
+
status: zod_1.z.literal('success'),
|
|
86
|
+
privacy: zod_1.z.enum(['public-read', 'project-private']),
|
|
87
|
+
});
|
|
88
|
+
const renderMediaOnCloudrunResponsePayload = zod_1.z.object({
|
|
89
|
+
publicUrl: zod_1.z.string().optional().nullable(),
|
|
90
|
+
cloudStorageUri: zod_1.z.string(),
|
|
91
|
+
size: zod_1.z.number(),
|
|
92
|
+
bucketName: zod_1.z.string(),
|
|
93
|
+
renderId: zod_1.z.string(),
|
|
94
|
+
status: zod_1.z.literal('success'),
|
|
95
|
+
privacy: zod_1.z.enum(['public-read', 'project-private']),
|
|
96
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
try {
|
|
12
|
+
log_1.Log.info('renderOnCloudRun', req.body);
|
|
13
|
+
const body = payloads_1.CloudRunPayload.parse(req.body);
|
|
14
|
+
const renderType = body.type;
|
|
15
|
+
renderer_1.RenderInternals.setLogLevel(body.logLevel);
|
|
16
|
+
switch (renderType) {
|
|
17
|
+
case 'media':
|
|
18
|
+
await (0, render_media_single_thread_1.renderMediaSingleThread)(body, res);
|
|
19
|
+
break;
|
|
20
|
+
case 'still':
|
|
21
|
+
await (0, render_still_single_thread_1.renderStillSingleThread)(body, res);
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
res
|
|
25
|
+
.status(400)
|
|
26
|
+
.send('Invalid render type, must be either "media" or "still"');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
log_1.Log.error('Error while rendering', err);
|
|
31
|
+
const response = {
|
|
32
|
+
error: err.message,
|
|
33
|
+
status: 'error',
|
|
34
|
+
stack: (_a = err.stack) !== null && _a !== void 0 ? _a : '',
|
|
35
|
+
};
|
|
36
|
+
res.status(500).send(JSON.stringify(response));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.renderOnCloudRun = renderOnCloudRun;
|