@remotion/cloudrun 4.1.0-alpha3 → 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.
@@ -9,7 +9,7 @@ const audioCodec = zod_1.z.enum(renderer_1.RenderInternals.validAudioCodecs);
9
9
  const pixelFormat = zod_1.z.enum(renderer_1.RenderInternals.validPixelFormats);
10
10
  const videoImageFormat = zod_1.z.enum(renderer_1.RenderInternals.validVideoImageFormats);
11
11
  const stillImageFormat = zod_1.z.enum(renderer_1.RenderInternals.validStillImageFormats);
12
- const proResProfile = zod_1.z.enum(client_1.BrowserSafeApis.proResProfileOptions);
12
+ const proResProfile = zod_1.z.enum(client_1.BrowserSafeApis.proResProfileOptions).nullable();
13
13
  const chromiumOptions = zod_1.z.object({
14
14
  ignoreCertificateErrors: zod_1.z.boolean().optional(),
15
15
  disableWebSecurity: zod_1.z.boolean().optional(),
@@ -26,26 +26,30 @@ exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
26
26
  forceHeight: zod_1.z.number().optional().nullable(),
27
27
  forceWidth: zod_1.z.number().optional().nullable(),
28
28
  codec,
29
- inputProps: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).or(zod_1.z.undefined()),
30
- jpegQuality: zod_1.z.number().optional(),
31
- audioCodec: audioCodec.optional().nullable(),
32
- audioBitrate: zod_1.z.string().optional().nullable(),
33
- videoBitrate: zod_1.z.string().optional().nullable(),
34
- crf: zod_1.z.number().optional().nullable(),
35
- pixelFormat: pixelFormat.optional(),
36
- imageFormat: videoImageFormat.optional(),
37
- scale: zod_1.z.number().optional(),
38
- proResProfile: proResProfile.optional(),
39
- everyNthFrame: zod_1.z.number().optional(),
40
- numberOfGifLoops: zod_1.z.number().optional().nullable(),
41
- frameRange: zod_1.z.tuple([zod_1.z.number(), zod_1.z.number()]).or(zod_1.z.number()).optional(),
42
- envVariables: zod_1.z.record(zod_1.z.string()).optional(),
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
43
  chromiumOptions: chromiumOptions.optional(),
44
- muted: zod_1.z.boolean().optional(),
44
+ muted: zod_1.z.boolean(),
45
45
  outputBucket: zod_1.z.string(),
46
46
  outName: zod_1.z.string().optional(),
47
47
  privacy: zod_1.z.enum(['public', 'private']).optional(),
48
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(),
49
53
  }),
50
54
  zod_1.z.object({
51
55
  type: zod_1.z.literal('still'),
@@ -53,16 +57,17 @@ exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
53
57
  composition: zod_1.z.string(),
54
58
  forceHeight: zod_1.z.number().optional().nullable(),
55
59
  forceWidth: zod_1.z.number().optional().nullable(),
56
- inputProps: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).or(zod_1.z.undefined()),
60
+ inputProps: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
57
61
  jpegQuality: zod_1.z.number().optional(),
58
- imageFormat: stillImageFormat.optional(),
59
- scale: zod_1.z.number().optional(),
60
- privacy: zod_1.z.enum(['public', 'private']).optional(),
61
- envVariables: zod_1.z.record(zod_1.z.string()).optional(),
62
+ 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()),
62
66
  chromiumOptions: chromiumOptions.optional(),
63
67
  outputBucket: zod_1.z.string(),
64
68
  outName: zod_1.z.string().optional(),
65
69
  frame: zod_1.z.number(),
70
+ delayRenderTimeoutInMilliseconds: zod_1.z.number(),
66
71
  logLevel,
67
72
  }),
68
73
  ]);
@@ -8,10 +8,11 @@ const render_media_single_thread_1 = require("./render-media-single-thread");
8
8
  const render_still_single_thread_1 = require("./render-still-single-thread");
