@remotion/serverless-client 4.0.364 → 4.0.365
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.mjs +1 -1
- package/package.json +5 -5
- package/.turbo/turbo-formatting.log +0 -4
- package/.turbo/turbo-lint.log +0 -15
- package/.turbo/turbo-make.log +0 -3
- package/bundle.ts +0 -15
- package/dist/test/best-frames.test.d.ts +0 -1
- package/dist/test/best-frames.test.js +0 -16
- package/dist/test/dont-contain-forbidden.test.d.ts +0 -1
- package/dist/test/dont-contain-forbidden.test.js +0 -18
- package/dist/test/expected-out-name.test.d.ts +0 -1
- package/dist/test/expected-out-name.test.js +0 -168
- package/dist/test/min-max.test.d.ts +0 -1
- package/dist/test/min-max.test.js +0 -24
- package/dist/test/most-expensive-chunks.test.d.ts +0 -1
- package/dist/test/most-expensive-chunks.test.js +0 -163
- package/eslint.config.mjs +0 -5
- package/src/await.ts +0 -1
- package/src/best-frames-per-function-param.ts +0 -18
- package/src/calculate-chunk-times.ts +0 -42
- package/src/compress-props.ts +0 -179
- package/src/constants.ts +0 -408
- package/src/docs-url.ts +0 -1
- package/src/error-category.ts +0 -14
- package/src/estimate-price-from-bucket.ts +0 -59
- package/src/expected-out-name.ts +0 -83
- package/src/format-costs-info.ts +0 -24
- package/src/get-custom-out-name.ts +0 -44
- package/src/get-files-in-folder.ts +0 -6
- package/src/get-or-create-bucket.ts +0 -85
- package/src/get-overall-progress-from-storage.ts +0 -47
- package/src/get-overall-progress.ts +0 -42
- package/src/index.ts +0 -125
- package/src/input-props-keys.ts +0 -7
- package/src/inspect-error.ts +0 -63
- package/src/make-bucket-name.ts +0 -9
- package/src/make-timeout-error.ts +0 -51
- package/src/make-timeout-message.ts +0 -118
- package/src/min-max.ts +0 -34
- package/src/most-expensive-chunks.ts +0 -46
- package/src/overall-render-progress.ts +0 -30
- package/src/progress.ts +0 -330
- package/src/provider-implementation.ts +0 -268
- package/src/render-has-audio-video.ts +0 -28
- package/src/render-metadata.ts +0 -61
- package/src/render-progress.ts +0 -58
- package/src/return-values.ts +0 -45
- package/src/serialize-artifact.ts +0 -66
- package/src/stream-to-string.ts +0 -14
- package/src/streaming/streaming.ts +0 -148
- package/src/test/best-frames.test.ts +0 -15
- package/src/test/dont-contain-forbidden.test.ts +0 -14
- package/src/test/expected-out-name.test.ts +0 -200
- package/src/test/min-max.test.ts +0 -25
- package/src/test/most-expensive-chunks.test.ts +0 -167
- package/src/truthy.ts +0 -5
- package/src/types.ts +0 -82
- package/src/validate-bucket-name.ts +0 -34
- package/src/validate-download-behavior.ts +0 -26
- package/src/validate-frames-per-function.ts +0 -125
- package/src/validate-outname.ts +0 -63
- package/src/validate-privacy.ts +0 -20
- package/src/validate-webhook.ts +0 -18
- package/src/webhook-types.ts +0 -36
- package/src/write-error-to-storage.ts +0 -23
- package/tsconfig.json +0 -18
- package/tsconfig.tsbuildinfo +0 -1
package/src/compress-props.ts
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import {NoReactInternals} from 'remotion/no-react';
|
|
2
|
-
import type {SerializedInputProps} from './constants';
|
|
3
|
-
import {internalGetOrCreateBucket} from './get-or-create-bucket';
|
|
4
|
-
import {inputPropsKey, resolvedPropsKey} from './input-props-keys';
|
|
5
|
-
import type {ProviderSpecifics} from './provider-implementation';
|
|
6
|
-
import {streamToString} from './stream-to-string';
|
|
7
|
-
import type {CloudProvider} from './types';
|
|
8
|
-
import {MAX_WEBHOOK_CUSTOM_DATA_SIZE} from './validate-webhook';
|
|
9
|
-
|
|
10
|
-
type PropsType = 'input-props' | 'resolved-props';
|
|
11
|
-
|
|
12
|
-
const makeKey = (type: PropsType, hash: string): string => {
|
|
13
|
-
if (type === 'input-props') {
|
|
14
|
-
return inputPropsKey(hash);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return resolvedPropsKey(hash);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const serializeOrThrow = (
|
|
21
|
-
inputProps: Record<string, unknown>,
|
|
22
|
-
propsType: PropsType,
|
|
23
|
-
) => {
|
|
24
|
-
try {
|
|
25
|
-
const payload = NoReactInternals.serializeJSONWithSpecialTypes({
|
|
26
|
-
indent: undefined,
|
|
27
|
-
staticBase: null,
|
|
28
|
-
data: inputProps,
|
|
29
|
-
});
|
|
30
|
-
return payload.serializedString;
|
|
31
|
-
} catch {
|
|
32
|
-
throw new Error(
|
|
33
|
-
`Error serializing ${propsType}. Check it has no circular references or reduce the size if the object is big.`,
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const getNeedsToUpload = <Provider extends CloudProvider>({
|
|
39
|
-
type,
|
|
40
|
-
sizes,
|
|
41
|
-
providerSpecifics,
|
|
42
|
-
}: {
|
|
43
|
-
type: 'still' | 'video-or-audio';
|
|
44
|
-
sizes: number[];
|
|
45
|
-
providerSpecifics: ProviderSpecifics<Provider>;
|
|
46
|
-
}) => {
|
|
47
|
-
const MARGIN = 5_000 + MAX_WEBHOOK_CUSTOM_DATA_SIZE;
|
|
48
|
-
const MAX_INLINE_PAYLOAD_SIZE =
|
|
49
|
-
(type === 'still'
|
|
50
|
-
? providerSpecifics.getMaxStillInlinePayloadSize()
|
|
51
|
-
: providerSpecifics.getMaxNonInlinePayloadSizePerFunction()) - MARGIN;
|
|
52
|
-
|
|
53
|
-
const sizesAlreadyUsed = sizes.reduce((a, b) => a + b);
|
|
54
|
-
|
|
55
|
-
if (sizesAlreadyUsed > MAX_INLINE_PAYLOAD_SIZE) {
|
|
56
|
-
// eslint-disable-next-line no-console
|
|
57
|
-
console.warn(
|
|
58
|
-
`Warning: The props are over ${Math.round(
|
|
59
|
-
MAX_INLINE_PAYLOAD_SIZE / 1000,
|
|
60
|
-
)}KB (${Math.ceil(
|
|
61
|
-
sizesAlreadyUsed / 1024,
|
|
62
|
-
)}KB) in size. Uploading them to ${providerSpecifics.serverStorageProductName()} to circumvent AWS Lambda payload size, which may lead to slowdown.`,
|
|
63
|
-
);
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return false;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const compressInputProps = async <Provider extends CloudProvider>({
|
|
71
|
-
stringifiedInputProps,
|
|
72
|
-
region,
|
|
73
|
-
userSpecifiedBucketName,
|
|
74
|
-
propsType,
|
|
75
|
-
needsToUpload,
|
|
76
|
-
providerSpecifics,
|
|
77
|
-
forcePathStyle,
|
|
78
|
-
skipPutAcl,
|
|
79
|
-
requestHandler,
|
|
80
|
-
}: {
|
|
81
|
-
stringifiedInputProps: string;
|
|
82
|
-
region: Provider['region'];
|
|
83
|
-
userSpecifiedBucketName: string | null;
|
|
84
|
-
propsType: PropsType;
|
|
85
|
-
needsToUpload: boolean;
|
|
86
|
-
providerSpecifics: ProviderSpecifics<Provider>;
|
|
87
|
-
forcePathStyle: boolean;
|
|
88
|
-
skipPutAcl: boolean;
|
|
89
|
-
requestHandler: Provider['requestHandler'] | undefined;
|
|
90
|
-
}): Promise<SerializedInputProps> => {
|
|
91
|
-
const hash = providerSpecifics.randomHash();
|
|
92
|
-
|
|
93
|
-
if (needsToUpload) {
|
|
94
|
-
const bucketName =
|
|
95
|
-
userSpecifiedBucketName ??
|
|
96
|
-
(
|
|
97
|
-
await internalGetOrCreateBucket({
|
|
98
|
-
region,
|
|
99
|
-
enableFolderExpiry: null,
|
|
100
|
-
customCredentials: null,
|
|
101
|
-
providerSpecifics,
|
|
102
|
-
forcePathStyle,
|
|
103
|
-
skipPutAcl,
|
|
104
|
-
requestHandler,
|
|
105
|
-
})
|
|
106
|
-
).bucketName;
|
|
107
|
-
|
|
108
|
-
await providerSpecifics.writeFile({
|
|
109
|
-
body: stringifiedInputProps,
|
|
110
|
-
bucketName,
|
|
111
|
-
region,
|
|
112
|
-
customCredentials: null,
|
|
113
|
-
downloadBehavior: null,
|
|
114
|
-
expectedBucketOwner: null,
|
|
115
|
-
key: makeKey(propsType, hash),
|
|
116
|
-
privacy: 'private',
|
|
117
|
-
forcePathStyle,
|
|
118
|
-
storageClass: null,
|
|
119
|
-
requestHandler,
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
type: 'bucket-url',
|
|
124
|
-
hash,
|
|
125
|
-
bucketName,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
type: 'payload',
|
|
131
|
-
payload: stringifiedInputProps,
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export const decompressInputProps = async <Provider extends CloudProvider>({
|
|
136
|
-
serialized,
|
|
137
|
-
region,
|
|
138
|
-
bucketName,
|
|
139
|
-
expectedBucketOwner,
|
|
140
|
-
propsType,
|
|
141
|
-
providerSpecifics,
|
|
142
|
-
forcePathStyle,
|
|
143
|
-
requestHandler,
|
|
144
|
-
}: {
|
|
145
|
-
serialized: SerializedInputProps;
|
|
146
|
-
region: Provider['region'];
|
|
147
|
-
bucketName: string;
|
|
148
|
-
expectedBucketOwner: string;
|
|
149
|
-
propsType: PropsType;
|
|
150
|
-
providerSpecifics: ProviderSpecifics<Provider>;
|
|
151
|
-
forcePathStyle: boolean;
|
|
152
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
153
|
-
}): Promise<string> => {
|
|
154
|
-
if (serialized.type === 'payload') {
|
|
155
|
-
return serialized.payload;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
try {
|
|
159
|
-
const response = await providerSpecifics.readFile({
|
|
160
|
-
bucketName,
|
|
161
|
-
expectedBucketOwner,
|
|
162
|
-
key: makeKey(propsType, serialized.hash),
|
|
163
|
-
region,
|
|
164
|
-
forcePathStyle,
|
|
165
|
-
requestHandler,
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
const body = await streamToString(response);
|
|
169
|
-
const payload = body;
|
|
170
|
-
|
|
171
|
-
return payload;
|
|
172
|
-
} catch (err) {
|
|
173
|
-
throw new Error(
|
|
174
|
-
`Failed to parse input props that were serialized: ${
|
|
175
|
-
(err as Error).stack
|
|
176
|
-
}`,
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
};
|
package/src/constants.ts
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
export const COMMAND_NOT_FOUND = 'Command not found';
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
AudioCodec,
|
|
5
|
-
ChromiumOptions,
|
|
6
|
-
ColorSpace,
|
|
7
|
-
FrameRange,
|
|
8
|
-
LogLevel,
|
|
9
|
-
PixelFormat,
|
|
10
|
-
ProResProfile,
|
|
11
|
-
StillImageFormat,
|
|
12
|
-
ToOptions,
|
|
13
|
-
VideoImageFormat,
|
|
14
|
-
X264Preset,
|
|
15
|
-
} from '@remotion/renderer';
|
|
16
|
-
import type {BrowserSafeApis} from '@remotion/renderer/client';
|
|
17
|
-
import type {DownloadBehavior} from 'remotion';
|
|
18
|
-
import type {ExpensiveChunk} from './most-expensive-chunks';
|
|
19
|
-
import type {ChunkRetry, CloudProvider, ReceivedArtifact} from './types';
|
|
20
|
-
import type {EnhancedErrorInfo} from './write-error-to-storage';
|
|
21
|
-
|
|
22
|
-
// Needs to be in sync with renderer/src/options/delete-after.ts#L7
|
|
23
|
-
export const expiryDays = {
|
|
24
|
-
'1-day': 1,
|
|
25
|
-
'3-days': 3,
|
|
26
|
-
'7-days': 7,
|
|
27
|
-
'30-days': 30,
|
|
28
|
-
} as const;
|
|
29
|
-
|
|
30
|
-
export type DeleteAfter = keyof typeof expiryDays;
|
|
31
|
-
|
|
32
|
-
export enum ServerlessRoutines {
|
|
33
|
-
info = 'info',
|
|
34
|
-
start = 'start',
|
|
35
|
-
launch = 'launch',
|
|
36
|
-
status = 'status',
|
|
37
|
-
renderer = 'renderer',
|
|
38
|
-
still = 'still',
|
|
39
|
-
compositions = 'compositions',
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export type CustomCredentialsWithoutSensitiveData = {
|
|
43
|
-
endpoint: string;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type CustomCredentials<Provider extends CloudProvider> =
|
|
47
|
-
CustomCredentialsWithoutSensitiveData & {
|
|
48
|
-
accessKeyId: string | null;
|
|
49
|
-
secretAccessKey: string | null;
|
|
50
|
-
region?: Provider['region'];
|
|
51
|
-
forcePathStyle?: boolean;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export type OutNameInput<Provider extends CloudProvider> =
|
|
55
|
-
| string
|
|
56
|
-
| {
|
|
57
|
-
bucketName: string;
|
|
58
|
-
key: string;
|
|
59
|
-
s3OutputProvider?: CustomCredentials<Provider>;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export type SerializedInputProps =
|
|
63
|
-
| {
|
|
64
|
-
type: 'bucket-url';
|
|
65
|
-
hash: string;
|
|
66
|
-
bucketName: string;
|
|
67
|
-
}
|
|
68
|
-
| {
|
|
69
|
-
type: 'payload';
|
|
70
|
-
payload: string;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const serverlessCodecs = [
|
|
74
|
-
'h264',
|
|
75
|
-
'h265',
|
|
76
|
-
'vp8',
|
|
77
|
-
'vp9',
|
|
78
|
-
'mp3',
|
|
79
|
-
'aac',
|
|
80
|
-
'wav',
|
|
81
|
-
'gif',
|
|
82
|
-
'prores',
|
|
83
|
-
] as const;
|
|
84
|
-
|
|
85
|
-
export type ServerlessCodec = (typeof serverlessCodecs)[number];
|
|
86
|
-
export type Privacy = 'public' | 'private' | 'no-acl';
|
|
87
|
-
|
|
88
|
-
type Prettify<T> = {
|
|
89
|
-
[K in keyof T]: T[K];
|
|
90
|
-
} & {};
|
|
91
|
-
|
|
92
|
-
export type WebhookOption = Prettify<
|
|
93
|
-
| null
|
|
94
|
-
| ({
|
|
95
|
-
url: string;
|
|
96
|
-
secret: string | null;
|
|
97
|
-
} & Partial<
|
|
98
|
-
ToOptions<{
|
|
99
|
-
customData: typeof BrowserSafeApis.options.webhookCustomDataOption;
|
|
100
|
-
}>
|
|
101
|
-
>)
|
|
102
|
-
>;
|
|
103
|
-
|
|
104
|
-
export type ServerlessStatusPayload<Provider extends CloudProvider> = {
|
|
105
|
-
type: ServerlessRoutines.status;
|
|
106
|
-
bucketName: string;
|
|
107
|
-
renderId: string;
|
|
108
|
-
version: string;
|
|
109
|
-
logLevel: LogLevel;
|
|
110
|
-
forcePathStyle: boolean;
|
|
111
|
-
s3OutputProvider: CustomCredentials<Provider> | null;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export type ServerlessStartPayload<Provider extends CloudProvider> = {
|
|
115
|
-
rendererFunctionName: string | null;
|
|
116
|
-
type: ServerlessRoutines.start;
|
|
117
|
-
serveUrl: string;
|
|
118
|
-
composition: string;
|
|
119
|
-
framesPerLambda: number | null;
|
|
120
|
-
concurrency: number | null;
|
|
121
|
-
inputProps: SerializedInputProps;
|
|
122
|
-
codec: ServerlessCodec;
|
|
123
|
-
audioCodec: AudioCodec | null;
|
|
124
|
-
imageFormat: VideoImageFormat;
|
|
125
|
-
crf: number | undefined | null;
|
|
126
|
-
envVariables: Record<string, string> | undefined;
|
|
127
|
-
pixelFormat: PixelFormat | undefined | null;
|
|
128
|
-
proResProfile: ProResProfile | undefined | null;
|
|
129
|
-
x264Preset: X264Preset | null;
|
|
130
|
-
jpegQuality: number | undefined;
|
|
131
|
-
maxRetries: number;
|
|
132
|
-
privacy: Privacy;
|
|
133
|
-
logLevel: LogLevel;
|
|
134
|
-
frameRange: FrameRange | null;
|
|
135
|
-
outName: OutNameInput<Provider> | null;
|
|
136
|
-
timeoutInMilliseconds: number;
|
|
137
|
-
chromiumOptions: ChromiumOptions;
|
|
138
|
-
scale: number;
|
|
139
|
-
everyNthFrame: number;
|
|
140
|
-
numberOfGifLoops: number | null;
|
|
141
|
-
concurrencyPerLambda: number;
|
|
142
|
-
downloadBehavior: DownloadBehavior;
|
|
143
|
-
muted: boolean;
|
|
144
|
-
version: string;
|
|
145
|
-
overwrite: boolean;
|
|
146
|
-
audioBitrate: string | null;
|
|
147
|
-
videoBitrate: string | null;
|
|
148
|
-
encodingMaxRate: string | null;
|
|
149
|
-
encodingBufferSize: string | null;
|
|
150
|
-
webhook: WebhookOption;
|
|
151
|
-
forceHeight: number | null;
|
|
152
|
-
forceWidth: number | null;
|
|
153
|
-
bucketName: string | null;
|
|
154
|
-
offthreadVideoCacheSizeInBytes: number | null;
|
|
155
|
-
offthreadVideoThreads: number | null;
|
|
156
|
-
mediaCacheSizeInBytes: number | null;
|
|
157
|
-
deleteAfter: DeleteAfter | null;
|
|
158
|
-
colorSpace: ColorSpace | null;
|
|
159
|
-
preferLossless: boolean;
|
|
160
|
-
forcePathStyle: boolean;
|
|
161
|
-
metadata: Record<string, string> | null;
|
|
162
|
-
apiKey: string | null;
|
|
163
|
-
storageClass: Provider['storageClass'] | null;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export type ServerlessPayloads<Provider extends CloudProvider> = {
|
|
167
|
-
info: {
|
|
168
|
-
type: ServerlessRoutines.info;
|
|
169
|
-
logLevel: LogLevel;
|
|
170
|
-
};
|
|
171
|
-
start: ServerlessStartPayload<Provider>;
|
|
172
|
-
launch: {
|
|
173
|
-
rendererFunctionName: string | null;
|
|
174
|
-
type: ServerlessRoutines.launch;
|
|
175
|
-
serveUrl: string;
|
|
176
|
-
composition: string;
|
|
177
|
-
framesPerFunction: number | null;
|
|
178
|
-
concurrency: number | null;
|
|
179
|
-
bucketName: string;
|
|
180
|
-
inputProps: SerializedInputProps;
|
|
181
|
-
renderId: string;
|
|
182
|
-
imageFormat: VideoImageFormat;
|
|
183
|
-
codec: ServerlessCodec;
|
|
184
|
-
audioCodec: AudioCodec | null;
|
|
185
|
-
crf: number | null;
|
|
186
|
-
envVariables: Record<string, string> | undefined;
|
|
187
|
-
pixelFormat: PixelFormat | null;
|
|
188
|
-
proResProfile: ProResProfile | null;
|
|
189
|
-
x264Preset: X264Preset | null;
|
|
190
|
-
jpegQuality: number | undefined;
|
|
191
|
-
maxRetries: number;
|
|
192
|
-
privacy: Privacy;
|
|
193
|
-
logLevel: LogLevel;
|
|
194
|
-
frameRange: FrameRange | null;
|
|
195
|
-
outName: OutNameInput<Provider> | null;
|
|
196
|
-
timeoutInMilliseconds: number;
|
|
197
|
-
chromiumOptions: ChromiumOptions;
|
|
198
|
-
scale: number;
|
|
199
|
-
everyNthFrame: number;
|
|
200
|
-
numberOfGifLoops: number | null;
|
|
201
|
-
concurrencyPerFunction: number;
|
|
202
|
-
downloadBehavior: DownloadBehavior;
|
|
203
|
-
muted: boolean;
|
|
204
|
-
overwrite: boolean;
|
|
205
|
-
audioBitrate: string | null;
|
|
206
|
-
videoBitrate: string | null;
|
|
207
|
-
encodingMaxRate: string | null;
|
|
208
|
-
encodingBufferSize: string | null;
|
|
209
|
-
webhook: WebhookOption;
|
|
210
|
-
forceHeight: number | null;
|
|
211
|
-
forceWidth: number | null;
|
|
212
|
-
offthreadVideoCacheSizeInBytes: number | null;
|
|
213
|
-
offthreadVideoThreads: number | null;
|
|
214
|
-
mediaCacheSizeInBytes: number | null;
|
|
215
|
-
deleteAfter: DeleteAfter | null;
|
|
216
|
-
colorSpace: ColorSpace | null;
|
|
217
|
-
preferLossless: boolean;
|
|
218
|
-
forcePathStyle: boolean;
|
|
219
|
-
metadata: Record<string, string> | null;
|
|
220
|
-
apiKey: string | null;
|
|
221
|
-
storageClass: Provider['storageClass'] | null;
|
|
222
|
-
};
|
|
223
|
-
status: ServerlessStatusPayload<Provider>;
|
|
224
|
-
renderer: {
|
|
225
|
-
concurrencyPerLambda: number;
|
|
226
|
-
type: ServerlessRoutines.renderer;
|
|
227
|
-
serveUrl: string;
|
|
228
|
-
frameRange: [number, number];
|
|
229
|
-
chunk: number;
|
|
230
|
-
bucketName: string;
|
|
231
|
-
composition: string;
|
|
232
|
-
fps: number;
|
|
233
|
-
height: number;
|
|
234
|
-
width: number;
|
|
235
|
-
durationInFrames: number;
|
|
236
|
-
retriesLeft: number;
|
|
237
|
-
inputProps: SerializedInputProps;
|
|
238
|
-
renderId: string;
|
|
239
|
-
imageFormat: VideoImageFormat;
|
|
240
|
-
codec: ServerlessCodec;
|
|
241
|
-
crf: number | null;
|
|
242
|
-
proResProfile: ProResProfile | null;
|
|
243
|
-
x264Preset: X264Preset | null;
|
|
244
|
-
pixelFormat: PixelFormat | null;
|
|
245
|
-
jpegQuality: number | undefined;
|
|
246
|
-
envVariables: Record<string, string> | undefined;
|
|
247
|
-
privacy: Privacy;
|
|
248
|
-
attempt: number;
|
|
249
|
-
logLevel: LogLevel;
|
|
250
|
-
timeoutInMilliseconds: number;
|
|
251
|
-
chromiumOptions: ChromiumOptions;
|
|
252
|
-
resolvedProps: SerializedInputProps;
|
|
253
|
-
scale: number;
|
|
254
|
-
everyNthFrame: number;
|
|
255
|
-
muted: boolean;
|
|
256
|
-
audioBitrate: string | null;
|
|
257
|
-
videoBitrate: string | null;
|
|
258
|
-
encodingBufferSize: string | null;
|
|
259
|
-
encodingMaxRate: string | null;
|
|
260
|
-
launchFunctionConfig: {
|
|
261
|
-
version: string;
|
|
262
|
-
};
|
|
263
|
-
preferLossless: boolean;
|
|
264
|
-
offthreadVideoCacheSizeInBytes: number | null;
|
|
265
|
-
offthreadVideoThreads: number | null;
|
|
266
|
-
mediaCacheSizeInBytes: number | null;
|
|
267
|
-
deleteAfter: DeleteAfter | null;
|
|
268
|
-
colorSpace: ColorSpace | null;
|
|
269
|
-
compositionStart: number;
|
|
270
|
-
framesPerLambda: number;
|
|
271
|
-
progressEveryNthFrame: number;
|
|
272
|
-
forcePathStyle: boolean;
|
|
273
|
-
metadata: Record<string, string> | null;
|
|
274
|
-
};
|
|
275
|
-
still: {
|
|
276
|
-
type: ServerlessRoutines.still;
|
|
277
|
-
serveUrl: string;
|
|
278
|
-
composition: string;
|
|
279
|
-
inputProps: SerializedInputProps;
|
|
280
|
-
imageFormat: StillImageFormat;
|
|
281
|
-
envVariables: Record<string, string>;
|
|
282
|
-
attempt: number;
|
|
283
|
-
jpegQuality: number | undefined;
|
|
284
|
-
maxRetries: number;
|
|
285
|
-
frame: number;
|
|
286
|
-
privacy: Privacy;
|
|
287
|
-
logLevel: LogLevel;
|
|
288
|
-
outName: OutNameInput<Provider> | null;
|
|
289
|
-
timeoutInMilliseconds: number;
|
|
290
|
-
chromiumOptions: ChromiumOptions;
|
|
291
|
-
scale: number;
|
|
292
|
-
downloadBehavior: DownloadBehavior;
|
|
293
|
-
version: string;
|
|
294
|
-
forceHeight: number | null;
|
|
295
|
-
forceWidth: number | null;
|
|
296
|
-
bucketName: string | null;
|
|
297
|
-
offthreadVideoCacheSizeInBytes: number | null;
|
|
298
|
-
offthreadVideoThreads: number | null;
|
|
299
|
-
mediaCacheSizeInBytes: number | null;
|
|
300
|
-
deleteAfter: DeleteAfter | null;
|
|
301
|
-
streamed: boolean;
|
|
302
|
-
forcePathStyle: boolean;
|
|
303
|
-
apiKey: string | null;
|
|
304
|
-
storageClass: Provider['storageClass'] | null;
|
|
305
|
-
};
|
|
306
|
-
compositions: {
|
|
307
|
-
type: ServerlessRoutines.compositions;
|
|
308
|
-
version: string;
|
|
309
|
-
chromiumOptions: ChromiumOptions;
|
|
310
|
-
logLevel: LogLevel;
|
|
311
|
-
inputProps: SerializedInputProps;
|
|
312
|
-
envVariables: Record<string, string> | undefined;
|
|
313
|
-
timeoutInMilliseconds: number;
|
|
314
|
-
serveUrl: string;
|
|
315
|
-
bucketName: string | null;
|
|
316
|
-
offthreadVideoCacheSizeInBytes: number | null;
|
|
317
|
-
mediaCacheSizeInBytes: number | null;
|
|
318
|
-
forcePathStyle: boolean;
|
|
319
|
-
};
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
export type ServerlessPayload<Provider extends CloudProvider> =
|
|
323
|
-
ServerlessPayloads<Provider>[ServerlessRoutines];
|
|
324
|
-
|
|
325
|
-
export type OutNameOutput<Provider extends CloudProvider> = {
|
|
326
|
-
renderBucketName: string;
|
|
327
|
-
key: string;
|
|
328
|
-
customCredentials: CustomCredentials<Provider> | null;
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
export type OutNameInputWithoutCredentials =
|
|
332
|
-
| string
|
|
333
|
-
| {
|
|
334
|
-
bucketName: string;
|
|
335
|
-
key: string;
|
|
336
|
-
s3OutputProvider?: CustomCredentialsWithoutSensitiveData;
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
export const rendersPrefix = (renderId: string) => `renders/${renderId}`;
|
|
340
|
-
|
|
341
|
-
export const outStillName = (renderId: string, imageFormat: StillImageFormat) =>
|
|
342
|
-
`${rendersPrefix(renderId)}/out.${imageFormat}`;
|
|
343
|
-
|
|
344
|
-
export const outName = (renderId: string, extension: string) =>
|
|
345
|
-
`${rendersPrefix(renderId)}/out.${extension}`;
|
|
346
|
-
|
|
347
|
-
export const customOutName = <Provider extends CloudProvider>(
|
|
348
|
-
renderId: string,
|
|
349
|
-
bucketName: string,
|
|
350
|
-
name: OutNameInput<Provider>,
|
|
351
|
-
): OutNameOutput<Provider> => {
|
|
352
|
-
if (typeof name === 'string') {
|
|
353
|
-
return {
|
|
354
|
-
renderBucketName: bucketName,
|
|
355
|
-
key: `${rendersPrefix(renderId)}/${name}`,
|
|
356
|
-
customCredentials: null,
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
return {
|
|
361
|
-
key: name.key,
|
|
362
|
-
renderBucketName: name.bucketName,
|
|
363
|
-
customCredentials: name.s3OutputProvider ?? null,
|
|
364
|
-
};
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
export const overallProgressKey = (renderId: string) =>
|
|
368
|
-
`${rendersPrefix(renderId)}/progress.json`;
|
|
369
|
-
|
|
370
|
-
export const artifactName = (renderId: string, name: string) =>
|
|
371
|
-
`${rendersPrefix(renderId)}/artifacts/${name}`;
|
|
372
|
-
|
|
373
|
-
export type PostRenderData<Provider extends CloudProvider> = {
|
|
374
|
-
cost: AfterRenderCost;
|
|
375
|
-
outputFile: string;
|
|
376
|
-
outputSize: number;
|
|
377
|
-
renderSize: number;
|
|
378
|
-
timeToFinish: number;
|
|
379
|
-
timeToRenderFrames: number;
|
|
380
|
-
errors: EnhancedErrorInfo[];
|
|
381
|
-
startTime: number;
|
|
382
|
-
endTime: number;
|
|
383
|
-
filesCleanedUp: number;
|
|
384
|
-
timeToEncode: number;
|
|
385
|
-
timeToCleanUp: number;
|
|
386
|
-
timeToRenderChunks: number;
|
|
387
|
-
retriesInfo: ChunkRetry[];
|
|
388
|
-
mostExpensiveFrameRanges: ExpensiveChunk[] | undefined;
|
|
389
|
-
estimatedBillingDurationInMilliseconds: number;
|
|
390
|
-
deleteAfter: DeleteAfter | null;
|
|
391
|
-
timeToCombine: number | null;
|
|
392
|
-
artifactProgress: ReceivedArtifact<Provider>[];
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
export type AfterRenderCost = {
|
|
396
|
-
estimatedCost: number;
|
|
397
|
-
estimatedDisplayCost: string;
|
|
398
|
-
currency: string;
|
|
399
|
-
disclaimer: string;
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
export const CONCAT_FOLDER_TOKEN = 'remotion-concat';
|
|
403
|
-
export const MAX_FUNCTIONS_PER_RENDER = 200;
|
|
404
|
-
export const MINIMUM_FRAMES_PER_FUNCTION = 5;
|
|
405
|
-
|
|
406
|
-
export const REMOTION_CONCATENATED_TOKEN = 'remotion-concatenated-token';
|
|
407
|
-
|
|
408
|
-
export const RENDERER_PATH_TOKEN = 'remotion-bucket';
|
package/src/docs-url.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const DOCS_URL = 'https://remotion.dev';
|
package/src/error-category.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const errorIsOutOfSpaceError = (err: string) => {
|
|
2
|
-
return (
|
|
3
|
-
err.includes('ENOSPC') ||
|
|
4
|
-
err.toLowerCase().includes('no space left on device')
|
|
5
|
-
);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const isErrInsufficientResourcesErr = (err: string) => {
|
|
9
|
-
return err.includes('net::ERR_INSUFFICIENT_RESOURCES');
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const isBrowserCrashedError = (err: string) => {
|
|
13
|
-
return err.includes('Target closed.') || err.includes('Session closed');
|
|
14
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {calculateChunkTimes} from './calculate-chunk-times';
|
|
2
|
-
import type {ProviderSpecifics} from './provider-implementation';
|
|
3
|
-
import type {RenderMetadata} from './render-metadata';
|
|
4
|
-
import type {CloudProvider, ParsedTiming} from './types';
|
|
5
|
-
|
|
6
|
-
export const estimatePriceFromMetadata = <Provider extends CloudProvider>({
|
|
7
|
-
renderMetadata,
|
|
8
|
-
memorySizeInMb,
|
|
9
|
-
diskSizeInMb,
|
|
10
|
-
functionsInvoked,
|
|
11
|
-
timings,
|
|
12
|
-
region,
|
|
13
|
-
providerSpecifics,
|
|
14
|
-
}: {
|
|
15
|
-
renderMetadata: RenderMetadata<Provider> | null;
|
|
16
|
-
memorySizeInMb: number;
|
|
17
|
-
diskSizeInMb: number;
|
|
18
|
-
functionsInvoked: number;
|
|
19
|
-
timings: ParsedTiming[];
|
|
20
|
-
region: Provider['region'];
|
|
21
|
-
providerSpecifics: ProviderSpecifics<Provider>;
|
|
22
|
-
}) => {
|
|
23
|
-
if (!renderMetadata) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const elapsedTime = Math.max(
|
|
28
|
-
0,
|
|
29
|
-
Date.now() - (renderMetadata?.startedDate ?? 0),
|
|
30
|
-
);
|
|
31
|
-
const unfinished = Math.max(
|
|
32
|
-
0,
|
|
33
|
-
(renderMetadata?.totalChunks ?? 0) - timings.length,
|
|
34
|
-
);
|
|
35
|
-
const timeElapsedOfUnfinished = new Array(unfinished)
|
|
36
|
-
.fill(true)
|
|
37
|
-
.map(() => elapsedTime)
|
|
38
|
-
.reduce((a, b) => a + b, 0);
|
|
39
|
-
|
|
40
|
-
const estimatedBillingDurationInMilliseconds =
|
|
41
|
-
calculateChunkTimes({
|
|
42
|
-
type: 'combined-time-for-cost-calculation',
|
|
43
|
-
timings,
|
|
44
|
-
}) + timeElapsedOfUnfinished;
|
|
45
|
-
|
|
46
|
-
const accruedSoFar = Number(
|
|
47
|
-
providerSpecifics
|
|
48
|
-
.estimatePrice({
|
|
49
|
-
region,
|
|
50
|
-
durationInMilliseconds: estimatedBillingDurationInMilliseconds,
|
|
51
|
-
memorySizeInMb,
|
|
52
|
-
diskSizeInMb,
|
|
53
|
-
lambdasInvoked: functionsInvoked,
|
|
54
|
-
})
|
|
55
|
-
.toPrecision(5),
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
return {accruedSoFar, estimatedBillingDurationInMilliseconds};
|
|
59
|
-
};
|