@remotion/renderer 4.0.242 → 4.0.244

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.
@@ -4,6 +4,7 @@ import type { RenderMediaOnDownload } from './download-and-map-assets-to-file';
4
4
  export type AudioChannelsAndDurationResultCache = {
5
5
  channels: number;
6
6
  duration: number | null;
7
+ startTime: number | null;
7
8
  };
8
9
  export type DownloadMap = {
9
10
  id: string;
@@ -7,7 +7,8 @@ const limit = (0, p_limit_1.pLimit)(1);
7
7
  const getAudioChannelsAndDurationWithoutCache = async ({ src, indent, logLevel, binariesDirectory, cancelSignal, }) => {
8
8
  const args = [
9
9
  ['-v', 'error'],
10
- ['-show_entries', 'stream=channels:format=duration'],
10
+ ['-select_streams', 'a:0'],
11
+ ['-show_entries', 'stream=channels:stream=start_time:format=duration'],
11
12
  ['-of', 'default=nw=1'],
12
13
  [src],
13
14
  ]
@@ -24,9 +25,11 @@ const getAudioChannelsAndDurationWithoutCache = async ({ src, indent, logLevel,
24
25
  });
25
26
  const channels = task.stdout.match(/channels=([0-9]+)/);
26
27
  const duration = task.stdout.match(/duration=([0-9.]+)/);
28
+ const startTime = task.stdout.match(/start_time=([0-9.]+)/);
27
29
  const result = {
28
30
  channels: channels ? parseInt(channels[1], 10) : 0,
29
31
  duration: duration ? parseFloat(duration[1]) : null,
32
+ startTime: startTime ? parseFloat(startTime[1]) : null,
30
33
  };
31
34
  return result;
32
35
  }
@@ -13,7 +13,7 @@ const sample_rate_1 = require("./sample-rate");
13
13
  const stringify_ffmpeg_filter_1 = require("./stringify-ffmpeg-filter");
14
14
  const preprocessAudioTrackUnlimited = async ({ outName, asset, fps, downloadMap, indent, logLevel, binariesDirectory, cancelSignal, onProgress, chunkLengthInSeconds, trimLeftOffset, trimRightOffset, forSeamlessAacConcatenation, }) => {
15
15
  var _a;
16
- const { channels, duration } = await (0, get_audio_channels_1.getAudioChannelsAndDuration)({
16
+ const { channels, duration, startTime } = await (0, get_audio_channels_1.getAudioChannelsAndDuration)({
17
17
  downloadMap,
18
18
  src: (0, resolve_asset_src_1.resolveAssetSrc)(asset.src),
19
19
  indent,
@@ -33,6 +33,7 @@ const preprocessAudioTrackUnlimited = async ({ outName, asset, fps, downloadMap,
33
33
  volume: (0, flatten_volume_array_1.flattenVolumeArray)(asset.volume),
34
34
  indent,
35
35
  logLevel,
36
+ presentationTimeOffsetInSeconds: startTime !== null && startTime !== void 0 ? startTime : 0,
36
37
  });
37
38
  if (filter === null) {
38
39
  return null;
@@ -48,7 +49,7 @@ const preprocessAudioTrackUnlimited = async ({ outName, asset, fps, downloadMap,
48
49
  ['-y', outName],
49
50
  ].flat(2);
50
51
  logger_1.Log.verbose({ indent, logLevel }, 'Preprocessing audio track:', JSON.stringify(args.join(' ')), 'Filter:', filter.filter);
51
- const startTime = Date.now();
52
+ const startTimestamp = Date.now();
52
53
  const task = (0, call_ffmpeg_1.callFf)({
53
54
  bin: 'ffmpeg',
54
55
  args,
@@ -65,7 +66,7 @@ const preprocessAudioTrackUnlimited = async ({ outName, asset, fps, downloadMap,
65
66
  }
66
67
  });
67
68
  await task;
68
- logger_1.Log.verbose({ indent, logLevel }, 'Preprocessed audio track', `${Date.now() - startTime}ms`);
69
+ logger_1.Log.verbose({ indent, logLevel }, 'Preprocessed audio track', `${Date.now() - startTimestamp}ms`);
69
70
  cleanup();
70
71
  return { outName, filter };
71
72
  };
@@ -18,7 +18,7 @@ export declare const getActualTrimLeft: ({ asset, fps, trimLeftOffset, seamless,
18
18
  trimLeft: number;
19
19
  maxTrim: number | null;
20
20
  };
21
- export declare const stringifyFfmpegFilter: ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, indent, logLevel, }: {
21
+ export declare const stringifyFfmpegFilter: ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, indent, logLevel, presentationTimeOffsetInSeconds, }: {
22
22
  channels: number;
23
23
  volume: AssetVolume;
24
24
  fps: number;
@@ -30,4 +30,5 @@ export declare const stringifyFfmpegFilter: ({ channels, volume, fps, assetDurat
30
30
  asset: MediaAsset;
31
31
  indent: boolean;
32
32
  logLevel: LogLevel;
33
+ presentationTimeOffsetInSeconds: number;
33
34
  }) => FilterWithoutPaddingApplied | null;
@@ -97,7 +97,7 @@ const trimAndSetTempo = ({ forSeamlessAacConcatenation, assetDuration, asset, tr
97
97
  }
98
98
  throw new Error('This should never happen');
99
99
  };
100
- const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, indent, logLevel, }) => {
100
+ const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, indent, logLevel, presentationTimeOffsetInSeconds, }) => {
101
101
  if (channels === 0) {
102
102
  return null;
103
103
  }
@@ -133,6 +133,7 @@ const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLeng
133
133
  allowAmplificationDuringRender: asset.allowAmplificationDuringRender,
134
134
  });
135
135
  const padAtEnd = chunkLengthInSeconds - audibleDuration - startInVideoSeconds;
136
+ const padStart = startInVideoSeconds + presentationTimeOffsetInSeconds;
136
137
  // Set as few filters as possible, as combining them can create noise
137
138
  return {
138
139
  filter: `[0:a]` +
@@ -162,10 +163,10 @@ const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLeng
162
163
  // This should be fine because FFMPEG documentation states:
163
164
  // "Unused delays will be silently ignored."
164
165
  // https://ffmpeg.org/ffmpeg-filters.html#adelay
165
- startInVideoSeconds === 0
166
+ padStart === 0
166
167
  ? null
167
168
  : `adelay=${new Array(channels + 1)
168
- .fill((startInVideoSeconds * 1000).toFixed(0))
169
+ .fill((padStart * 1000).toFixed(0))
169
170
  .join('|')}`,
170
171
  actualTrimLeft,
171
172
  };
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.242",
6
+ "version": "4.0.244",
7
7
  "description": "Render Remotion videos using Node.js or Bun",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "extract-zip": "2.0.1",
19
19
  "source-map": "^0.8.0-beta.0",
20
20
  "ws": "8.17.1",
21
- "remotion": "4.0.242",
22
- "@remotion/streaming": "4.0.242"
21
+ "remotion": "4.0.244",
22
+ "@remotion/streaming": "4.0.244"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=16.8.0",
@@ -33,17 +33,17 @@
33
33
  "react-dom": "19.0.0",
34
34
  "@types/ws": "8.5.10",
35
35
  "eslint": "9.14.0",
36
- "@remotion/eslint-config-internal": "4.0.242",
37
- "@remotion/example-videos": "4.0.242"
36
+ "@remotion/eslint-config-internal": "4.0.244",
37
+ "@remotion/example-videos": "4.0.244"
38
38
  },
39
39
  "optionalDependencies": {
40
- "@remotion/compositor-darwin-x64": "4.0.242",
41
- "@remotion/compositor-darwin-arm64": "4.0.242",
42
- "@remotion/compositor-linux-arm64-gnu": "4.0.242",
43
- "@remotion/compositor-linux-arm64-musl": "4.0.242",
44
- "@remotion/compositor-linux-x64-musl": "4.0.242",
45
- "@remotion/compositor-win32-x64-msvc": "4.0.242",
46
- "@remotion/compositor-linux-x64-gnu": "4.0.242"
40
+ "@remotion/compositor-darwin-arm64": "4.0.244",
41
+ "@remotion/compositor-darwin-x64": "4.0.244",
42
+ "@remotion/compositor-linux-x64-gnu": "4.0.244",
43
+ "@remotion/compositor-linux-arm64-musl": "4.0.244",
44
+ "@remotion/compositor-linux-x64-musl": "4.0.244",
45
+ "@remotion/compositor-win32-x64-msvc": "4.0.244",
46
+ "@remotion/compositor-linux-arm64-gnu": "4.0.244"
47
47
  },
48
48
  "keywords": [
49
49
  "remotion",