@remotion/renderer 4.0.382 → 4.0.384

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.
@@ -11,9 +11,18 @@ const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
11
11
  const sample_rate_1 = require("./sample-rate");
12
12
  const truthy_1 = require("./truthy");
13
13
  exports.durationOf1Frame = (1024 / sample_rate_1.DEFAULT_SAMPLE_RATE) * 1000000;
14
+ const roundWithFix = (targetTime) => {
15
+ // Round values where the fractional part is > 0.4999999 up to the next integer,
16
+ // otherwise round down. This addresses floating-point precision issues that can
17
+ // lead to audio imperfections, such as demonstrated in https://github.com/remotion-dev/remotion/issues/6010
18
+ if (targetTime % 1 > 0.4999999) {
19
+ return Math.ceil(targetTime);
20
+ }
21
+ return Math.floor(targetTime);
22
+ };
14
23
  const getClosestAlignedTime = (targetTime) => {
15
24
  const decimalFramesToTargetTime = (targetTime * 1000000) / exports.durationOf1Frame;
16
- const nearestFrameIndexForTargetTime = Math.round(decimalFramesToTargetTime);
25
+ const nearestFrameIndexForTargetTime = roundWithFix(decimalFramesToTargetTime);
17
26
  return (nearestFrameIndexForTargetTime * exports.durationOf1Frame) / 1000000;
18
27
  };
19
28
  exports.getClosestAlignedTime = getClosestAlignedTime;
@@ -17571,9 +17571,15 @@ var parseFfmpegProgress = (input, fps) => {
17571
17571
 
17572
17572
  // src/combine-audio.ts
17573
17573
  var durationOf1Frame = 1024 / DEFAULT_SAMPLE_RATE * 1e6;
17574
+ var roundWithFix = (targetTime) => {
17575
+ if (targetTime % 1 > 0.4999999) {
17576
+ return Math.ceil(targetTime);
17577
+ }
17578
+ return Math.floor(targetTime);
17579
+ };
17574
17580
  var getClosestAlignedTime = (targetTime) => {
17575
17581
  const decimalFramesToTargetTime = targetTime * 1e6 / durationOf1Frame;
17576
- const nearestFrameIndexForTargetTime = Math.round(decimalFramesToTargetTime);
17582
+ const nearestFrameIndexForTargetTime = roundWithFix(decimalFramesToTargetTime);
17577
17583
  return nearestFrameIndexForTargetTime * durationOf1Frame / 1e6;
17578
17584
  };
17579
17585
  var encodeAudio = async ({
@@ -21793,8 +21799,8 @@ var internalRenderMediaRaw = ({
21793
21799
  crf,
21794
21800
  assetsInfo,
21795
21801
  onProgress: (frame) => {
21796
- stitchStage = "muxing";
21797
21802
  if (preEncodedFileLocation) {
21803
+ stitchStage = "muxing";
21798
21804
  muxedFrames = Math.min(frame, totalFramesToRender);
21799
21805
  } else {
21800
21806
  muxedFrames = Math.min(frame, totalFramesToRender);
@@ -424,10 +424,10 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition: c
424
424
  crf,
425
425
  assetsInfo,
426
426
  onProgress: (frame) => {
427
- stitchStage = 'muxing';
428
427
  // With seamless AAC concatenation, the amount of rendered frames
429
428
  // might be longer, so we need to clamp it to avoid progress over 100%
430
429
  if (preEncodedFileLocation) {
430
+ stitchStage = 'muxing';
431
431
  muxedFrames = Math.min(frame, totalFramesToRender);
432
432
  }
433
433
  else {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/renderer"
4
4
  },
5
5
  "name": "@remotion/renderer",
6
- "version": "4.0.382",
6
+ "version": "4.0.384",
7
7
  "description": "Render Remotion videos using Node.js or Bun",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -22,11 +22,11 @@
22
22
  "dependencies": {
23
23
  "execa": "5.1.1",
24
24
  "extract-zip": "2.0.1",
25
- "remotion": "4.0.382",
26
- "@remotion/streaming": "4.0.382",
25
+ "remotion": "4.0.384",
26
+ "@remotion/streaming": "4.0.384",
27
27
  "source-map": "^0.8.0-beta.0",
28
28
  "ws": "8.17.1",
29
- "@remotion/licensing": "4.0.382"
29
+ "@remotion/licensing": "4.0.384"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=16.8.0",
@@ -39,19 +39,19 @@
39
39
  "react": "19.2.1",
40
40
  "react-dom": "19.2.1",
41
41
  "@types/ws": "8.5.10",
42
- "@remotion/example-videos": "4.0.382",
43
- "@remotion/eslint-config-internal": "4.0.382",
42
+ "@remotion/example-videos": "4.0.384",
43
+ "@remotion/eslint-config-internal": "4.0.384",
44
44
  "eslint": "9.19.0",
45
45
  "@types/node": "20.12.14"
46
46
  },
47
47
  "optionalDependencies": {
48
- "@remotion/compositor-darwin-arm64": "4.0.382",
49
- "@remotion/compositor-darwin-x64": "4.0.382",
50
- "@remotion/compositor-linux-arm64-gnu": "4.0.382",
51
- "@remotion/compositor-linux-arm64-musl": "4.0.382",
52
- "@remotion/compositor-linux-x64-gnu": "4.0.382",
53
- "@remotion/compositor-linux-x64-musl": "4.0.382",
54
- "@remotion/compositor-win32-x64-msvc": "4.0.382"
48
+ "@remotion/compositor-darwin-arm64": "4.0.384",
49
+ "@remotion/compositor-darwin-x64": "4.0.384",
50
+ "@remotion/compositor-linux-arm64-gnu": "4.0.384",
51
+ "@remotion/compositor-linux-arm64-musl": "4.0.384",
52
+ "@remotion/compositor-linux-x64-gnu": "4.0.384",
53
+ "@remotion/compositor-linux-x64-musl": "4.0.384",
54
+ "@remotion/compositor-win32-x64-msvc": "4.0.384"
55
55
  },
56
56
  "keywords": [
57
57
  "remotion",