9
9
  const renderOnCloudRun = async (req, res) => {
10
10
  var _a;
11
- const body = payloads_1.CloudRunPayload.parse(req.body);
12
- const renderType = body.type;
13
- renderer_1.RenderInternals.setLogLevel(body.logLevel);
14
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);
15
16
  switch (renderType) {
16
17
  case 'media':
17
18
  await (0, render_media_single_thread_1.renderMediaSingleThread)(body, res);
@@ -6,7 +6,7 @@ const renderer_1 = require("@remotion/renderer");
6
6
  const random_hash_1 = require("../shared/random-hash");
7
7
  const get_composition_from_body_1 = require("./helpers/get-composition-from-body");
8
8
  const renderMediaSingleThread = async (body, res) => {
9
- var _a, _b, _c, _d, _e;
9
+ var _a, _b, _c, _d, _e, _f;
10
10
  if (body.type !== 'media') {
11
11
  throw new Error('expected type media');
12
12
  }
@@ -26,7 +26,7 @@ const renderMediaSingleThread = async (body, res) => {
26
26
  // Override the `null` value, which might come from CLI with swANGLE
27
27
  gl: (_b = (_a = body.chromiumOptions) === null || _a === void 0 ? void 0 : _a.gl) !== null && _b !== void 0 ? _b : 'swangle',
28
28
  };
29
- await (0, renderer_1.renderMedia)({
29
+ await renderer_1.RenderInternals.internalRenderMedia({
30
30
  composition: {
31
31
  ...composition,
32
32
  height: (_c = body.forceHeight) !== null && _c !== void 0 ? _c : composition.height,
@@ -44,7 +44,7 @@ const renderMediaSingleThread = async (body, res) => {
44
44
  pixelFormat: body.pixelFormat,
45
45
  imageFormat: body.imageFormat,
46
46
  scale: body.scale,
47
- proResProfile: body.proResProfile,
47
+ proResProfile: (_e = body.proResProfile) !== null && _e !== void 0 ? _e : undefined,
48
48
  everyNthFrame: body.everyNthFrame,
49
49
  numberOfGifLoops: body.numberOfGifLoops,
50
50
  onProgress,
@@ -52,14 +52,31 @@ const renderMediaSingleThread = async (body, res) => {
52
52
  envVariables: body.envVariables,
53
53
  chromiumOptions: actualChromiumOptions,
54
54
  muted: body.muted,
55
- verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(body.logLevel, 'verbose'),
55
+ logLevel: body.logLevel,
56
+ browserExecutable: null,
57
+ timeoutInMilliseconds: body.delayRenderTimeoutInMilliseconds,
58
+ cancelSignal: undefined,
59
+ concurrency: body.concurrency,
60
+ disallowParallelEncoding: false,
61
+ enforceAudioTrack: body.enforceAudioTrack,
62
+ ffmpegOverride: undefined,
63
+ indent: false,
64
+ onBrowserLog: null,
65
+ onCtrlCExit: () => undefined,
66
+ onDownload: () => undefined,
67
+ onStart: () => undefined,
68
+ overwrite: true,
69
+ port: null,
70
+ preferLossless: body.preferLossless,
71
+ puppeteerInstance: undefined,
72
+ server: undefined,
56
73
  });
57
74
  const storage = new storage_1.Storage();
58
75
  const publicUpload = body.privacy === 'public' || !body.privacy;
59
76
  const uploadedResponse = await storage
60
77
  .bucket(body.outputBucket)
61
78
  .upload(tempFilePath, {
62
- destination: `renders/${renderId}/${(_e = body.outName) !== null && _e !== void 0 ? _e : 'out.mp4'}`,
79
+ destination: `renders/${renderId}/${(_f = body.outName) !== null && _f !== void 0 ? _f : 'out.mp4'}`,
63
80
  predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
64
81
  });
65
82
  const uploadedFile = uploadedResponse[0];
@@ -7,7 +7,7 @@ const log_1 = require("../cli/log");
7
7
  const random_hash_1 = require("../shared/random-hash");
8
8
  const get_composition_from_body_1 = require("./helpers/get-composition-from-body");
9
9
  const renderStillSingleThread = async (body, res) => {
10
- var _a, _b, _c, _d, _e;
10
+ var _a, _b, _c, _d, _e, _f;
11
11
  if (body.type !== 'still') {
12
12
  throw new Error('expected type still');
13
13
  }
@@ -21,7 +21,7 @@ const renderStillSingleThread = async (body, res) => {
21
21
  // Override the `null` value, which might come from CLI with swANGLE
22
22
  gl: (_b = (_a = body.chromiumOptions) === null || _a === void 0 ? void 0 : _a.gl) !== null && _b !== void 0 ? _b : 'swangle',
23
23
  };
24
- await (0, renderer_1.renderStill)({
24
+ await renderer_1.RenderInternals.internalRenderStill({
25
25
  composition: {
26
26
  ...composition,
27
27
  height: (_c = body.forceHeight) !== null && _c !== void 0 ? _c : composition.height,
@@ -30,13 +30,23 @@ const renderStillSingleThread = async (body, res) => {
30
30
  serveUrl: body.serveUrl,
31
31
  output: tempFilePath,
32
32
  inputProps: body.inputProps,
33
- jpegQuality: body.jpegQuality,
33
+ jpegQuality: (_e = body.jpegQuality) !== null && _e !== void 0 ? _e : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
34
34
  imageFormat: body.imageFormat,
35
35
  scale: body.scale,
36
36
  envVariables: body.envVariables,
37
37
  chromiumOptions: actualChromiumOptions,
38
38
  frame: body.frame,
39
- verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(body.logLevel, 'verbose'),
39
+ logLevel: body.logLevel,
40
+ browserExecutable: null,
41
+ cancelSignal: null,
42
+ indent: false,
43
+ timeoutInMilliseconds: body.delayRenderTimeoutInMilliseconds,
44
+ onBrowserLog: null,
45
+ onDownload: null,
46
+ overwrite: true,
47
+ port: null,
48
+ puppeteerInstance: null,
49
+ server: undefined,
40
50
  });
41
51
  log_1.Log.info('Still rendered');
42
52
  const storage = new storage_1.Storage();
@@ -44,7 +54,7 @@ const renderStillSingleThread = async (body, res) => {
44
54
  const uploadedResponse = await storage
45
55
  .bucket(body.outputBucket)
46
56
  .upload(tempFilePath, {
47
- destination: `renders/${renderId}/${(_e = body.outName) !== null && _e !== void 0 ? _e : 'out.png'}`,
57
+ destination: `renders/${renderId}/${(_f = body.outName) !== null && _f !== void 0 ? _f : 'out.png'}`,
48
58
  predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
49
59
  });
50
60
  log_1.Log.info('Still uploaded');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cloudrun",
3
- "version": "4.1.0-alpha3",
3
+ "version": "4.1.0-alpha4",
4
4
  "description": "GCP Cloud Run alternative to lambda rendering",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
@@ -11,22 +11,22 @@
11
11
  "@google-cloud/resource-manager": "^4.3.0",
12
12
  "google-auth-library": "^8.7.0",
13
13
  "zod": "^3.21.4",
14
- "@remotion/bundler": "4.1.0-alpha3",
15
- "@remotion/renderer": "4.1.0-alpha3",
16
- "@remotion/cli": "4.1.0-alpha3",
17
- "remotion": "4.1.0-alpha3"
14
+ "@remotion/bundler": "4.1.0-alpha4",
15
+ "@remotion/cli": "4.1.0-alpha4",
16
+ "remotion": "4.1.0-alpha4",
17
+ "@remotion/renderer": "4.1.0-alpha4"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@jonny/eslint-config": "3.0.266",
21
21
  "@types/node": "^18.11.2",
22
22
  "@types/minimist": "1.2.2",
23
- "eslint": "8.25.0",
23
+ "eslint": "8.42.0",
24
24
  "prettier": "^2.7.1",
25
25
  "prettier-plugin-organize-imports": "^3.2.2",
26
26
  "ts-node": "^10.8.0",
27
27
  "typescript": "4.7.2",
28
28
  "vitest": "0.24.3",
29
- "@remotion/compositor-linux-x64-gnu": "4.1.0-alpha3"
29
+ "@remotion/compositor-linux-x64-gnu": "4.1.0-alpha4"
30
30
  },
31
31
  "exports": {
32
32
  "./package.json": "./package.json",
@@ -49,7 +49,6 @@
49
49
  "build": "tsc -d && cp src/shared/sa-permissions.json dist/shared/sa-permissions.json && pnpm run buildContainer && pnpm run tarInstaller",
50
50
  "buildContainer": "ts-node src/admin/bundle-renderLogic.ts",
51
51
  "tarInstaller": "ts-node src/admin/bundle-installer.ts",
52
- "start": "functions-framework --target=TypescriptFunction",
53
52
  "watch": "tsc -w",
54
53
  "lint": "eslint src --ext ts,tsx",
55
54
  "test": "vitest --run"