@remotion/cloudrun 4.0.423 → 4.0.425

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/api/get-buckets.d.ts +1 -2
  2. package/dist/api/get-buckets.js +4 -1
  3. package/dist/api/get-regions.d.ts +1 -2
  4. package/dist/api/get-sites.d.ts +1 -1
  5. package/dist/api/helpers/parse-service-name.d.ts +3 -4
  6. package/dist/api/iam-validation/testPermissions.d.ts +1 -1
  7. package/dist/api/render-media-on-cloudrun.d.ts +37 -4
  8. package/dist/api/render-media-on-cloudrun.js +6 -2
  9. package/dist/api/render-still-on-cloudrun.d.ts +8 -6
  10. package/dist/api/render-still-on-cloudrun.js +21 -17
  11. package/dist/cli/commands/permissions.d.ts +1 -2
  12. package/dist/cli/commands/regions.d.ts +1 -2
  13. package/dist/cli/commands/render/helpers/renderArgsCheck.d.ts +2 -3
  14. package/dist/cli/commands/render/index.d.ts +1 -2
  15. package/dist/cli/commands/render/index.js +36 -7
  16. package/dist/cli/commands/services/deploy.d.ts +1 -2
  17. package/dist/cli/commands/services/index.d.ts +1 -2
  18. package/dist/cli/commands/services/ls.d.ts +1 -2
  19. package/dist/cli/commands/services/rm.d.ts +1 -2
  20. package/dist/cli/commands/services/rmall.d.ts +1 -2
  21. package/dist/cli/commands/sites/create.d.ts +1 -2
  22. package/dist/cli/commands/sites/index.d.ts +1 -2
  23. package/dist/cli/commands/sites/ls.d.ts +1 -2
  24. package/dist/cli/commands/sites/rm.d.ts +1 -2
  25. package/dist/cli/commands/sites/rmall.d.ts +1 -2
  26. package/dist/cli/commands/still.d.ts +1 -2
  27. package/dist/cli/commands/still.js +22 -5
  28. package/dist/cli/get-gcp-region.d.ts +1 -2
  29. package/dist/cli/help.d.ts +1 -2
  30. package/dist/cli/helpers/cloudrun-crash-logs.d.ts +8 -3
  31. package/dist/cli/helpers/make-console-url.d.ts +1 -2
  32. package/dist/cli/index.d.ts +1 -2
  33. package/dist/cli/index.js +2 -1
  34. package/dist/cli/log.js +1 -1
  35. package/dist/client.js +10 -10
  36. package/dist/functions/helpers/get-composition-from-body.d.ts +108 -2
  37. package/dist/functions/helpers/get-download-behavior-setting.d.ts +6 -2
  38. package/dist/functions/helpers/payloads.d.ts +107 -95
  39. package/dist/functions/helpers/payloads.js +4 -0
  40. package/dist/functions/index.d.ts +1 -1
  41. package/dist/functions/render-media-single-thread.d.ts +108 -2
  42. package/dist/functions/render-media-single-thread.js +20 -17
  43. package/dist/functions/render-still-single-thread.d.ts +108 -2
  44. package/dist/functions/render-still-single-thread.js +13 -10
  45. package/dist/index.d.ts +30 -15
  46. package/dist/internals.d.ts +1 -1
  47. package/dist/shared/random-hash.d.ts +1 -1
  48. package/dist/shared/read-dir.d.ts +1 -1
  49. package/dist/shared/validate-bucketname.d.ts +1 -2
  50. package/dist/shared/validate-gcp-codec.d.ts +1 -1
  51. package/dist/shared/validate-region.d.ts +1 -2
  52. package/package.json +10 -9
@@ -1,3 +1,109 @@
1
1
  import type * as ff from '@google-cloud/functions-framework';
