@remotion/cloudrun 4.0.22 → 4.0.23
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/render-media-on-cloudrun.d.ts +4 -3
- package/dist/api/render-media-on-cloudrun.js +2 -1
- package/dist/api/render-still-on-cloudrun.d.ts +4 -3
- package/dist/api/render-still-on-cloudrun.js +2 -1
- package/dist/cli/commands/render/index.js +3 -1
- package/dist/cli/commands/render/renderMedia.d.ts +2 -0
- package/dist/cli/commands/render/renderMedia.js +156 -0
- package/dist/cli/commands/render/renderStill.d.ts +2 -0
- package/dist/cli/commands/render/renderStill.js +123 -0
- package/dist/cli/commands/still.js +3 -1
- package/dist/functions/helpers/get-composition-from-body.js +1 -0
- package/dist/functions/helpers/payloads.d.ts +10 -4
- package/dist/functions/helpers/payloads.js +2 -0
- package/dist/functions/render-media-single-thread.js +1 -0
- package/dist/functions/render-still-single-thread.js +1 -0
- package/dist/shared/read-dir.js +4 -2
- package/package.json +7 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
> @remotion/cloudrun@4.0.
|
|
2
|
+
> @remotion/cloudrun@4.0.22 build /Users/jonathanburger/remotion-v4/packages/cloudrun
|
|
3
3
|
> tsc -d && cp src/shared/sa-permissions.json dist/shared/sa-permissions.json && pnpm run buildContainer && pnpm run tarInstaller
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @remotion/cloudrun@4.0.
|
|
6
|
+
> @remotion/cloudrun@4.0.22 buildContainer /Users/jonathanburger/remotion-v4/packages/cloudrun
|
|
7
7
|
> ts-node src/admin/bundle-renderLogic.ts
|
|
8
8
|
|
|
9
9
|
distribution bundled.
|
|
10
10
|
|
|
11
|
-
> @remotion/cloudrun@4.0.
|
|
11
|
+
> @remotion/cloudrun@4.0.22 tarInstaller /Users/jonathanburger/remotion-v4/packages/cloudrun
|
|
12
12
|
> ts-node src/admin/bundle-installer.ts
|
|
13
13
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AudioCodec, ChromiumOptions, FrameRange, LogLevel, PixelFormat, ProResProfile, VideoImageFormat, X264Preset } from '@remotion/renderer';
|
|
1
|
+
import type { AudioCodec, ChromiumOptions, FrameRange, LogLevel, PixelFormat, ProResProfile, ToOptions, VideoImageFormat, X264Preset } from '@remotion/renderer';
|
|
2
|
+
import type { BrowserSafeApis } from '@remotion/renderer/client';
|
|
2
3
|
import type { CloudRunCrashResponse, RenderMediaOnCloudrunOutput } from '../functions/helpers/payloads';
|
|
3
4
|
import type { GcpRegion } from '../pricing/gcp-regions';
|
|
4
5
|
import type { CloudrunCodec } from '../shared/validate-gcp-codec';
|
|
@@ -37,7 +38,7 @@ export type RenderMediaOnCloudrunInput = {
|
|
|
37
38
|
concurrency?: number | string | null;
|
|
38
39
|
enforceAudioTrack?: boolean;
|
|
39
40
|
preferLossless?: boolean;
|
|
40
|
-
}
|
|
41
|
+
} & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
|
|
41
42
|
/**
|
|
42
43
|
* @description Triggers a render on a GCP Cloud Run service given a composition and a Cloud Run URL.
|
|
43
44
|
* @see [Documentation](https://remotion.dev/docs/cloudrun/renderMediaOnGcp)
|
|
@@ -77,4 +78,4 @@ export type RenderMediaOnCloudrunInput = {
|
|
|
77
78
|
* @param params.preferLossless Uses a lossless audio codec, if one is available for the codec. If you set audioCodec, it takes priority over preferLossless.
|
|
78
79
|
* @returns {Promise<RenderMediaOnCloudrunOutput>} See documentation for detailed structure
|
|
79
80
|
*/
|
|
80
|
-
export declare const renderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, }: RenderMediaOnCloudrunInput) => Promise<RenderMediaOnCloudrunOutput | CloudRunCrashResponse>;
|
|
81
|
+
export declare const renderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, }: RenderMediaOnCloudrunInput) => Promise<RenderMediaOnCloudrunOutput | CloudRunCrashResponse>;
|
|
@@ -48,7 +48,7 @@ const get_cloudrun_endpoint_1 = require("./helpers/get-cloudrun-endpoint");
|
|
|
48
48
|
* @param params.preferLossless Uses a lossless audio codec, if one is available for the codec. If you set audioCodec, it takes priority over preferLossless.
|
|
49
49
|
* @returns {Promise<RenderMediaOnCloudrunOutput>} See documentation for detailed structure
|
|
50
50
|
*/
|
|
51
|
-
const renderMediaOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, }) => {
|
|
51
|
+
const renderMediaOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, }) => {
|
|
52
52
|
const actualCodec = (0, validate_gcp_codec_1.validateCloudrunCodec)(codec);
|
|
53
53
|
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
54
54
|
if (privacy)
|
|
@@ -95,6 +95,7 @@ const renderMediaOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUr
|
|
|
95
95
|
concurrency: concurrency !== null && concurrency !== void 0 ? concurrency : null,
|
|
96
96
|
enforceAudioTrack: enforceAudioTrack !== null && enforceAudioTrack !== void 0 ? enforceAudioTrack : false,
|
|
97
97
|
preferLossless: preferLossless !== null && preferLossless !== void 0 ? preferLossless : false,
|
|
98
|
+
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
|
|
98
99
|
};
|
|
99
100
|
const client = await (0, get_auth_client_for_url_1.getAuthClientForUrl)(cloudRunEndpoint);
|
|
100
101
|
const postResponse = await client.request({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ChromiumOptions, LogLevel, StillImageFormat } from '@remotion/renderer';
|
|
1
|
+
import type { ChromiumOptions, LogLevel, StillImageFormat, ToOptions } from '@remotion/renderer';
|
|
2
|
+
import type { BrowserSafeApis } from '@remotion/renderer/client';
|
|
2
3
|
import type { CloudRunCrashResponse, ErrorResponsePayload, RenderStillOnCloudrunOutput } from '../functions/helpers/payloads';
|
|
3
4
|
import type { GcpRegion } from '../pricing/gcp-regions';
|
|
4
5
|
export type RenderStillOnCloudrunInput = {
|
|
@@ -21,7 +22,7 @@ export type RenderStillOnCloudrunInput = {
|
|
|
21
22
|
forceHeight?: number | null;
|
|
22
23
|
logLevel?: LogLevel;
|
|
23
24
|
delayRenderTimeoutInMilliseconds?: number;
|
|
24
|
-
}
|
|
25
|
+
} & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
|
|
25
26
|
/**
|
|
26
27
|
* @description Triggers a render on a GCP Cloud Run service given a composition and a Cloud Run URL.
|
|
27
28
|
* @see [Documentation](https://remotion.dev/docs/cloudrun/renderstilloncloudrun)
|
|
@@ -46,4 +47,4 @@ export type RenderStillOnCloudrunInput = {
|
|
|
46
47
|
* @param params.delayRenderTimeoutInMilliseconds A number describing how long the render may take to resolve all delayRender() calls before it times out.
|
|
47
48
|
* @returns {Promise<RenderStillOnCloudrunOutput>} See documentation for detailed structure
|
|
48
49
|
*/
|
|
49
|
-
export declare const renderStillOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, forceBucketName, privacy, outName, imageFormat, envVariables, frame, jpegQuality, chromiumOptions, scale, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, }: RenderStillOnCloudrunInput) => Promise<RenderStillOnCloudrunOutput | ErrorResponsePayload | CloudRunCrashResponse>;
|
|
50
|
+
export declare const renderStillOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, forceBucketName, privacy, outName, imageFormat, envVariables, frame, jpegQuality, chromiumOptions, scale, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, offthreadVideoCacheSizeInBytes, }: RenderStillOnCloudrunInput) => Promise<RenderStillOnCloudrunOutput | ErrorResponsePayload | CloudRunCrashResponse>;
|
|
@@ -32,7 +32,7 @@ const get_cloudrun_endpoint_1 = require("./helpers/get-cloudrun-endpoint");
|
|
|
32
32
|
* @param params.delayRenderTimeoutInMilliseconds A number describing how long the render may take to resolve all delayRender() calls before it times out.
|
|
33
33
|
* @returns {Promise<RenderStillOnCloudrunOutput>} See documentation for detailed structure
|
|
34
34
|
*/
|
|
35
|
-
const renderStillOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, forceBucketName, privacy, outName, imageFormat, envVariables, frame, jpegQuality, chromiumOptions, scale, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, }) => {
|
|
35
|
+
const renderStillOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, forceBucketName, privacy, outName, imageFormat, envVariables, frame, jpegQuality, chromiumOptions, scale, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, offthreadVideoCacheSizeInBytes, }) => {
|
|
36
36
|
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
37
37
|
if (privacy)
|
|
38
38
|
(0, validate_privacy_1.validatePrivacy)(privacy);
|
|
@@ -64,6 +64,7 @@ const renderStillOnCloudrun = async ({ cloudRunUrl, serviceName, region, serveUr
|
|
|
64
64
|
type: 'still',
|
|
65
65
|
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
|
|
66
66
|
delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds !== null && delayRenderTimeoutInMilliseconds !== void 0 ? delayRenderTimeoutInMilliseconds : renderer_1.RenderInternals.DEFAULT_TIMEOUT,
|
|
67
|
+
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
|
|
67
68
|
};
|
|
68
69
|
const client = await (0, get_auth_client_for_url_1.getAuthClientForUrl)(cloudRunEndpoint);
|
|
69
70
|
const postResponse = await client.request({
|
|
@@ -25,7 +25,7 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
25
25
|
});
|
|
26
26
|
const imageFormat = args_1.parsedCloudrunCli['image-format'];
|
|
27
27
|
const audioCodec = args_1.parsedCloudrunCli['audio-codec'];
|
|
28
|
-
const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, puppeteerTimeout, pixelFormat, proResProfile, jpegQuality, scale, everyNthFrame, numberOfGifLoops, muted, audioBitrate, videoBitrate, height, width, browserExecutable, port, enforceAudioTrack, } = await cli_1.CliInternals.getCliOptions({
|
|
28
|
+
const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, puppeteerTimeout, pixelFormat, proResProfile, jpegQuality, scale, everyNthFrame, numberOfGifLoops, muted, audioBitrate, videoBitrate, height, width, browserExecutable, port, enforceAudioTrack, offthreadVideoCacheSizeInBytes, } = await cli_1.CliInternals.getCliOptions({
|
|
29
29
|
type: 'series',
|
|
30
30
|
isLambda: true,
|
|
31
31
|
remotionRoot,
|
|
@@ -44,6 +44,7 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
44
44
|
remotionRoot,
|
|
45
45
|
logLevel,
|
|
46
46
|
webpackConfigOrServeUrl: serveUrl,
|
|
47
|
+
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
|
|
47
48
|
});
|
|
48
49
|
const { compositionId } = await cli_1.CliInternals.getCompositionWithDimensionOverride({
|
|
49
50
|
args: args.slice(1),
|
|
@@ -65,6 +66,7 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
65
66
|
indent: undefined,
|
|
66
67
|
staticBase: null,
|
|
67
68
|
}).serializedString,
|
|
69
|
+
offthreadVideoCacheSizeInBytes,
|
|
68
70
|
});
|
|
69
71
|
composition = compositionId;
|
|
70
72
|
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderMediaSubcommand = exports.RENDER_MEDIA_SUBCOMMAND = void 0;
|
|
4
|
+
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const render_media_on_cloudrun_1 = require("../../../api/render-media-on-cloudrun");
|
|
6
|
+
// import {validateMaxRetries} from '../../../shared/validate-retries';
|
|
7
|
+
const config_1 = require("@remotion/cli/config");
|
|
8
|
+
const renderer_1 = require("@remotion/renderer");
|
|
9
|
+
const download_file_1 = require("../../../api/download-file");
|
|
10
|
+
const validate_serveurl_1 = require("../../../shared/validate-serveurl");
|
|
11
|
+
const args_1 = require("../../args");
|
|
12
|
+
const log_1 = require("../../log");
|
|
13
|
+
const renderArgsCheck_1 = require("./helpers/renderArgsCheck");
|
|
14
|
+
exports.RENDER_MEDIA_SUBCOMMAND = 'media';
|
|
15
|
+
const renderMediaSubcommand = async (args, remotionRoot) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const { serveUrl, cloudRunUrl, outName, forceBucketName, downloadName, privacy, region, } = await (0, renderArgsCheck_1.renderArgsCheck)(exports.RENDER_MEDIA_SUBCOMMAND, args);
|
|
18
|
+
const { codec, reason: codecReason } = cli_1.CliInternals.getFinalOutputCodec({
|
|
19
|
+
cliFlag: cli_1.CliInternals.parsedCli.codec,
|
|
20
|
+
downloadName,
|
|
21
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
22
|
+
configFile: (_a = config_1.ConfigInternals.getOutputCodecOrUndefined()) !== null && _a !== void 0 ? _a : null,
|
|
23
|
+
uiCodec: null,
|
|
24
|
+
});
|
|
25
|
+
const imageFormat = args_1.parsedCloudrunCli['image-format'];
|
|
26
|
+
const audioCodec = args_1.parsedCloudrunCli['audio-codec'];
|
|
27
|
+
const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, puppeteerTimeout, pixelFormat, proResProfile, jpegQuality, scale, everyNthFrame, numberOfGifLoops, muted, audioBitrate, videoBitrate, height, width, browserExecutable, port, } = await cli_1.CliInternals.getCliOptions({
|
|
28
|
+
type: 'series',
|
|
29
|
+
isLambda: true,
|
|
30
|
+
remotionRoot,
|
|
31
|
+
});
|
|
32
|
+
let composition = args[1];
|
|
33
|
+
if (!composition) {
|
|
34
|
+
log_1.Log.info('No compositions passed. Fetching compositions...');
|
|
35
|
+
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
36
|
+
const server = renderer_1.RenderInternals.prepareServer({
|
|
37
|
+
concurrency: 1,
|
|
38
|
+
indent: false,
|
|
39
|
+
port,
|
|
40
|
+
remotionRoot,
|
|
41
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
|
|
42
|
+
webpackConfigOrServeUrl: serveUrl,
|
|
43
|
+
});
|
|
44
|
+
const { compositionId } = await cli_1.CliInternals.getCompositionWithDimensionOverride({
|
|
45
|
+
args,
|
|
46
|
+
compositionIdFromUi: null,
|
|
47
|
+
browserExecutable,
|
|
48
|
+
chromiumOptions,
|
|
49
|
+
envVariables,
|
|
50
|
+
height,
|
|
51
|
+
indent: false,
|
|
52
|
+
inputProps,
|
|
53
|
+
port,
|
|
54
|
+
puppeteerInstance: undefined,
|
|
55
|
+
serveUrlOrWebpackUrl: serveUrl,
|
|
56
|
+
timeoutInMilliseconds: puppeteerTimeout,
|
|
57
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
|
|
58
|
+
width,
|
|
59
|
+
server: await server,
|
|
60
|
+
});
|
|
61
|
+
composition = compositionId;
|
|
62
|
+
}
|
|
63
|
+
// Todo: Check cloudRunUrl is valid, as the error message is obtuse
|
|
64
|
+
cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray(`
|
|
65
|
+
Cloud Run Service URL = ${cloudRunUrl}
|
|
66
|
+
Region = ${region}
|
|
67
|
+
Type = media
|
|
68
|
+
Composition = ${composition}
|
|
69
|
+
Codec = ${codec}
|
|
70
|
+
Output Bucket = ${forceBucketName}
|
|
71
|
+
Output File = ${outName !== null && outName !== void 0 ? outName : 'out.mp4'}
|
|
72
|
+
Output File Privacy = ${privacy}
|
|
73
|
+
${downloadName ? ` Downloaded File = ${downloadName}` : ''}
|
|
74
|
+
`.trim()));
|
|
75
|
+
log_1.Log.info();
|
|
76
|
+
const renderStart = Date.now();
|
|
77
|
+
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
78
|
+
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
79
|
+
cancelSignal: null,
|
|
80
|
+
updatesDontOverwrite: false,
|
|
81
|
+
indent: false,
|
|
82
|
+
});
|
|
83
|
+
const renderProgress = {
|
|
84
|
+
doneIn: null,
|
|
85
|
+
progress: 0,
|
|
86
|
+
};
|
|
87
|
+
const updateProgress = () => {
|
|
88
|
+
progressBar.update([
|
|
89
|
+
`Rendering on Cloud Run: `,
|
|
90
|
+
cli_1.CliInternals.makeProgressBar(renderProgress.progress),
|
|
91
|
+
`${renderProgress.doneIn === null ? 'Rendering' : 'Rendered'}`,
|
|
92
|
+
renderProgress.doneIn === null
|
|
93
|
+
? `${Math.round(renderProgress.progress * 100)}%`
|
|
94
|
+
: cli_1.CliInternals.chalk.gray(`${renderProgress.doneIn}ms`),
|
|
95
|
+
].join(' '), false);
|
|
96
|
+
};
|
|
97
|
+
const updateRenderProgress = (progress) => {
|
|
98
|
+
renderProgress.progress = progress;
|
|
99
|
+
updateProgress();
|
|
100
|
+
};
|
|
101
|
+
const res = await (0, render_media_on_cloudrun_1.renderMediaOnCloudrun)({
|
|
102
|
+
cloudRunUrl,
|
|
103
|
+
serveUrl,
|
|
104
|
+
region,
|
|
105
|
+
inputProps,
|
|
106
|
+
codec: codec,
|
|
107
|
+
imageFormat,
|
|
108
|
+
crf: crf !== null && crf !== void 0 ? crf : undefined,
|
|
109
|
+
envVariables,
|
|
110
|
+
pixelFormat,
|
|
111
|
+
proResProfile,
|
|
112
|
+
jpegQuality,
|
|
113
|
+
composition,
|
|
114
|
+
privacy,
|
|
115
|
+
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : undefined,
|
|
116
|
+
outName,
|
|
117
|
+
chromiumOptions,
|
|
118
|
+
scale,
|
|
119
|
+
numberOfGifLoops,
|
|
120
|
+
everyNthFrame,
|
|
121
|
+
muted,
|
|
122
|
+
audioBitrate,
|
|
123
|
+
videoBitrate,
|
|
124
|
+
forceHeight: height,
|
|
125
|
+
forceWidth: width,
|
|
126
|
+
audioCodec,
|
|
127
|
+
forceBucketName,
|
|
128
|
+
updateRenderProgress,
|
|
129
|
+
logLevel: config_1.ConfigInternals.Logging.getLogLevel(),
|
|
130
|
+
});
|
|
131
|
+
renderProgress.doneIn = Date.now() - renderStart;
|
|
132
|
+
updateProgress();
|
|
133
|
+
log_1.Log.info(`
|
|
134
|
+
|
|
135
|
+
`);
|
|
136
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`
|
|
137
|
+
${res.publicUrl ? `Public URL = ${decodeURIComponent(res.publicUrl)}` : ``}
|
|
138
|
+
Cloud Storage Uri = ${res.cloudStorageUri}
|
|
139
|
+
Size (KB) = ${Math.round(Number(res.size) / 1000)}
|
|
140
|
+
Bucket Name = ${res.bucketName}
|
|
141
|
+
Privacy = ${res.privacy}
|
|
142
|
+
Render ID = ${res.renderId}
|
|
143
|
+
Codec = ${codec} (${codecReason})
|
|
144
|
+
`.trim()));
|
|
145
|
+
if (downloadName) {
|
|
146
|
+
log_1.Log.info('');
|
|
147
|
+
log_1.Log.info('downloading file...');
|
|
148
|
+
const destination = await (0, download_file_1.downloadFile)({
|
|
149
|
+
bucketName: res.bucketName,
|
|
150
|
+
gsutilURI: res.cloudStorageUri,
|
|
151
|
+
downloadName,
|
|
152
|
+
});
|
|
153
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Downloaded file to ${destination}!`));
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
exports.renderMediaSubcommand = renderMediaSubcommand;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderStillSubcommand = exports.RENDER_STILL_SUBCOMMAND = 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("./helpers/renderArgsCheck");
|
|
12
|
+
exports.RENDER_STILL_SUBCOMMAND = 'still';
|
|
13
|
+
const renderStillSubcommand = async (args, remotionRoot) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const { serveUrl, cloudRunUrl, outName, forceBucketName, privacy, downloadName, region, } = await (0, renderArgsCheck_1.renderArgsCheck)(exports.RENDER_STILL_SUBCOMMAND, args);
|
|
16
|
+
const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, jpegQuality, stillFrame, scale, height, width, browserExecutable, port, } = 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
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
|
|
31
|
+
webpackConfigOrServeUrl: serveUrl,
|
|
32
|
+
});
|
|
33
|
+
const { compositionId } = await cli_1.CliInternals.getCompositionWithDimensionOverride({
|
|
34
|
+
args,
|
|
35
|
+
compositionIdFromUi: null,
|
|
36
|
+
indent: false,
|
|
37
|
+
serveUrlOrWebpackUrl: serveUrl,
|
|
38
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
|
|
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
|
+
});
|
|
106
|
+
doneIn = Date.now() - renderStart;
|
|
107
|
+
updateProgress(true);
|
|
108
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`Cloud Storage Uri = ${res.cloudStorageUri}`));
|
|
109
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`Render ID = ${res.renderId}`));
|
|
110
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`${Math.round(Number(res.size) / 1000)} KB, Privacy: ${res.privacy}, Bucket: ${res.bucketName}`));
|
|
111
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blue(`○ ${res.publicUrl}`));
|
|
112
|
+
if (downloadName) {
|
|
113
|
+
log_1.Log.info('');
|
|
114
|
+
log_1.Log.info('downloading file...');
|
|
115
|
+
const destination = await (0, download_file_1.downloadFile)({
|
|
116
|
+
bucketName: res.bucketName,
|
|
117
|
+
gsutilURI: res.cloudStorageUri,
|
|
118
|
+
downloadName,
|
|
119
|
+
});
|
|
120
|
+
log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Downloaded file to ${destination}!`));
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
exports.renderStillSubcommand = renderStillSubcommand;
|
|
@@ -15,7 +15,7 @@ exports.STILL_COMMAND = 'still';
|
|
|
15
15
|
const stillCommand = async (args, remotionRoot) => {
|
|
16
16
|
var _a, _b;
|
|
17
17
|
const { serveUrl, cloudRunUrl, outName, forceBucketName, privacy, downloadName, region, } = await (0, renderArgsCheck_1.renderArgsCheck)(exports.STILL_COMMAND, args);
|
|
18
|
-
const { chromiumOptions, envVariables, inputProps, puppeteerTimeout, jpegQuality, stillFrame, scale, height, width, browserExecutable, port, logLevel, } = await cli_1.CliInternals.getCliOptions({
|
|
18
|
+
const { chromiumOptions, envVariables, inputProps, puppeteerTimeout, jpegQuality, stillFrame, scale, height, width, browserExecutable, port, logLevel, offthreadVideoCacheSizeInBytes, } = await cli_1.CliInternals.getCliOptions({
|
|
19
19
|
type: 'still',
|
|
20
20
|
isLambda: true,
|
|
21
21
|
remotionRoot,
|
|
@@ -34,6 +34,7 @@ const stillCommand = async (args, remotionRoot) => {
|
|
|
34
34
|
remotionRoot,
|
|
35
35
|
logLevel,
|
|
36
36
|
webpackConfigOrServeUrl: serveUrl,
|
|
37
|
+
offthreadVideoCacheSizeInBytes,
|
|
37
38
|
});
|
|
38
39
|
const { compositionId } = await cli_1.CliInternals.getCompositionWithDimensionOverride({
|
|
39
40
|
args: args.slice(1),
|
|
@@ -55,6 +56,7 @@ const stillCommand = async (args, remotionRoot) => {
|
|
|
55
56
|
height,
|
|
56
57
|
width,
|
|
57
58
|
server: await server,
|
|
59
|
+
offthreadVideoCacheSizeInBytes,
|
|
58
60
|
});
|
|
59
61
|
composition = compositionId;
|
|
60
62
|
}
|
|
@@ -18,6 +18,7 @@ const getCompositionFromBody = async (body) => {
|
|
|
18
18
|
puppeteerInstance: undefined,
|
|
19
19
|
server: undefined,
|
|
20
20
|
timeoutInMilliseconds: body.delayRenderTimeoutInMilliseconds,
|
|
21
|
+
offthreadVideoCacheSizeInBytes: body.offthreadVideoCacheSizeInBytes,
|
|
21
22
|
});
|
|
22
23
|
if (propsSize > 10000000) {
|
|
23
24
|
renderer_1.RenderInternals.Log.warn(`The props of your composition are large (${propsSize} bytes). This may cause slowdown.`);
|
|
@@ -49,6 +49,7 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
49
49
|
concurrency: z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
50
50
|
enforceAudioTrack: z.ZodBoolean;
|
|
51
51
|
preferLossless: z.ZodBoolean;
|
|
52
|
+
offthreadVideoCacheSizeInBytes: z.ZodNullable<z.ZodNumber>;
|
|
52
53
|
}, "strip", z.ZodTypeAny, {
|
|
53
54
|
type: "media";
|
|
54
55
|
serveUrl: string;
|
|
@@ -76,6 +77,7 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
76
77
|
concurrency: string | number | null;
|
|
77
78
|
enforceAudioTrack: boolean;
|
|
78
79
|
preferLossless: boolean;
|
|
80
|
+
offthreadVideoCacheSizeInBytes: number | null;
|
|
79
81
|
forceHeight?: number | null | undefined;
|
|
80
82
|
forceWidth?: number | null | undefined;
|
|
81
83
|
chromiumOptions?: {
|
|
@@ -114,6 +116,7 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
114
116
|
concurrency: string | number | null;
|
|
115
117
|
enforceAudioTrack: boolean;
|
|
116
118
|
preferLossless: boolean;
|
|
119
|
+
offthreadVideoCacheSizeInBytes: number | null;
|
|
117
120
|
forceHeight?: number | null | undefined;
|
|
118
121
|
forceWidth?: number | null | undefined;
|
|
119
122
|
chromiumOptions?: {
|
|
@@ -161,6 +164,7 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
161
164
|
frame: z.ZodNumber;
|
|
162
165
|
delayRenderTimeoutInMilliseconds: z.ZodNumber;
|
|
163
166
|
logLevel: z.ZodEnum<["verbose", "info", "warn", "error"]>;
|
|
167
|
+
offthreadVideoCacheSizeInBytes: z.ZodNullable<z.ZodNumber>;
|
|
164
168
|
}, "strip", z.ZodTypeAny, {
|
|
165
169
|
type: "still";
|
|
166
170
|
serveUrl: string;
|
|
@@ -173,6 +177,7 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
173
177
|
privacy: "public" | "private";
|
|
174
178
|
logLevel: "error" | "verbose" | "info" | "warn";
|
|
175
179
|
delayRenderTimeoutInMilliseconds: number;
|
|
180
|
+
offthreadVideoCacheSizeInBytes: number | null;
|
|
176
181
|
frame: number;
|
|
177
182
|
forceHeight?: number | null | undefined;
|
|
178
183
|
forceWidth?: number | null | undefined;
|
|
@@ -197,6 +202,7 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
197
202
|
privacy: "public" | "private";
|
|
198
203
|
logLevel: "error" | "verbose" | "info" | "warn";
|
|
199
204
|
delayRenderTimeoutInMilliseconds: number;
|
|
205
|
+
offthreadVideoCacheSizeInBytes: number | null;
|
|
200
206
|
frame: number;
|
|
201
207
|
forceHeight?: number | null | undefined;
|
|
202
208
|
forceWidth?: number | null | undefined;
|
|
@@ -235,19 +241,19 @@ declare const renderStillOnCloudrunResponsePayload: z.ZodObject<{
|
|
|
235
241
|
renderId: z.ZodString;
|
|
236
242
|
privacy: z.ZodEnum<["public-read", "project-private"]>;
|
|
237
243
|
}, "strip", z.ZodTypeAny, {
|
|
244
|
+
bucketName: string;
|
|
238
245
|
type: "success";
|
|
239
246
|
privacy: "public-read" | "project-private";
|
|
240
247
|
cloudStorageUri: string;
|
|
241
248
|
size: number;
|
|
242
|
-
bucketName: string;
|
|
243
249
|
renderId: string;
|
|
244
250
|
publicUrl?: string | null | undefined;
|
|
245
251
|
}, {
|
|
252
|
+
bucketName: string;
|
|
246
253
|
type: "success";
|
|
247
254
|
privacy: "public-read" | "project-private";
|
|
248
255
|
cloudStorageUri: string;
|
|
249
256
|
size: number;
|
|
250
|
-
bucketName: string;
|
|
251
257
|
renderId: string;
|
|
252
258
|
publicUrl?: string | null | undefined;
|
|
253
259
|
}>;
|
|
@@ -260,19 +266,19 @@ declare const renderMediaOnCloudrunResponsePayload: z.ZodObject<{
|
|
|
260
266
|
renderId: z.ZodString;
|
|
261
267
|
privacy: z.ZodEnum<["public-read", "project-private"]>;
|
|
262
268
|
}, "strip", z.ZodTypeAny, {
|
|
269
|
+
bucketName: string;
|
|
263
270
|
type: "success";
|
|
264
271
|
privacy: "public-read" | "project-private";
|
|
265
272
|
cloudStorageUri: string;
|
|
266
273
|
size: number;
|
|
267
|
-
bucketName: string;
|
|
268
274
|
renderId: string;
|
|
269
275
|
publicUrl?: string | null | undefined;
|
|
270
276
|
}, {
|
|
277
|
+
bucketName: string;
|
|
271
278
|
type: "success";
|
|
272
279
|
privacy: "public-read" | "project-private";
|
|
273
280
|
cloudStorageUri: string;
|
|
274
281
|
size: number;
|
|
275
|
-
bucketName: string;
|
|
276
282
|
renderId: string;
|
|
277
283
|
publicUrl?: string | null | undefined;
|
|
278
284
|
}>;
|
|
@@ -52,6 +52,7 @@ exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
|
|
|
52
52
|
concurrency: zod_1.z.number().or(zod_1.z.string()).nullable(),
|
|
53
53
|
enforceAudioTrack: zod_1.z.boolean(),
|
|
54
54
|
preferLossless: zod_1.z.boolean(),
|
|
55
|
+
offthreadVideoCacheSizeInBytes: zod_1.z.number().nullable(),
|
|
55
56
|
}),
|
|
56
57
|
zod_1.z.object({
|
|
57
58
|
type: zod_1.z.literal('still'),
|
|
@@ -71,6 +72,7 @@ exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
|
|
|
71
72
|
frame: zod_1.z.number(),
|
|
72
73
|
delayRenderTimeoutInMilliseconds: zod_1.z.number(),
|
|
73
74
|
logLevel,
|
|
75
|
+
offthreadVideoCacheSizeInBytes: zod_1.z.number().nullable(),
|
|
74
76
|
}),
|
|
75
77
|
]);
|
|
76
78
|
const renderFailResponsePayload = zod_1.z.object({
|
|
@@ -80,6 +80,7 @@ const renderMediaSingleThread = async (body, res) => {
|
|
|
80
80
|
preferLossless: body.preferLossless,
|
|
81
81
|
puppeteerInstance: undefined,
|
|
82
82
|
server: undefined,
|
|
83
|
+
offthreadVideoCacheSizeInBytes: body.offthreadVideoCacheSizeInBytes,
|
|
83
84
|
});
|
|
84
85
|
const storage = new storage_1.Storage();
|
|
85
86
|
const publicUpload = body.privacy === 'public' || !body.privacy;
|
|
@@ -55,6 +55,7 @@ const renderStillSingleThread = async (body, res) => {
|
|
|
55
55
|
port: null,
|
|
56
56
|
puppeteerInstance: null,
|
|
57
57
|
server: undefined,
|
|
58
|
+
offthreadVideoCacheSizeInBytes: body.offthreadVideoCacheSizeInBytes,
|
|
58
59
|
});
|
|
59
60
|
log_1.Log.info('Still rendered');
|
|
60
61
|
const storage = new storage_1.Storage();
|
package/dist/shared/read-dir.js
CHANGED
|
@@ -45,10 +45,12 @@ async function readDirectory({ dir, etags, originalDir, }) {
|
|
|
45
45
|
// eslint-disable-next-line no-lonely-if
|
|
46
46
|
if (fs.lstatSync(filePath).isSymbolicLink()) {
|
|
47
47
|
const realPath = fs.realpathSync(filePath);
|
|
48
|
-
etags[path.relative(originalDir, filePath)] =
|
|
48
|
+
etags[path.relative(originalDir, filePath)] =
|
|
49
|
+
await (0, get_etag_1.getEtagOfFile)(realPath);
|
|
49
50
|
}
|
|
50
51
|
else {
|
|
51
|
-
etags[path.relative(originalDir, filePath)] =
|
|
52
|
+
etags[path.relative(originalDir, filePath)] =
|
|
53
|
+
await (0, get_etag_1.getEtagOfFile)(filePath);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
// Return the list of files with their etags and file names
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/cloudrun",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.23",
|
|
4
4
|
"description": "GCP Cloud Run alternative to lambda rendering",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
"@google-cloud/logging": "^10.5.0",
|
|
13
13
|
"google-auth-library": "^8.7.0",
|
|
14
14
|
"zod": "^3.21.4",
|
|
15
|
-
"@remotion/bundler": "4.0.
|
|
16
|
-
"@remotion/
|
|
17
|
-
"remotion": "4.0.
|
|
18
|
-
"
|
|
15
|
+
"@remotion/bundler": "4.0.23",
|
|
16
|
+
"@remotion/renderer": "4.0.23",
|
|
17
|
+
"@remotion/cli": "4.0.23",
|
|
18
|
+
"remotion": "4.0.23"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@jonny/eslint-config": "3.0.266",
|
|
22
22
|
"@types/node": "^18.11.2",
|
|
23
23
|
"@types/minimist": "1.2.2",
|
|
24
24
|
"eslint": "8.42.0",
|
|
25
|
-
"prettier": "
|
|
25
|
+
"prettier": "3.0.2",
|
|
26
26
|
"prettier-plugin-organize-imports": "^3.2.2",
|
|
27
27
|
"ts-node": "^10.8.0",
|
|
28
28
|
"vitest": "0.24.3",
|
|
29
|
-
"@remotion/compositor-linux-x64-gnu": "4.0.
|
|
29
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.23"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
"./package.json": "./package.json",
|