Skip to content

🎥 Make videos programmatically with React

Revert "scaffold streaming"

Jonny Burger569f052e4aa1
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index edac858e9a..d1457ac558 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -100,7 +100,6 @@ export const BooleanFlags = [
'disable-keyboard-shortcuts',
'default-only',
'no-open',
- 'enable-streaming',
];
export const parsedCli = minimist<CommandLineOptions>(process.argv.slice(2), {
diff --git a/packages/it-tests/src/monorepo/go-package.test.ts b/packages/it-tests/src/monorepo/go-package.test.ts
index c4e98876aa..d7b54fd5c1 100644
--- a/packages/it-tests/src/monorepo/go-package.test.ts
+++ b/packages/it-tests/src/monorepo/go-package.test.ts
@@ -68,7 +68,6 @@ test("Go package should create the same payload as normal Lambda package", async
webhook: null,
x264Preset: null,
inputProps: {},
- enableStreaming: false,
});
expect(removeUndefined(parsed)).toEqual(removeUndefined(nativeVersion));
diff --git a/packages/it-tests/src/monorepo/php-package.test.ts b/packages/it-tests/src/monorepo/php-package.test.ts
index 9edc980d2c..74d1a47877 100644
--- a/packages/it-tests/src/monorepo/php-package.test.ts
+++ b/packages/it-tests/src/monorepo/php-package.test.ts
@@ -98,7 +98,6 @@ test("PHP package should create the same renderMedia payload as normal Lambda pa
videoBitrate: null,
webhook: null,
x264Preset: null,
- enableStreaming: false,
});
const jsonOutput = toParse.substring(0, toParse.lastIndexOf("}") + 1);
const parsedJson = JSON.parse(jsonOutput);
diff --git a/packages/it-tests/src/monorepo/python-package.test.ts b/packages/it-tests/src/monorepo/python-package.test.ts
index cc278e65e9..ed878ae9a2 100644
--- a/packages/it-tests/src/monorepo/python-package.test.ts
+++ b/packages/it-tests/src/monorepo/python-package.test.ts
@@ -81,7 +81,6 @@ test("Python package should create the same renderMedia payload as normal Lambda
videoBitrate: null,
webhook: null,
x264Preset: null,
- enableStreaming: false,
});
const jsonOutput = toParse.substring(0, toParse.lastIndexOf("}") + 1);
const parsedJson = JSON.parse(jsonOutput);
diff --git a/packages/lambda/src/api/make-lambda-payload.ts b/packages/lambda/src/api/make-lambda-payload.ts
index 87fb2fe8a3..6d42eb300c 100644
--- a/packages/lambda/src/api/make-lambda-payload.ts
+++ b/packages/lambda/src/api/make-lambda-payload.ts
@@ -74,7 +74,6 @@ export type InnerRenderMediaOnLambdaInput = {
audioCodec: AudioCodec | null;
colorSpace: ColorSpace;
deleteAfter: DeleteAfter | null;
- enableStreaming: boolean;
} & ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>;
export const makeLambdaRenderMediaPayload = async ({
@@ -116,7 +115,6 @@ export const makeLambdaRenderMediaPayload = async ({
offthreadVideoCacheSizeInBytes,
deleteAfter,
colorSpace,
- enableStreaming,
}: InnerRenderMediaOnLambdaInput): Promise<LambdaStartPayload> => {
const actualCodec = validateLambdaCodec(codec);
validateServeUrl(serveUrl);
@@ -169,19 +167,18 @@ export const makeLambdaRenderMediaPayload = async ({
downloadBehavior,
muted: muted ?? false,
version: VERSION,
- overwrite,
- audioBitrate,
- videoBitrate,
- webhook,
- forceHeight,
- forceWidth,
- bucketName,
- audioCodec,
+ overwrite: overwrite ?? false,
+ audioBitrate: audioBitrate ?? null,
+ videoBitrate: videoBitrate ?? null,
+ webhook: webhook ?? null,
+ forceHeight: forceHeight ?? null,
+ forceWidth: forceWidth ?? null,
+ bucketName: bucketName ?? null,
+ audioCodec: audioCodec ?? null,
type: LambdaRoutines.start,
- offthreadVideoCacheSizeInBytes,
- deleteAfter,
- colorSpace,
- enableStreaming,
+ offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes ?? null,
+ deleteAfter: deleteAfter ?? null,
+ colorSpace: colorSpace ?? 'default',
};
};
diff --git a/packages/lambda/src/api/render-media-on-lambda.ts b/packages/lambda/src/api/render-media-on-lambda.ts
index 71094ef921..648a616acc 100644
--- a/packages/lambda/src/api/render-media-on-lambda.ts
+++ b/packages/lambda/src/api/render-media-on-lambda.ts
@@ -70,7 +70,6 @@ export type RenderMediaOnLambdaInput = {
dumpBrowserLogs?: boolean;
colorSpace?: ColorSpace;
deleteAfter?: DeleteAfter | null;
- enableStreaming?: boolean;
} & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
export type RenderMediaOnLambdaOutput = {
@@ -195,7 +194,6 @@ export const renderMediaOnLambda = (
webhook: options.webhook ?? null,
x264Preset: options.x264Preset ?? null,
deleteAfter: options.deleteAfter ?? null,
- enableStreaming: options.enableStreaming ?? false,
});
};
diff --git a/packages/lambda/src/cli/args.ts b/packages/lambda/src/cli/args.ts
index e1f8daccfe..164ae73160 100644
--- a/packages/lambda/src/cli/args.ts
+++ b/packages/lambda/src/cli/args.ts
@@ -34,7 +34,6 @@ type LambdaCommandLineOptions = {
['renderer-function-name']: string | undefined;
['function-name']: string | undefined;
['force-bucket-name']: string | undefined;
- ['enable-streaming']: boolean;
[BrowserSafeApis.options.deleteAfterOption.cliFlag]: DeleteAfter | undefined;
[BrowserSafeApis.options.folderExpiryOption.cliFlag]: boolean | undefined;
};
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index 68820b397f..57215554fa 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -199,7 +199,6 @@ export const renderCommand = async (args: string[], remotionRoot: string) => {
downloadBehavior: {type: 'play-in-browser'},
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes ?? null,
x264Preset: x264Preset ?? null,
- enableStreaming: parsedLambdaCli['enable-streaming'] ?? false,
});
const totalSteps = downloadName ? 6 : 5;
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 7c9a48c208..723808f8d0 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -274,7 +274,6 @@ const innerLaunchHandler = async (
offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
deleteAfter: params.deleteAfter,
colorSpace: params.colorSpace,
- enableStreaming: params.enableStreaming,
};
return payload;
});
diff --git a/packages/lambda/src/functions/start.ts b/packages/lambda/src/functions/start.ts
index 5121790918..32be912426 100644
--- a/packages/lambda/src/functions/start.ts
+++ b/packages/lambda/src/functions/start.ts
@@ -103,7 +103,6 @@ export const startHandler = async (params: LambdaPayload, options: Options) => {
offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
deleteAfter: params.deleteAfter,
colorSpace: params.colorSpace,
- enableStreaming: params.enableStreaming,
};
// Don't replace with callLambda(), we want to return before the render is snone
diff --git a/packages/lambda/src/functions/streaming/streaming.ts b/packages/lambda/src/functions/streaming/streaming.ts
deleted file mode 100644
index 0af02fcc12..0000000000
--- a/packages/lambda/src/functions/streaming/streaming.ts
+++ /dev/null
@@ -1,137 +0,0 @@
-type OnMessage = (
- type: 'error' | 'success',
- nonce: string,
- data: Buffer,
-) => void;
-
-export const makeStreaming = (onMessage: OnMessage) => {
- let outputBuffer = Buffer.from('');
-
- const separator = Buffer.from('remotion_buffer:');
- let unprocessedBuffers: Buffer[] = [];
-
- let missingData: null | {
- dataMissing: number;
- } = null;
-
- const processInput = () => {
- let separatorIndex = outputBuffer.indexOf(separator);
- if (separatorIndex === -1) {
- return;
- }
-
- separatorIndex += separator.length;
-
- let nonceString = '';
- let lengthString = '';
- let statusString = '';
-
- // Each message from Rust is prefixed with `remotion_buffer;{[nonce]}:{[length]}`
- // Let's read the buffer to extract the nonce, and if the full length is available,
- // we'll extract the data and pass it to the callback.
-
- // eslint-disable-next-line no-constant-condition
- while (true) {
- const nextDigit = outputBuffer[separatorIndex];
- // 0x3a is the character ":"
- if (nextDigit === 0x3a) {
- separatorIndex++;
- break;
- }
-
- separatorIndex++;
-
- nonceString += String.fromCharCode(nextDigit);
- }
-
- // eslint-disable-next-line no-constant-condition
- while (true) {
- const nextDigit = outputBuffer[separatorIndex];
- if (nextDigit === 0x3a) {
- separatorIndex++;
- break;
- }
-
- separatorIndex++;
-
- lengthString += String.fromCharCode(nextDigit);
- }
-
- // eslint-disable-next-line no-constant-condition
- while (true) {
- const nextDigit = outputBuffer[separatorIndex];
- if (nextDigit === 0x3a) {
- break;
- }
-
- separatorIndex++;
-
- statusString += String.fromCharCode(nextDigit);
- }
-
- const length = Number(lengthString);
- const status = Number(statusString);
-
- const dataLength = outputBuffer.length - separatorIndex - 1;
- if (dataLength < length) {
- missingData = {
- dataMissing: length - dataLength,
- };
-
- return;
- }
-
- const data = outputBuffer.subarray(
- separatorIndex + 1,
- separatorIndex + 1 + Number(lengthString),
- );
- onMessage(status === 1 ? 'error' : 'success', nonceString, data);
- missingData = null;
-
- outputBuffer = outputBuffer.subarray(
- separatorIndex + Number(lengthString) + 1,
- );
- processInput();
- };
-
- return {
- addData: (data: Buffer) => {
- unprocessedBuffers.push(data);
- const separatorIndex = data.indexOf(separator);
- if (separatorIndex === -1) {
- if (missingData) {
- missingData.dataMissing -= data.length;
- }
-
- if (!missingData || missingData.dataMissing > 0) {
- return;
- }
- }
-
- unprocessedBuffers.unshift(outputBuffer);
-
- outputBuffer = Buffer.concat(unprocessedBuffers);
- unprocessedBuffers = [];
- processInput();
- },
- };
-};
-
-export const makePayloadMessage = (
- nonce: number,
- data: Buffer,
- status: 0 | 1,
-): Buffer => {
- const concat = Buffer.concat([
- Buffer.from('remotion_buffer:'),
- Buffer.from(nonce.toString()),
- Buffer.from(':'),
- Buffer.from(data.length.toString()),
- Buffer.from(':'),
- Buffer.from(String(status)),
- Buffer.from(':'),
- data,
- ]);
-
- return concat;
-};
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index 80763f27ce..8d50b1588b 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -275,7 +275,6 @@ export type LambdaStartPayload = {
offthreadVideoCacheSizeInBytes: number | null;
deleteAfter: DeleteAfter | null;
colorSpace: ColorSpace;
- enableStreaming: boolean;
};
export type LambdaStatusPayload = {
@@ -331,7 +330,6 @@ export type LambdaPayloads = {
offthreadVideoCacheSizeInBytes: number | null;
deleteAfter: DeleteAfter | null;
colorSpace: ColorSpace;
- enableStreaming: boolean;
};
status: LambdaStatusPayload;
renderer: {
@@ -374,7 +372,6 @@ export type LambdaPayloads = {
offthreadVideoCacheSizeInBytes: number | null;
deleteAfter: DeleteAfter | null;
colorSpace: ColorSpace;
- enableStreaming: boolean;
};
still: {
type: LambdaRoutines.still;
diff --git a/packages/lambda/src/test/integration/renders/gif.test.ts b/packages/lambda/src/test/integration/renders/gif.test.ts
index b71d00ed4b..0035cf5c2d 100644
--- a/packages/lambda/src/test/integration/renders/gif.test.ts
+++ b/packages/lambda/src/test/integration/renders/gif.test.ts
@@ -66,7 +66,6 @@ test('Should make a distributed GIF', async () => {
offthreadVideoCacheSizeInBytes: null,
deleteAfter: null,
colorSpace: 'default',
- enableStreaming: false,
},
functionName: 'remotion-dev-lambda',
receivedStreamingPayload: () => undefined,
diff --git a/packages/lambda/src/test/integration/renders/old-version.test.ts b/packages/lambda/src/test/integration/renders/old-version.test.ts
index ece3cf4172..17a7e75eba 100644
--- a/packages/lambda/src/test/integration/renders/old-version.test.ts
+++ b/packages/lambda/src/test/integration/renders/old-version.test.ts
@@ -64,7 +64,6 @@ test('Should fail when using an incompatible version', async () => {
offthreadVideoCacheSizeInBytes: null,
deleteAfter: null,
colorSpace: 'default',
- enableStreaming: false,
},
functionName: 'remotion-dev-render',
receivedStreamingPayload: () => undefined,
diff --git a/packages/lambda/src/test/integration/renders/other-bucket.test.ts b/packages/lambda/src/test/integration/renders/other-bucket.test.ts
index 85e9713dbb..ec7a6ab361 100644
--- a/packages/lambda/src/test/integration/renders/other-bucket.test.ts
+++ b/packages/lambda/src/test/integration/renders/other-bucket.test.ts
@@ -69,7 +69,6 @@ test('Should be able to render to another bucket', async () => {
offthreadVideoCacheSizeInBytes: null,
deleteAfter: null,
colorSpace: 'default',
- enableStreaming: false,
},
functionName: 'remotion-dev-render',
receivedStreamingPayload: () => undefined,
diff --git a/packages/lambda/src/test/integration/renders/silent-audio.test.ts b/packages/lambda/src/test/integration/renders/silent-audio.test.ts
index dcad635a0a..6ca68b18fb 100644
--- a/packages/lambda/src/test/integration/renders/silent-audio.test.ts
+++ b/packages/lambda/src/test/integration/renders/silent-audio.test.ts
@@ -65,7 +65,6 @@ test('Should add silent audio if there is no audio', async () => {
offthreadVideoCacheSizeInBytes: null,
deleteAfter: null,
colorSpace: 'default',
- enableStreaming: false,
},
functionName: 'remotion-dev-render',
receivedStreamingPayload: () => undefined,
diff --git a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
index a986b4465b..a0eb66481a 100644
--- a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
+++ b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
@@ -69,7 +69,6 @@ test('Should make a transparent video', async () => {
offthreadVideoCacheSizeInBytes: null,
deleteAfter: null,
colorSpace: 'default',
- enableStreaming: false,
},
functionName: 'remotion-dev-render',
receivedStreamingPayload: () => undefined,
diff --git a/packages/lambda/src/test/integration/webhooks.test.ts b/packages/lambda/src/test/integration/webhooks.test.ts
index 7cc9cd5acc..05aa006905 100644
--- a/packages/lambda/src/test/integration/webhooks.test.ts
+++ b/packages/lambda/src/test/integration/webhooks.test.ts
@@ -108,7 +108,6 @@ describe('Webhooks', () => {
offthreadVideoCacheSizeInBytes: null,
deleteAfter: null,
colorSpace: 'default',
- enableStreaming: false,
},
functionName: 'remotion-dev-lambda',
receivedStreamingPayload: () => undefined,
@@ -207,7 +206,6 @@ describe('Webhooks', () => {
audioCodec: null,
deleteAfter: null,
colorSpace: 'default',
- enableStreaming: false,
},
timeoutInTest: 1000,
retriesRemaining: 0,