2
- import type { CloudRunPayloadType } from './helpers/payloads';
3
- export declare const renderMediaSingleThread: (body: CloudRunPayloadType, res: ff.Response) => Promise<void>;
2
+ export declare const renderMediaSingleThread: (body: {
3
+ type: "media";
4
+ serveUrl: string;
5
+ composition: string;
6
+ forceHeight?: number | null | undefined;
7
+ forceWidth?: number | null | undefined;
8
+ forceFps?: number | null | undefined;
9
+ forceDurationInFrames?: number | null | undefined;
10
+ codec: "aac" | "gif" | "h264" | "h264-mkv" | "h264-ts" | "h265" | "mp3" | "prores" | "vp8" | "vp9" | "wav";
11
+ serializedInputPropsWithCustomSchema: string;
12
+ jpegQuality: number | null;
13
+ audioCodec: "aac" | "mp3" | "opus" | "pcm-16" | null;
14
+ audioBitrate: string | null;
15
+ videoBitrate: string | null;
16
+ encodingMaxRate: string | null;
17
+ encodingBufferSize: string | null;
18
+ crf: number | null;
19
+ pixelFormat: "yuv420p" | "yuv420p10le" | "yuv422p" | "yuv422p10le" | "yuv444p" | "yuv444p10le" | "yuva420p" | "yuva444p10le" | null;
20
+ imageFormat: "jpeg" | "none" | "png" | null;
21
+ scale: number;
22
+ proResProfile: "4444" | "4444-xq" | "hq" | "light" | "proxy" | "standard" | null;
23
+ x264Preset: "fast" | "faster" | "medium" | "placebo" | "slow" | "slower" | "superfast" | "ultrafast" | "veryfast" | "veryslow" | null;
24
+ everyNthFrame: number;
25
+ numberOfGifLoops: number | null;
26
+ frameRange: ((number | [number, number | null]) & (number | [number, number | null] | undefined)) | null;
27
+ envVariables: Record<string, string>;
28
+ chromiumOptions?: {
29
+ ignoreCertificateErrors?: boolean | undefined;
30
+ disableWebSecurity?: boolean | undefined;
31
+ gl?: "angle" | "angle-egl" | "egl" | "swangle" | "swiftshader" | "vulkan" | null | undefined;
32
+ headless?: boolean | undefined;
33
+ userAgent?: string | null | undefined;
34
+ darkMode?: boolean | undefined;
35
+ } | undefined;
36
+ muted: boolean;
37
+ outputBucket: string;
38
+ outName?: string | undefined;
39
+ privacy?: "no-acl" | "private" | "public" | undefined;
40
+ logLevel: "error" | "info" | "trace" | "verbose" | "warn";
41
+ delayRenderTimeoutInMilliseconds: number | null;
42
+ concurrency: string | number | null;
43
+ enforceAudioTrack: boolean;
44
+ preferLossless: boolean;
45
+ offthreadVideoCacheSizeInBytes: number | null;
46
+ mediaCacheSizeInBytes: number | null;
47
+ offthreadVideoThreads: number | null;
48
+ colorSpace: "bt2020-ncl" | "bt601" | "bt709" | "default" | null;
49
+ clientVersion: string;
50
+ downloadBehavior: {
51
+ type: "play-in-browser";
52
+ } | {
53
+ type: "download";
54
+ fileName: string | null;
55
+ };
56
+ metadata?: Record<string, string> | null | undefined;
57
+ renderIdOverride?: string | null | undefined;
58
+ renderStatusWebhook?: {
59
+ url: string;
60
+ headers: Record<string, string>;
61
+ data?: any;
62
+ webhookProgressInterval?: number | null | undefined;
63
+ } | null | undefined;
64
+ } | {
65
+ type: "still";
66
+ serveUrl: string;
67
+ composition: string;
68
+ forceHeight?: number | null | undefined;
69
+ forceWidth?: number | null | undefined;
70
+ forceFps?: number | null | undefined;
71
+ forceDurationInFrames?: number | null | undefined;
72
+ serializedInputPropsWithCustomSchema: string;
73
+ jpegQuality?: number | undefined;
74
+ imageFormat: "jpeg" | "pdf" | "png" | "webp";
75
+ scale: number;
76
+ privacy: "no-acl" | "private" | "public";
77
+ envVariables: Record<string, string>;
78
+ chromiumOptions?: {
79
+ ignoreCertificateErrors?: boolean | undefined;
80
+ disableWebSecurity?: boolean | undefined;
81
+ gl?: "angle" | "angle-egl" | "egl" | "swangle" | "swiftshader" | "vulkan" | null | undefined;
82
+ headless?: boolean | undefined;
83
+ userAgent?: string | null | undefined;
84
+ darkMode?: boolean | undefined;
85
+ } | undefined;
86
+ outputBucket: string;
87
+ outName: string | null;
88
+ frame: number;
89
+ delayRenderTimeoutInMilliseconds: number;
90
+ logLevel: "error" | "info" | "trace" | "verbose" | "warn";
91
+ mediaCacheSizeInBytes: number | null;
92
+ offthreadVideoCacheSizeInBytes: number | null;
93
+ offthreadVideoThreads: number | null;
94
+ clientVersion: string;
95
+ downloadBehavior: {
96
+ type: "play-in-browser";
97
+ } | {
98
+ type: "download";
99
+ fileName: string | null;
100
+ };
101
+ metadata?: Record<string, string> | null | undefined;
102
+ renderIdOverride?: string | null | undefined;
103
+ renderStatusWebhook?: {
104
+ url: string;
105
+ headers: Record<string, string>;
106
+ data?: any;
107
+ webhookProgressInterval?: number | null | undefined;
108
+ } | null | undefined;
109
+ }, res: ff.Response<any, Record<string, any>>) => Promise<void>;
@@ -10,7 +10,8 @@ const get_composition_from_body_1 = require("./helpers/get-composition-from-body
10
10
  const get_download_behavior_setting_1 = require("./helpers/get-download-behavior-setting");
11
11
  const write_cloudrun_error_1 = require("./helpers/write-cloudrun-error");
12
12
  const renderMediaSingleThread = async (body, res) => {
13
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
13
+ var _a, _b, _c, _d, _e, _f;
14
+ var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
14
15
  if (body.type !== 'media') {
15
16
  throw new Error('expected type media');
16
17
  }
@@ -20,7 +21,7 @@ const renderMediaSingleThread = async (body, res) => {
20
21
  }
21
22
  throw new Error(`Version mismatch: When calling renderMediaOnCloudRun(), you called a service, which has the version ${version_1.VERSION}, but the @remotion/cloudrun package you used to invoke the function has version ${body.clientVersion}. Deploy a new service and use it to call renderMediaOnCloudrun().`);
22
23
  }
23
- const renderId = (_a = body.renderIdOverride) !== null && _a !== void 0 ? _a : (0, random_hash_1.randomHash)({ randomInTests: true });
24
+ const renderId = (_g = body.renderIdOverride) !== null && _g !== void 0 ? _g : (0, random_hash_1.randomHash)({ randomInTests: true });
24
25
  try {
25
26
  const composition = await (0, get_composition_from_body_1.getCompositionFromBody)(body);
26
27
  const defaultOutName = `out.${renderer_1.RenderInternals.getFileExtensionFromCodec(body.codec, body.audioCodec)}`;
@@ -70,13 +71,13 @@ const renderMediaSingleThread = async (body, res) => {
70
71
  res.writeHead(200, { 'Content-Type': 'text/html' });
71
72
  const actualChromiumOptions = {
72
73
  ...body.chromiumOptions,
73
- ignoreCertificateErrors: (_c = (_b = body.chromiumOptions) === null || _b === void 0 ? void 0 : _b.ignoreCertificateErrors) !== null && _c !== void 0 ? _c : false,
74
- disableWebSecurity: (_e = (_d = body.chromiumOptions) === null || _d === void 0 ? void 0 : _d.disableWebSecurity) !== null && _e !== void 0 ? _e : false,
75
- headless: (_g = (_f = body.chromiumOptions) === null || _f === void 0 ? void 0 : _f.headless) !== null && _g !== void 0 ? _g : true,
76
- userAgent: (_j = (_h = body.chromiumOptions) === null || _h === void 0 ? void 0 : _h.userAgent) !== null && _j !== void 0 ? _j : null,
77
- darkMode: (_l = (_k = body.chromiumOptions) === null || _k === void 0 ? void 0 : _k.darkMode) !== null && _l !== void 0 ? _l : false,
74
+ ignoreCertificateErrors: (_h = (_a = body.chromiumOptions) === null || _a === void 0 ? void 0 : _a.ignoreCertificateErrors) !== null && _h !== void 0 ? _h : false,
75
+ disableWebSecurity: (_j = (_b = body.chromiumOptions) === null || _b === void 0 ? void 0 : _b.disableWebSecurity) !== null && _j !== void 0 ? _j : false,
76
+ headless: (_k = (_c = body.chromiumOptions) === null || _c === void 0 ? void 0 : _c.headless) !== null && _k !== void 0 ? _k : true,
77
+ userAgent: (_l = (_d = body.chromiumOptions) === null || _d === void 0 ? void 0 : _d.userAgent) !== null && _l !== void 0 ? _l : null,
78
+ darkMode: (_m = (_e = body.chromiumOptions) === null || _e === void 0 ? void 0 : _e.darkMode) !== null && _m !== void 0 ? _m : false,
78
79
  // Override the `null` value, which might come from CLI with swANGLE
79
- gl: (_o = (_m = body.chromiumOptions) === null || _m === void 0 ? void 0 : _m.gl) !== null && _o !== void 0 ? _o : 'swangle',
80
+ gl: (_o = (_f = body.chromiumOptions) === null || _f === void 0 ? void 0 : _f.gl) !== null && _o !== void 0 ? _o : 'swangle',
80
81
  enableMultiProcessOnLinux: true,
81
82
  };
82
83
  const onArtifact = () => {
@@ -87,6 +88,8 @@ const renderMediaSingleThread = async (body, res) => {
87
88
  ...composition,
88
89
  height: (_p = body.forceHeight) !== null && _p !== void 0 ? _p : composition.height,
89
90
  width: (_q = body.forceWidth) !== null && _q !== void 0 ? _q : composition.width,
91
+ fps: (_r = body.forceFps) !== null && _r !== void 0 ? _r : composition.fps,
92
+ durationInFrames: (_s = body.forceDurationInFrames) !== null && _s !== void 0 ? _s : composition.durationInFrames,
90
93
  },
91
94
  serveUrl: body.serveUrl,
92
95
  codec: body.codec,
@@ -97,17 +100,17 @@ const renderMediaSingleThread = async (body, res) => {
97
100
  indent: undefined,
98
101
  staticBase: null,
99
102
  }).serializedString,
100
- jpegQuality: (_r = body.jpegQuality) !== null && _r !== void 0 ? _r : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
103
+ jpegQuality: (_t = body.jpegQuality) !== null && _t !== void 0 ? _t : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
101
104
  audioCodec: body.audioCodec,
102
- audioBitrate: (_s = body.audioBitrate) !== null && _s !== void 0 ? _s : null,
105
+ audioBitrate: (_u = body.audioBitrate) !== null && _u !== void 0 ? _u : null,
103
106
  videoBitrate: body.videoBitrate,
104
107
  encodingMaxRate: body.encodingMaxRate,
105
108
  encodingBufferSize: body.encodingBufferSize,
106
109
  crf: body.crf,
107
- pixelFormat: (_t = body.pixelFormat) !== null && _t !== void 0 ? _t : renderer_1.RenderInternals.DEFAULT_PIXEL_FORMAT,
108
- imageFormat: (_u = body.imageFormat) !== null && _u !== void 0 ? _u : renderer_1.RenderInternals.DEFAULT_VIDEO_IMAGE_FORMAT,
110
+ pixelFormat: (_v = body.pixelFormat) !== null && _v !== void 0 ? _v : renderer_1.RenderInternals.DEFAULT_PIXEL_FORMAT,
111
+ imageFormat: (_w = body.imageFormat) !== null && _w !== void 0 ? _w : renderer_1.RenderInternals.DEFAULT_VIDEO_IMAGE_FORMAT,
109
112
  scale: body.scale,
110
- proResProfile: (_v = body.proResProfile) !== null && _v !== void 0 ? _v : undefined,
113
+ proResProfile: (_x = body.proResProfile) !== null && _x !== void 0 ? _x : undefined,
111
114
  x264Preset: body.x264Preset,
112
115
  everyNthFrame: body.everyNthFrame,
113
116
  numberOfGifLoops: body.numberOfGifLoops,
@@ -118,9 +121,9 @@ const renderMediaSingleThread = async (body, res) => {
118
121
  muted: body.muted,
119
122
  logLevel: body.logLevel,
120
123
  browserExecutable: null,
121
- timeoutInMilliseconds: (_w = body.delayRenderTimeoutInMilliseconds) !== null && _w !== void 0 ? _w : renderer_1.RenderInternals.DEFAULT_TIMEOUT,
124
+ timeoutInMilliseconds: (_y = body.delayRenderTimeoutInMilliseconds) !== null && _y !== void 0 ? _y : renderer_1.RenderInternals.DEFAULT_TIMEOUT,
122
125
  cancelSignal: undefined,
123
- concurrency: (_x = body.concurrency) !== null && _x !== void 0 ? _x : null,
126
+ concurrency: (_z = body.concurrency) !== null && _z !== void 0 ? _z : null,
124
127
  disallowParallelEncoding: false,
125
128
  enforceAudioTrack: body.enforceAudioTrack,
126
129
  ffmpegOverride: undefined,
@@ -147,7 +150,7 @@ const renderMediaSingleThread = async (body, res) => {
147
150
  throw new Error('Should not download a browser in Cloud Run');
148
151
  },
149
152
  onArtifact,
150
- metadata: (_y = body.metadata) !== null && _y !== void 0 ? _y : null,
153
+ metadata: (_0 = body.metadata) !== null && _0 !== void 0 ? _0 : null,
151
154
  hardwareAcceleration: 'disable',
152
155
  chromeMode: 'headless-shell',
153
156
  onLog: renderer_1.RenderInternals.defaultOnLog,
@@ -159,7 +162,7 @@ const renderMediaSingleThread = async (body, res) => {
159
162
  const uploadedResponse = await storage
160
163
  .bucket(body.outputBucket)
161
164
  .upload(tempFilePath, {
162
- destination: `renders/${renderId}/${(_z = body.outName) !== null && _z !== void 0 ? _z : defaultOutName}`,
165
+ destination: `renders/${renderId}/${(_1 = body.outName) !== null && _1 !== void 0 ? _1 : defaultOutName}`,
163
166
  predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
164
167
  metadata: (0, get_download_behavior_setting_1.getDownloadBehaviorSetting)(body.downloadBehavior),
165
168
  });
@@ -1,3 +1,109 @@
1
1
  import type * as ff from '@google-cloud/functions-framework';
2
- import type { CloudRunPayloadType } from './helpers/payloads';
3
- export declare const renderStillSingleThread: (body: CloudRunPayloadType, res: ff.Response) => Promise<void>;
2
+ export declare const renderStillSingleThread: (body: {
3
+ type: "media";
4
+ serveUrl: string;
5
+ composition: string;
6
+ forceHeight?: number | null | undefined;
7
+ forceWidth?: number | null | undefined;
8
+ forceFps?: number | null | undefined;
9
+ forceDurationInFrames?: number | null | undefined;
10
+ codec: "aac" | "gif" | "h264" | "h264-mkv" | "h264-ts" | "h265" | "mp3" | "prores" | "vp8" | "vp9" | "wav";
11
+ serializedInputPropsWithCustomSchema: string;
12
+ jpegQuality: number | null;
13
+ audioCodec: "aac" | "mp3" | "opus" | "pcm-16" | null;
14
+ audioBitrate: string | null;
15
+ videoBitrate: string | null;
16
+ encodingMaxRate: string | null;
17
+ encodingBufferSize: string | null;
18
+ crf: number | null;
19
+ pixelFormat: "yuv420p" | "yuv420p10le" | "yuv422p" | "yuv422p10le" | "yuv444p" | "yuv444p10le" | "yuva420p" | "yuva444p10le" | null;
20
+ imageFormat: "jpeg" | "none" | "png" | null;
21
+ scale: number;
22
+ proResProfile: "4444" | "4444-xq" | "hq" | "light" | "proxy" | "standard" | null;
23
+ x264Preset: "fast" | "faster" | "medium" | "placebo" | "slow" | "slower" | "superfast" | "ultrafast" | "veryfast" | "veryslow" | null;
24
+ everyNthFrame: number;
25
+ numberOfGifLoops: number | null;
26
+ frameRange: ((number | [number, number | null]) & (number | [number, number | null] | undefined)) | null;
27
+ envVariables: Record<string, string>;
28
+ chromiumOptions?: {
29
+ ignoreCertificateErrors?: boolean | undefined;
30
+ disableWebSecurity?: boolean | undefined;
31
+ gl?: "angle" | "angle-egl" | "egl" | "swangle" | "swiftshader" | "vulkan" | null | undefined;
32
+ headless?: boolean | undefined;
33
+ userAgent?: string | null | undefined;
34
+ darkMode?: boolean | undefined;
35
+ } | undefined;
36
+ muted: boolean;
37
+ outputBucket: string;
38
+ outName?: string | undefined;
39
+ privacy?: "no-acl" | "private" | "public" | undefined;
40
+ logLevel: "error" | "info" | "trace" | "verbose" | "warn";
41
+ delayRenderTimeoutInMilliseconds: number | null;
42
+ concurrency: string | number | null;
43
+ enforceAudioTrack: boolean;
44
+ preferLossless: boolean;
45
+ offthreadVideoCacheSizeInBytes: number | null;
46
+ mediaCacheSizeInBytes: number | null;
47
+ offthreadVideoThreads: number | null;
48
+ colorSpace: "bt2020-ncl" | "bt601" | "bt709" | "default" | null;
49
+ clientVersion: string;
50
+ downloadBehavior: {
51
+ type: "play-in-browser";
52
+ } | {
53
+ type: "download";
54
+ fileName: string | null;
55
+ };
56
+ metadata?: Record<string, string> | null | undefined;
57
+ renderIdOverride?: string | null | undefined;
58
+ renderStatusWebhook?: {
59
+ url: string;
60
+ headers: Record<string, string>;
61
+ data?: any;
62
+ webhookProgressInterval?: number | null | undefined;
63
+ } | null | undefined;
64
+ } | {
65
+ type: "still";
66
+ serveUrl: string;
67
+ composition: string;
68
+ forceHeight?: number | null | undefined;
69
+ forceWidth?: number | null | undefined;
70
+ forceFps?: number | null | undefined;
71
+ forceDurationInFrames?: number | null | undefined;
72
+ serializedInputPropsWithCustomSchema: string;
73
+ jpegQuality?: number | undefined;
74
+ imageFormat: "jpeg" | "pdf" | "png" | "webp";
75
+ scale: number;
76
+ privacy: "no-acl" | "private" | "public";
77
+ envVariables: Record<string, string>;
78
+ chromiumOptions?: {
79
+ ignoreCertificateErrors?: boolean | undefined;
80
+ disableWebSecurity?: boolean | undefined;
81
+ gl?: "angle" | "angle-egl" | "egl" | "swangle" | "swiftshader" | "vulkan" | null | undefined;
82
+ headless?: boolean | undefined;
83
+ userAgent?: string | null | undefined;
84
+ darkMode?: boolean | undefined;
85
+ } | undefined;
86
+ outputBucket: string;
87
+ outName: string | null;
88
+ frame: number;
89
+ delayRenderTimeoutInMilliseconds: number;
90
+ logLevel: "error" | "info" | "trace" | "verbose" | "warn";
91
+ mediaCacheSizeInBytes: number | null;
92
+ offthreadVideoCacheSizeInBytes: number | null;
93
+ offthreadVideoThreads: number | null;
94
+ clientVersion: string;
95
+ downloadBehavior: {
96
+ type: "play-in-browser";
97
+ } | {
98
+ type: "download";
99
+ fileName: string | null;
100
+ };
101
+ metadata?: Record<string, string> | null | undefined;
102
+ renderIdOverride?: string | null | undefined;
103
+ renderStatusWebhook?: {
104
+ url: string;
105
+ headers: Record<string, string>;
106
+ data?: any;
107
+ webhookProgressInterval?: number | null | undefined;
108
+ } | null | undefined;
109
+ }, res: ff.Response<any, Record<string, any>>) => Promise<void>;
@@ -11,7 +11,8 @@ const get_composition_from_body_1 = require("./helpers/get-composition-from-body
11
11
  const get_download_behavior_setting_1 = require("./helpers/get-download-behavior-setting");
12
12
  const write_cloudrun_error_1 = require("./helpers/write-cloudrun-error");
13
13
  const renderStillSingleThread = async (body, res) => {
14
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
14
+ var _a, _b, _c, _d, _e, _f;
15
+ var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
15
16
  if (body.type !== 'still') {
16
17
  throw new Error('expected type still');
17
18
  }
@@ -21,7 +22,7 @@ const renderStillSingleThread = async (body, res) => {
21
22
  }
22
23
  throw new Error(`Version mismatch: When calling renderMediaOnCloudRun(), you called a service, which has the version ${version_1.VERSION}, but the @remotion/cloudrun package you used to invoke the function has version ${body.clientVersion}. Deploy a new service and use it to call renderMediaOnCloudrun().`);
23
24
  }
24
- const renderId = (_a = body.renderIdOverride) !== null && _a !== void 0 ? _a : (0, random_hash_1.randomHash)({ randomInTests: true });
25
+ const renderId = (_g = body.renderIdOverride) !== null && _g !== void 0 ? _g : (0, random_hash_1.randomHash)({ randomInTests: true });
25
26
  try {
26
27
  log_1.Log.verbose({ indent: false, logLevel: body.logLevel }, 'Rendering still frame', body);
27
28
  const composition = await (0, get_composition_from_body_1.getCompositionFromBody)(body);
@@ -29,13 +30,13 @@ const renderStillSingleThread = async (body, res) => {
29
30
  const tempFilePath = '/tmp/still.png';
30
31
  const actualChromiumOptions = {
31
32
  ...body.chromiumOptions,
32
- darkMode: (_c = (_b = body.chromiumOptions) === null || _b === void 0 ? void 0 : _b.darkMode) !== null && _c !== void 0 ? _c : false,
33
- disableWebSecurity: (_e = (_d = body.chromiumOptions) === null || _d === void 0 ? void 0 : _d.disableWebSecurity) !== null && _e !== void 0 ? _e : false,
34
- headless: (_g = (_f = body.chromiumOptions) === null || _f === void 0 ? void 0 : _f.headless) !== null && _g !== void 0 ? _g : true,
35
- userAgent: (_j = (_h = body.chromiumOptions) === null || _h === void 0 ? void 0 : _h.userAgent) !== null && _j !== void 0 ? _j : null,
36
- ignoreCertificateErrors: (_l = (_k = body.chromiumOptions) === null || _k === void 0 ? void 0 : _k.ignoreCertificateErrors) !== null && _l !== void 0 ? _l : false,
33
+ darkMode: (_h = (_a = body.chromiumOptions) === null || _a === void 0 ? void 0 : _a.darkMode) !== null && _h !== void 0 ? _h : false,
34
+ disableWebSecurity: (_j = (_b = body.chromiumOptions) === null || _b === void 0 ? void 0 : _b.disableWebSecurity) !== null && _j !== void 0 ? _j : false,
35
+ headless: (_k = (_c = body.chromiumOptions) === null || _c === void 0 ? void 0 : _c.headless) !== null && _k !== void 0 ? _k : true,
36
+ userAgent: (_l = (_d = body.chromiumOptions) === null || _d === void 0 ? void 0 : _d.userAgent) !== null && _l !== void 0 ? _l : null,
37
+ ignoreCertificateErrors: (_m = (_e = body.chromiumOptions) === null || _e === void 0 ? void 0 : _e.ignoreCertificateErrors) !== null && _m !== void 0 ? _m : false,
37
38
  // Override the `null` value, which might come from CLI with swANGLE
38
- gl: (_o = (_m = body.chromiumOptions) === null || _m === void 0 ? void 0 : _m.gl) !== null && _o !== void 0 ? _o : 'swangle',
39
+ gl: (_o = (_f = body.chromiumOptions) === null || _f === void 0 ? void 0 : _f.gl) !== null && _o !== void 0 ? _o : 'swangle',
39
40
  enableMultiProcessOnLinux: true,
40
41
  };
41
42
  await renderer_1.RenderInternals.internalRenderStill({
@@ -43,6 +44,8 @@ const renderStillSingleThread = async (body, res) => {
43
44
  ...composition,
44
45
  height: (_p = body.forceHeight) !== null && _p !== void 0 ? _p : composition.height,
45
46
  width: (_q = body.forceWidth) !== null && _q !== void 0 ? _q : composition.width,
47
+ fps: (_r = body.forceFps) !== null && _r !== void 0 ? _r : composition.fps,
48
+ durationInFrames: (_s = body.forceDurationInFrames) !== null && _s !== void 0 ? _s : composition.durationInFrames,
46
49
  },
47
50
  serveUrl: body.serveUrl,
48
51
  output: tempFilePath,
@@ -52,7 +55,7 @@ const renderStillSingleThread = async (body, res) => {
52
55
  indent: undefined,
53
56
  staticBase: null,
54
57
  }).serializedString,
55
- jpegQuality: (_r = body.jpegQuality) !== null && _r !== void 0 ? _r : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
58
+ jpegQuality: (_t = body.jpegQuality) !== null && _t !== void 0 ? _t : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
56
59
  imageFormat: body.imageFormat,
57
60
  scale: body.scale,
58
61
  envVariables: body.envVariables,
@@ -90,7 +93,7 @@ const renderStillSingleThread = async (body, res) => {
90
93
  const uploadedResponse = await storage
91
94
  .bucket(body.outputBucket)
92
95
  .upload(tempFilePath, {
93
- destination: `renders/${renderId}/${(_s = body.outName) !== null && _s !== void 0 ? _s : 'out.png'}`,
96
+ destination: `renders/${renderId}/${(_u = body.outName) !== null && _u !== void 0 ? _u : 'out.png'}`,
94
97
  predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
95
98
  metadata: (0, get_download_behavior_setting_1.getDownloadBehaviorSetting)(body.downloadBehavior),
96
99
  });
package/dist/index.d.ts CHANGED
@@ -16,34 +16,49 @@ import type { GcpRegion } from './pricing/gcp-regions';
16
16
  /**
17
17
  * @deprecated Import this from `@remotion/cloudrun/client` instead
18
18
  */
19
- declare const renderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, downloadBehavior, metadata, renderIdOverride, renderStatusWebhook, offthreadVideoThreads, mediaCacheSizeInBytes, }: RenderMediaOnCloudrunInput) => Promise<RenderMediaOnCloudrunOutput | import("./functions/helpers/payloads").CloudRunCrashResponse>;
20
- /**
21
- * @deprecated Import this from `@remotion/cloudrun/client` instead
22
- */
23
- declare const renderStillOnCloudrun: (options: import("./api/render-still-on-cloudrun").RenderStillOnCloudrunInput) => Promise<{
24
- name: string;
25
- message: string;
26
- type: "error";
27
- stack: string;
19
+ declare const renderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, forceFps, forceDurationInFrames, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, downloadBehavior, metadata, renderIdOverride, renderStatusWebhook, offthreadVideoThreads, mediaCacheSizeInBytes, }: RenderMediaOnCloudrunInput) => Promise<{
20
+ type: "crash";
21
+ cloudRunEndpoint: string;
22
+ message: "Service crashed without sending a response. Check the logs in GCP console.";
23
+ requestStartTime: string;
24
+ requestCrashTime: string;
25
+ requestElapsedTimeInSeconds: number;
28
26
  } | {
29
- bucketName: string;
30
27
  type: "success";
31
- privacy: "public-read" | "project-private";
28
+ publicUrl?: string | null | undefined;
32
29
  cloudStorageUri: string;
33
30
  size: number;
31
+ bucketName: string;
34
32
  renderId: string;
35
- publicUrl?: string | null | undefined;
36
- } | {
37
- message: "Service crashed without sending a response. Check the logs in GCP console.";
33
+ privacy: "project-private" | "public-read";
34
+ }>;
35
+ /**
36
+ * @deprecated Import this from `@remotion/cloudrun/client` instead
37
+ */
38
+ declare const renderStillOnCloudrun: (options: import("./client").RenderStillOnCloudrunInput) => Promise<{
38
39
  type: "crash";
39
40
  cloudRunEndpoint: string;
41
+ message: "Service crashed without sending a response. Check the logs in GCP console.";
40
42
  requestStartTime: string;
41
43
  requestCrashTime: string;
42
44
  requestElapsedTimeInSeconds: number;
45
+ } | {
46
+ type: "error";
47
+ message: string;
48
+ name: string;
49
+ stack: string;
50
+ } | {
51
+ type: "success";
52
+ publicUrl?: string | null | undefined;
53
+ cloudStorageUri: string;
54
+ size: number;
55
+ bucketName: string;
56
+ renderId: string;
57
+ privacy: "project-private" | "public-read";
43
58
  }>;
44
59
  /**
45
60
  * @deprecated Import this from `@remotion/lambda/client` instead
46
61
  */
47
- declare const getSites: (region: GcpRegion | "all regions") => Promise<import("./api/get-sites").GetSitesOutput>;
62
+ declare const getSites: (region: "all regions" | "asia-east1" | "asia-east2" | "asia-northeast1" | "asia-northeast2" | "asia-northeast3" | "asia-south1" | "asia-south2" | "asia-southeast1" | "asia-southeast2" | "australia-southeast1" | "australia-southeast2" | "europe-central2" | "europe-north1" | "europe-southwest1" | "europe-west1" | "europe-west2" | "europe-west3" | "europe-west4" | "europe-west6" | "europe-west8" | "europe-west9" | "me-west1" | "northamerica-northeast1" | "northamerica-northeast2" | "southamerica-east1" | "southamerica-west1" | "us-central1" | "us-east1" | "us-east4" | "us-east5" | "us-south1" | "us-west1" | "us-west2" | "us-west3" | "us-west4") => Promise<import("./api/get-sites").GetSitesOutput>;
48
63
  export { CloudrunInternals, deleteService, deleteSite, deployService, deploySite, getOrCreateBucket, getRegions, getServiceInfo, getServices, getSites, renderMediaOnCloudrun, renderStillOnCloudrun, speculateServiceName, testPermissions, };
49
64
  export type { DeployServiceInput, DeployServiceOutput, GcpRegion, RenderMediaOnCloudrunInput, RenderMediaOnCloudrunOutput, UpdateRenderProgress, };
@@ -1,3 +1,3 @@
1
1
  export declare const CloudrunInternals: {
2
- executeCommand: (args: string[], remotionRoot: string, logLevel: import("@remotion/renderer").LogLevel) => Promise<void>;
2
+ executeCommand: (args: string[], remotionRoot: string, logLevel: "error" | "info" | "trace" | "verbose" | "warn") => Promise<void>;
3
3
  };
@@ -1,3 +1,3 @@
1
1
  export declare const randomHash: (_options?: {
2
2
  randomInTests: boolean;
3
- }) => string;
3
+ } | undefined) => string;
@@ -1,4 +1,4 @@
1
- export declare function readDirectory({ dir, etags, originalDir, }: {
1
+ export declare function readDirectory({ dir, etags, originalDir }: {
2
2
  dir: string;
3
3
  etags: {
4
4
  [key: string]: string;
@@ -1,8 +1,7 @@
1
- import type { GcpRegion } from '../pricing/gcp-regions';
2
1
  export declare const validateBucketName: (bucketName: unknown, options: {
3
2
  mustStartWithRemotion: boolean;
4
3
  }) => void;
5
4
  export declare const parseBucketName: (name: string) => {
6
- region: GcpRegion | null;
5
+ region: "asia-east1" | "asia-east2" | "asia-northeast1" | "asia-northeast2" | "asia-northeast3" | "asia-south1" | "asia-south2" | "asia-southeast1" | "asia-southeast2" | "australia-southeast1" | "australia-southeast2" | "europe-central2" | "europe-north1" | "europe-southwest1" | "europe-west1" | "europe-west2" | "europe-west3" | "europe-west4" | "europe-west6" | "europe-west8" | "europe-west9" | "me-west1" | "northamerica-northeast1" | "northamerica-northeast2" | "southamerica-east1" | "southamerica-west1" | "us-central1" | "us-east1" | "us-east4" | "us-east5" | "us-south1" | "us-west1" | "us-west2" | "us-west3" | "us-west4" | null;
7
6
  };
8
7
  export declare const makeBucketName: () => string;
@@ -1,4 +1,4 @@
1
1
  declare const cloudrunCodecs: readonly ["h264", "vp8", "vp9", "mp3", "aac", "wav", "gif", "prores"];
2
2
  export type CloudrunCodec = (typeof cloudrunCodecs)[number];
3
- export declare const validateCloudrunCodec: (codec: unknown) => CloudrunCodec;
3
+ export declare const validateCloudrunCodec: (codec: unknown) => "aac" | "gif" | "h264" | "mp3" | "prores" | "vp8" | "vp9" | "wav";
4
4
  export {};
@@ -1,2 +1 @@
1
- import type { GcpRegion } from '../pricing/gcp-regions';
2
- export declare const validateRegion: (region: unknown) => GcpRegion;
1
+ export declare const validateRegion: (region: unknown) => "asia-east1" | "asia-east2" | "asia-northeast1" | "asia-northeast2" | "asia-northeast3" | "asia-south1" | "asia-south2" | "asia-southeast1" | "asia-southeast2" | "australia-southeast1" | "australia-southeast2" | "europe-central2" | "europe-north1" | "europe-southwest1" | "europe-west1" | "europe-west2" | "europe-west3" | "europe-west4" | "europe-west6" | "europe-west8" | "europe-west9" | "me-west1" | "northamerica-northeast1" | "northamerica-northeast2" | "southamerica-east1" | "southamerica-west1" | "us-central1" | "us-east1" | "us-east4" | "us-east5" | "us-south1" | "us-west1" | "us-west2" | "us-west3" | "us-west4";
package/package.json CHANGED
@@ -3,12 +3,12 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/cloudrun"
4
4
  },
5
5
  "name": "@remotion/cloudrun",
6
- "version": "4.0.423",
6
+ "version": "4.0.425",
7
7
  "description": "Render Remotion videos on Google Cloud Run",
8
8
  "main": "dist/index.js",
9
9
  "sideEffects": false,
10
10
  "scripts": {
11
- "make": "tsc -d && cp src/shared/sa-permissions.json dist/shared/sa-permissions.json",
11
+ "make": "tsgo -d && cp src/shared/sa-permissions.json dist/shared/sa-permissions.json",
12
12
  "makeruntime": "bun build.ts",
13
13
  "lint": "eslint src",
14
14
  "test": "bun test src",
@@ -21,19 +21,20 @@
21
21
  "@google-cloud/storage": "7.15.2",
22
22
  "@google-cloud/resource-manager": "5.3.1",
23
23
  "@google-cloud/logging": "11.2.0",
24
- "@remotion/bundler": "4.0.423",
25
- "@remotion/cli": "4.0.423",
26
- "@remotion/renderer": "4.0.423",
24
+ "@remotion/bundler": "4.0.425",
25
+ "@remotion/cli": "4.0.425",
26
+ "@remotion/renderer": "4.0.425",
27
27
  "google-auth-library": "8.7.0",
28
- "remotion": "4.0.423",
28
+ "remotion": "4.0.425",
29
29
  "zod": "3.22.3"
30
30
  },
31
31
  "devDependencies": {
32
- "@remotion/compositor-linux-x64-gnu": "4.0.423",
32
+ "@remotion/compositor-linux-x64-gnu": "4.0.425",
33
33
  "@types/minimist": "1.2.2",
34
- "@remotion/eslint-config-internal": "4.0.423",
34
+ "@remotion/eslint-config-internal": "4.0.425",
35
35
  "eslint": "9.19.0",
36
- "@types/node": "20.12.14"
36
+ "@types/node": "20.12.14",
37
+ "@typescript/native-preview": "7.0.0-dev.20260217.1"
37
38
  },
38
39
  "exports": {
39
40
  "./package.json": "./package.json",