@remotion/renderer 4.0.127 → 4.0.128

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.
@@ -1,5 +1,6 @@
1
1
  type ReturnType = {
2
- extraFramesToCaptureAssets: number[];
2
+ extraFramesToCaptureAssetsFrontend: number[];
3
+ extraFramesToCaptureAssetsBackend: number[];
3
4
  trimLeftOffset: number;
4
5
  trimRightOffset: number;
5
6
  chunkLengthInSeconds: number;
@@ -12,7 +12,8 @@ const getExtraFramesToCapture = ({ compositionStart, realFrameRange, fps, forSea
12
12
  // If the feature is disabled, don't capture extra frames.
13
13
  if (!forSeamlessAacConcatenation) {
14
14
  return {
15
- extraFramesToCaptureAssets: [],
15
+ extraFramesToCaptureAssetsBackend: [],
16
+ extraFramesToCaptureAssetsFrontend: [],
16
17
  chunkLengthInSeconds: (realFrameRange[1] - realFrameRange[0] + 1) / fps,
17
18
  trimLeftOffset: 0,
18
19
  trimRightOffset: 0,
@@ -51,10 +52,8 @@ const getExtraFramesToCapture = ({ compositionStart, realFrameRange, fps, forSea
51
52
  const trimRightOffset = (aacAdjustedRightEnd * fps - Math.ceil(aacAdjustedRightEnd * fps)) / fps;
52
53
  const chunkLengthInSeconds = aacAdjustedRightEnd - aacAdjustedLeftEnd;
53
54
  return {
54
- extraFramesToCaptureAssets: [
55
- ...extraFramesToCaptureAudioOnlyFrontend,
56
- ...extraFramesToCaptureAudioOnlyBackend,
57
- ],
55
+ extraFramesToCaptureAssetsFrontend: extraFramesToCaptureAudioOnlyFrontend,
56
+ extraFramesToCaptureAssetsBackend: extraFramesToCaptureAudioOnlyBackend,
58
57
  chunkLengthInSeconds,
59
58
  trimLeftOffset,
60
59
  trimRightOffset,
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import execa from 'execa';
2
4
  import { HeadlessBrowser } from './browser/Browser';
3
5
  import { SymbolicateableError } from './error-handling/symbolicateable-error';
@@ -1,3 +1,7 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ /// <reference types="node" />
1
5
  import type { NetworkInterfaceInfo } from 'os';
2
6
  import os from 'os';
3
7
  type PortConfig = {
@@ -48,7 +48,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
48
48
  }
49
49
  const downloadPromises = [];
50
50
  const realFrameRange = (0, get_frame_to_render_1.getRealFrameRange)(composition.durationInFrames, frameRange);
51
- const { extraFramesToCaptureAssets, chunkLengthInSeconds, trimLeftOffset, trimRightOffset, } = (0, get_extra_frames_to_capture_1.getExtraFramesToCapture)({
51
+ const { extraFramesToCaptureAssetsBackend, extraFramesToCaptureAssetsFrontend, chunkLengthInSeconds, trimLeftOffset, trimRightOffset, } = (0, get_extra_frames_to_capture_1.getExtraFramesToCapture)({
52
52
  fps: composition.fps,
53
53
  compositionStart,
54
54
  realFrameRange,
@@ -306,7 +306,12 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
306
306
  });
307
307
  }
308
308
  };
309
- const extraFrames = Promise.all(extraFramesToCaptureAssets.map((frame) => {
309
+ // Render the extra frames at the beginning of the video first,
310
+ // then the regular frames, then the extra frames at the end of the video.
311
+ // While the order technically doesn't matter, components such as <Video> are
312
+ // not always frame perfect and give a flicker.
313
+ // We reduce the chance of flicker by rendering the frames in order.
314
+ await Promise.all(extraFramesToCaptureAssetsFrontend.map((frame) => {
310
315
  return renderFrameAndRetryTargetClose({
311
316
  frame,
312
317
  index: null,
@@ -315,7 +320,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
315
320
  assetsOnly: true,
316
321
  });
317
322
  }));
318
- const mainFrames = Promise.all(framesToRender.map((frame, index) => {
323
+ await Promise.all(framesToRender.map((frame, index) => {
319
324
  return renderFrameAndRetryTargetClose({
320
325
  frame,
321
326
  index,
@@ -324,28 +329,32 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
324
329
  assetsOnly: false,
325
330
  });
326
331
  }));
327
- const happyPath = Promise.all([extraFrames, mainFrames]).then(() => {
328
- const firstFrameIndex = countType === 'from-zero' ? 0 : framesToRender[0];
329
- const returnValue = {
330
- assetsInfo: {
331
- assets: assets.sort((a, b) => {
332
- return a.frame - b.frame;
333
- }),
334
- imageSequenceName: node_path_1.default.join(frameDir, `element-%0${filePadLength}d.${imageFormat}`),
335
- firstFrameIndex,
336
- downloadMap,
337
- trimLeftOffset,
338
- trimRightOffset,
339
- chunkLengthInSeconds,
340
- forSeamlessAacConcatenation,
341
- },
342
- frameCount: framesToRender.length,
343
- };
344
- return returnValue;
345
- });
346
- const result = await happyPath;
332
+ await Promise.all(extraFramesToCaptureAssetsBackend.map((frame) => {
333
+ return renderFrameAndRetryTargetClose({
334
+ frame,
335
+ index: null,
336
+ retriesLeft: MAX_RETRIES_PER_FRAME,
337
+ attempt: 1,
338
+ assetsOnly: true,
339
+ });
340
+ }));
341
+ const firstFrameIndex = countType === 'from-zero' ? 0 : framesToRender[0];
347
342
  await Promise.all(downloadPromises);
348
- return result;
343
+ return {
344
+ assetsInfo: {
345
+ assets: assets.sort((a, b) => {
346
+ return a.frame - b.frame;
347
+ }),
348
+ imageSequenceName: node_path_1.default.join(frameDir, `element-%0${filePadLength}d.${imageFormat}`),
349
+ firstFrameIndex,
350
+ downloadMap,
351
+ trimLeftOffset,
352
+ trimRightOffset,
353
+ chunkLengthInSeconds,
354
+ forSeamlessAacConcatenation,
355
+ },
356
+ frameCount: framesToRender.length,
357
+ };
349
358
  };
350
359
  const internalRenderFramesRaw = ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, offthreadVideoCacheSizeInBytes, parallelEncodingEnabled, binariesDirectory, forSeamlessAacConcatenation, compositionStart, }) => {
351
360
  (0, validate_1.validateDimension)(composition.height, 'height', 'in the `config` object passed to `renderFrames()`');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.127",
3
+ "version": "4.0.128",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "extract-zip": "2.0.1",
19
19
  "source-map": "^0.8.0-beta.0",
20
20
  "ws": "8.7.0",
21
- "remotion": "4.0.127"
21
+ "remotion": "4.0.128"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -40,13 +40,13 @@
40
40
  "vitest": "0.31.1"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@remotion/compositor-darwin-arm64": "4.0.127",
44
- "@remotion/compositor-darwin-x64": "4.0.127",
45
- "@remotion/compositor-linux-arm64-musl": "4.0.127",
46
- "@remotion/compositor-linux-arm64-gnu": "4.0.127",
47
- "@remotion/compositor-linux-x64-gnu": "4.0.127",
48
- "@remotion/compositor-linux-x64-musl": "4.0.127",
49
- "@remotion/compositor-win32-x64-msvc": "4.0.127"
43
+ "@remotion/compositor-darwin-x64": "4.0.128",
44
+ "@remotion/compositor-darwin-arm64": "4.0.128",
45
+ "@remotion/compositor-linux-arm64-gnu": "4.0.128",
46
+ "@remotion/compositor-linux-x64-gnu": "4.0.128",
47
+ "@remotion/compositor-linux-arm64-musl": "4.0.128",
48
+ "@remotion/compositor-linux-x64-musl": "4.0.128",
49
+ "@remotion/compositor-win32-x64-msvc": "4.0.128"
50
50
  },
51
51
  "keywords": [
52
52
  "remotion",