@remotion/renderer 4.0.132 → 4.0.134
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/combine-videos.d.ts +2 -1
- package/dist/combine-videos.js +20 -15
- package/dist/index.d.ts +12 -1
- package/dist/index.js +5 -1
- package/dist/mux-video-and-audio.d.ts +2 -2
- package/dist/mux-video-and-audio.js +6 -6
- package/dist/preprocess-audio-track.js +4 -2
- package/dist/render-has-audio.d.ts +8 -0
- package/dist/render-has-audio.js +20 -0
- package/dist/stitch-frames-to-video.js +11 -3
- package/dist/stringify-ffmpeg-filter.d.ts +1 -5
- package/dist/stringify-ffmpeg-filter.js +28 -23
- package/package.json +9 -9
package/dist/combine-videos.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ type Options = {
|
|
|
20
20
|
cancelSignal: CancelSignal | undefined;
|
|
21
21
|
seamlessAudio: boolean;
|
|
22
22
|
seamlessVideo: boolean;
|
|
23
|
+
muted: boolean;
|
|
23
24
|
};
|
|
24
|
-
export declare const
|
|
25
|
+
export declare const combineChunks: ({ files, filelistDir, output, onProgress, numberOfFrames, codec, fps, numberOfGifLoops, resolvedAudioCodec, audioBitrate, indent, logLevel, chunkDurationInSeconds, binariesDirectory, cancelSignal, seamlessAudio, seamlessVideo, muted, }: Options) => Promise<void>;
|
|
25
26
|
export {};
|
package/dist/combine-videos.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Combine multiple video chunks, useful for decentralized rendering
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.combineChunks = void 0;
|
|
5
5
|
const node_fs_1 = require("node:fs");
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
7
|
const combine_audio_1 = require("./combine-audio");
|
|
@@ -12,10 +12,12 @@ const logger_1 = require("./logger");
|
|
|
12
12
|
const mux_video_and_audio_1 = require("./mux-video-and-audio");
|
|
13
13
|
const audio_codec_1 = require("./options/audio-codec");
|
|
14
14
|
const truthy_1 = require("./truthy");
|
|
15
|
-
const
|
|
16
|
-
const shouldCreateAudio = resolvedAudioCodec !== null;
|
|
15
|
+
const combineChunks = async ({ files, filelistDir, output, onProgress, numberOfFrames, codec, fps, numberOfGifLoops, resolvedAudioCodec, audioBitrate, indent, logLevel, chunkDurationInSeconds, binariesDirectory, cancelSignal, seamlessAudio, seamlessVideo, muted, }) => {
|
|
16
|
+
const shouldCreateAudio = resolvedAudioCodec !== null && !muted;
|
|
17
17
|
const shouldCreateVideo = !(0, audio_codec_1.isAudioCodec)(codec);
|
|
18
|
-
const videoOutput =
|
|
18
|
+
const videoOutput = shouldCreateVideo
|
|
19
|
+
? (0, node_path_1.join)(filelistDir, `video.${(0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, resolvedAudioCodec)}`)
|
|
20
|
+
: null;
|
|
19
21
|
const audioOutput = shouldCreateAudio
|
|
20
22
|
? (0, node_path_1.join)(filelistDir, `audio.${(0, audio_codec_1.getExtensionFromAudioCodec)(resolvedAudioCodec)}`)
|
|
21
23
|
: null;
|
|
@@ -31,16 +33,24 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
|
|
|
31
33
|
const actualProgress = concatenatedAudio + concatenatedVideo + muxing;
|
|
32
34
|
onProgress((actualProgress / totalFrames) * numberOfFrames);
|
|
33
35
|
};
|
|
34
|
-
logger_1.Log.verbose({ indent, logLevel }, `Combining chunks, audio = ${
|
|
36
|
+
logger_1.Log.verbose({ indent, logLevel }, `Combining chunks, audio = ${shouldCreateAudio === false
|
|
37
|
+
? 'no'
|
|
38
|
+
: seamlessAudio
|
|
39
|
+
? 'seamlessly'
|
|
40
|
+
: 'normally'}, video = ${shouldCreateVideo === false
|
|
41
|
+
? 'no'
|
|
42
|
+
: seamlessVideo
|
|
43
|
+
? 'seamlessly'
|
|
44
|
+
: 'normally'}`);
|
|
35
45
|
await Promise.all([
|
|
36
|
-
shouldCreateAudio
|
|
46
|
+
shouldCreateAudio && audioOutput
|
|
37
47
|
? (0, combine_audio_1.createCombinedAudio)({
|
|
38
48
|
audioBitrate,
|
|
39
49
|
filelistDir,
|
|
40
50
|
files: audioFiles,
|
|
41
51
|
indent,
|
|
42
52
|
logLevel,
|
|
43
|
-
output:
|
|
53
|
+
output: audioOutput,
|
|
44
54
|
resolvedAudioCodec,
|
|
45
55
|
seamless: seamlessAudio,
|
|
46
56
|
chunkDurationInSeconds,
|
|
@@ -54,7 +64,7 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
|
|
|
54
64
|
},
|
|
55
65
|
})
|
|
56
66
|
: null,
|
|
57
|
-
shouldCreateVideo && !seamlessVideo
|
|
67
|
+
shouldCreateVideo && !seamlessVideo && videoOutput
|
|
58
68
|
? (0, combine_video_streams_1.combineVideoStreams)({
|
|
59
69
|
codec,
|
|
60
70
|
filelistDir,
|
|
@@ -62,7 +72,7 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
|
|
|
62
72
|
indent,
|
|
63
73
|
logLevel,
|
|
64
74
|
numberOfGifLoops,
|
|
65
|
-
output:
|
|
75
|
+
output: videoOutput,
|
|
66
76
|
files: videoFiles,
|
|
67
77
|
addRemotionMetadata: !shouldCreateAudio,
|
|
68
78
|
binariesDirectory,
|
|
@@ -74,11 +84,6 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
|
|
|
74
84
|
})
|
|
75
85
|
: null,
|
|
76
86
|
].filter(truthy_1.truthy));
|
|
77
|
-
// Either only audio or only video
|
|
78
|
-
if (!(audioOutput && shouldCreateVideo)) {
|
|
79
|
-
(0, node_fs_1.rmSync)(filelistDir, { recursive: true });
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
87
|
try {
|
|
83
88
|
await (0, mux_video_and_audio_1.muxVideoAndAudio)({
|
|
84
89
|
audioOutput,
|
|
@@ -104,4 +109,4 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
|
|
|
104
109
|
throw err;
|
|
105
110
|
}
|
|
106
111
|
};
|
|
107
|
-
exports.
|
|
112
|
+
exports.combineChunks = combineChunks;
|
package/dist/index.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ export declare const RenderInternals: {
|
|
|
160
160
|
}) => number;
|
|
161
161
|
findRemotionRoot: () => string;
|
|
162
162
|
validateBitrate: (bitrate: unknown, name: string) => void;
|
|
163
|
-
|
|
163
|
+
combineChunks: ({ files, filelistDir, output, onProgress, numberOfFrames, codec, fps, numberOfGifLoops, resolvedAudioCodec, audioBitrate, indent, logLevel, chunkDurationInSeconds, binariesDirectory, cancelSignal, seamlessAudio, seamlessVideo, muted, }: {
|
|
164
164
|
files: string[];
|
|
165
165
|
filelistDir: string;
|
|
166
166
|
output: string;
|
|
@@ -178,6 +178,7 @@ export declare const RenderInternals: {
|
|
|
178
178
|
cancelSignal: import("./make-cancel-signal").CancelSignal | undefined;
|
|
179
179
|
seamlessAudio: boolean;
|
|
180
180
|
seamlessVideo: boolean;
|
|
181
|
+
muted: boolean;
|
|
181
182
|
}) => Promise<void>;
|
|
182
183
|
getMinConcurrency: () => number;
|
|
183
184
|
getMaxConcurrency: () => number;
|
|
@@ -747,4 +748,14 @@ export declare const RenderInternals: {
|
|
|
747
748
|
preferLossless: boolean;
|
|
748
749
|
separateAudioTo: string | null;
|
|
749
750
|
}) => "mp3" | "aac" | "pcm-16" | "opus" | null;
|
|
751
|
+
getShouldRenderAudio: ({ codec, assetsInfo, enforceAudioTrack, muted, }: {
|
|
752
|
+
codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
|
|
753
|
+
assetsInfo: import("./assets/download-map").RenderAssetInfo | null;
|
|
754
|
+
enforceAudioTrack: boolean;
|
|
755
|
+
muted: boolean;
|
|
756
|
+
}) => "yes" | "maybe" | "no";
|
|
757
|
+
codecSupportsMedia: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif") => {
|
|
758
|
+
video: boolean;
|
|
759
|
+
audio: boolean;
|
|
760
|
+
};
|
|
750
761
|
};
|
package/dist/index.js
CHANGED
|
@@ -109,8 +109,10 @@ Object.defineProperty(exports, "stitchFramesToVideo", { enumerable: true, get: f
|
|
|
109
109
|
var validate_output_filename_1 = require("./validate-output-filename");
|
|
110
110
|
Object.defineProperty(exports, "validateOutputFilename", { enumerable: true, get: function () { return validate_output_filename_1.validateOutputFilename; } });
|
|
111
111
|
const download_map_1 = require("./assets/download-map");
|
|
112
|
+
const codec_supports_media_1 = require("./codec-supports-media");
|
|
112
113
|
const make_file_executable_1 = require("./compositor/make-file-executable");
|
|
113
114
|
const audio_codec_1 = require("./options/audio-codec");
|
|
115
|
+
const render_has_audio_1 = require("./render-has-audio");
|
|
114
116
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
115
117
|
const validate_videobitrate_1 = require("./validate-videobitrate");
|
|
116
118
|
const wait_for_symbolication_error_to_be_done_1 = require("./wait-for-symbolication-error-to-be-done");
|
|
@@ -160,7 +162,7 @@ exports.RenderInternals = {
|
|
|
160
162
|
convertToPositiveFrameIndex: convert_to_positive_frame_index_1.convertToPositiveFrameIndex,
|
|
161
163
|
findRemotionRoot: find_closest_package_json_1.findRemotionRoot,
|
|
162
164
|
validateBitrate: validate_videobitrate_1.validateBitrate,
|
|
163
|
-
|
|
165
|
+
combineChunks: combine_videos_1.combineChunks,
|
|
164
166
|
getMinConcurrency: validate_concurrency_1.getMinConcurrency,
|
|
165
167
|
getMaxConcurrency: validate_concurrency_1.getMaxConcurrency,
|
|
166
168
|
getDefaultAudioCodec: audio_codec_1.getDefaultAudioCodec,
|
|
@@ -197,6 +199,8 @@ exports.RenderInternals = {
|
|
|
197
199
|
getExtensionFromAudioCodec: audio_codec_1.getExtensionFromAudioCodec,
|
|
198
200
|
makeFileExecutableIfItIsNot: make_file_executable_1.makeFileExecutableIfItIsNot,
|
|
199
201
|
resolveAudioCodec: audio_codec_1.resolveAudioCodec,
|
|
202
|
+
getShouldRenderAudio: render_has_audio_1.getShouldRenderAudio,
|
|
203
|
+
codecSupportsMedia: codec_supports_media_1.codecSupportsMedia,
|
|
200
204
|
};
|
|
201
205
|
// Warn of potential performance issues with Apple Silicon (M1 chip under Rosetta)
|
|
202
206
|
(0, check_version_requirements_1.checkNodeVersionAndWarnAboutRosetta)('info', false);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { LogLevel } from './log-level';
|
|
2
2
|
import type { CancelSignal } from './make-cancel-signal';
|
|
3
3
|
export declare const muxVideoAndAudio: ({ videoOutput, audioOutput, output, indent, logLevel, onProgress, binariesDirectory, fps, cancelSignal, }: {
|
|
4
|
-
videoOutput: string;
|
|
5
|
-
audioOutput: string;
|
|
4
|
+
videoOutput: string | null;
|
|
5
|
+
audioOutput: string | null;
|
|
6
6
|
output: string;
|
|
7
7
|
indent: boolean;
|
|
8
8
|
logLevel: LogLevel;
|
|
@@ -12,14 +12,14 @@ const muxVideoAndAudio = async ({ videoOutput, audioOutput, output, indent, logL
|
|
|
12
12
|
logger_1.Log.verbose({ indent, logLevel }, 'Muxing video and audio together');
|
|
13
13
|
const command = [
|
|
14
14
|
'-hide_banner',
|
|
15
|
-
'-i',
|
|
15
|
+
videoOutput ? '-i' : null,
|
|
16
16
|
videoOutput,
|
|
17
|
-
'-i',
|
|
17
|
+
audioOutput ? '-i' : null,
|
|
18
18
|
audioOutput,
|
|
19
|
-
'-c:v',
|
|
20
|
-
'copy',
|
|
21
|
-
'-c:a',
|
|
22
|
-
'copy',
|
|
19
|
+
videoOutput ? '-c:v' : null,
|
|
20
|
+
videoOutput ? 'copy' : null,
|
|
21
|
+
audioOutput ? '-c:a' : null,
|
|
22
|
+
audioOutput ? 'copy' : null,
|
|
23
23
|
`-metadata`,
|
|
24
24
|
`comment=Made with Remotion ${version_1.VERSION}`,
|
|
25
25
|
'-y',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.preprocessAudioTrack = void 0;
|
|
4
|
+
const flatten_volume_array_1 = require("./assets/flatten-volume-array");
|
|
4
5
|
const get_audio_channels_1 = require("./assets/get-audio-channels");
|
|
5
|
-
const calculate_ffmpeg_filters_1 = require("./calculate-ffmpeg-filters");
|
|
6
6
|
const call_ffmpeg_1 = require("./call-ffmpeg");
|
|
7
7
|
const ffmpeg_filter_file_1 = require("./ffmpeg-filter-file");
|
|
8
8
|
const logger_1 = require("./logger");
|
|
@@ -10,6 +10,7 @@ const p_limit_1 = require("./p-limit");
|
|
|
10
10
|
const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
|
|
11
11
|
const resolve_asset_src_1 = require("./resolve-asset-src");
|
|
12
12
|
const sample_rate_1 = require("./sample-rate");
|
|
13
|
+
const stringify_ffmpeg_filter_1 = require("./stringify-ffmpeg-filter");
|
|
13
14
|
const preprocessAudioTrackUnlimited = async ({ outName, asset, fps, downloadMap, indent, logLevel, binariesDirectory, cancelSignal, onProgress, chunkLengthInSeconds, trimLeftOffset, trimRightOffset, forSeamlessAacConcatenation, }) => {
|
|
14
15
|
var _a;
|
|
15
16
|
const { channels, duration } = await (0, get_audio_channels_1.getAudioChannelsAndDuration)({
|
|
@@ -20,7 +21,7 @@ const preprocessAudioTrackUnlimited = async ({ outName, asset, fps, downloadMap,
|
|
|
20
21
|
binariesDirectory,
|
|
21
22
|
cancelSignal,
|
|
22
23
|
});
|
|
23
|
-
const filter = (0,
|
|
24
|
+
const filter = (0, stringify_ffmpeg_filter_1.stringifyFfmpegFilter)({
|
|
24
25
|
asset,
|
|
25
26
|
fps,
|
|
26
27
|
channels,
|
|
@@ -29,6 +30,7 @@ const preprocessAudioTrackUnlimited = async ({ outName, asset, fps, downloadMap,
|
|
|
29
30
|
trimLeftOffset,
|
|
30
31
|
trimRightOffset,
|
|
31
32
|
forSeamlessAacConcatenation,
|
|
33
|
+
volume: (0, flatten_volume_array_1.flattenVolumeArray)(asset.volume),
|
|
32
34
|
});
|
|
33
35
|
if (filter === null) {
|
|
34
36
|
return null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RenderAssetInfo } from './assets/download-map';
|
|
2
|
+
import type { Codec } from './codec';
|
|
3
|
+
export declare const getShouldRenderAudio: ({ codec, assetsInfo, enforceAudioTrack, muted, }: {
|
|
4
|
+
codec: Codec;
|
|
5
|
+
assetsInfo: RenderAssetInfo | null;
|
|
6
|
+
enforceAudioTrack: boolean;
|
|
7
|
+
muted: boolean;
|
|
8
|
+
}) => 'yes' | 'maybe' | 'no';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getShouldRenderAudio = void 0;
|
|
4
|
+
const codec_supports_media_1 = require("./codec-supports-media");
|
|
5
|
+
const getShouldRenderAudio = ({ codec, assetsInfo, enforceAudioTrack, muted, }) => {
|
|
6
|
+
if (muted) {
|
|
7
|
+
return 'no';
|
|
8
|
+
}
|
|
9
|
+
if (!(0, codec_supports_media_1.codecSupportsMedia)(codec).audio) {
|
|
10
|
+
return 'no';
|
|
11
|
+
}
|
|
12
|
+
if (enforceAudioTrack) {
|
|
13
|
+
return 'yes';
|
|
14
|
+
}
|
|
15
|
+
if (assetsInfo === null) {
|
|
16
|
+
return 'maybe';
|
|
17
|
+
}
|
|
18
|
+
return assetsInfo.assets.flat(1).length > 0 ? 'yes' : 'no';
|
|
19
|
+
};
|
|
20
|
+
exports.getShouldRenderAudio = getShouldRenderAudio;
|
|
@@ -25,6 +25,7 @@ const audio_codec_1 = require("./options/audio-codec");
|
|
|
25
25
|
const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
|
|
26
26
|
const pixel_format_1 = require("./pixel-format");
|
|
27
27
|
const prores_profile_1 = require("./prores-profile");
|
|
28
|
+
const render_has_audio_1 = require("./render-has-audio");
|
|
28
29
|
const validate_1 = require("./validate");
|
|
29
30
|
const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
|
|
30
31
|
const validate_videobitrate_1 = require("./validate-videobitrate");
|
|
@@ -52,9 +53,16 @@ const innerStitchFramesToVideo = async ({ assetsInfo, audioBitrate, audioCodec:
|
|
|
52
53
|
assetsInfo.downloadMap.preventCleanup();
|
|
53
54
|
const proResProfileName = (0, get_prores_profile_name_1.getProResProfileName)(codec, proResProfile);
|
|
54
55
|
const mediaSupport = (0, codec_supports_media_1.codecSupportsMedia)(codec);
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const renderAudioEvaluation = (0, render_has_audio_1.getShouldRenderAudio)({
|
|
57
|
+
assetsInfo,
|
|
58
|
+
codec,
|
|
59
|
+
enforceAudioTrack,
|
|
60
|
+
muted,
|
|
61
|
+
});
|
|
62
|
+
if (renderAudioEvaluation === 'maybe') {
|
|
63
|
+
throw new Error('Remotion is not sure whether to render audio. Please report this in the Remotion repo.');
|
|
64
|
+
}
|
|
65
|
+
const shouldRenderAudio = renderAudioEvaluation === 'yes';
|
|
58
66
|
const shouldRenderVideo = mediaSupport.video;
|
|
59
67
|
if (!shouldRenderAudio && !shouldRenderVideo) {
|
|
60
68
|
throw new Error('The output format has neither audio nor video. This can happen if you are rendering an audio codec and the output file has no audio or the muted flag was passed.');
|
|
@@ -6,15 +6,11 @@ export type ProcessedTrack = {
|
|
|
6
6
|
pad_start: string | null;
|
|
7
7
|
pad_end: string | null;
|
|
8
8
|
};
|
|
9
|
-
export declare const stringifyFfmpegFilter: ({ channels,
|
|
9
|
+
export declare const stringifyFfmpegFilter: ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, }: {
|
|
10
10
|
channels: number;
|
|
11
|
-
startInVideo: number;
|
|
12
11
|
volume: AssetVolume;
|
|
13
12
|
fps: number;
|
|
14
|
-
playbackRate: number;
|
|
15
13
|
assetDuration: number | null;
|
|
16
|
-
allowAmplificationDuringRender: boolean;
|
|
17
|
-
toneFrequency: number | null;
|
|
18
14
|
chunkLengthInSeconds: number;
|
|
19
15
|
forSeamlessAacConcatenation: boolean;
|
|
20
16
|
trimLeftOffset: number;
|
|
@@ -14,63 +14,68 @@ const stringifyTrim = (trim) => {
|
|
|
14
14
|
}
|
|
15
15
|
return asString;
|
|
16
16
|
};
|
|
17
|
-
const trimAndSetTempo = ({
|
|
17
|
+
const trimAndSetTempo = ({ forSeamlessAacConcatenation, assetDuration, asset, trimLeftOffset, trimRightOffset, fps, }) => {
|
|
18
18
|
// If we need seamless AAC stitching, we need to apply the tempo filter first
|
|
19
19
|
// because the atempo filter is not frame-perfect. It creates a small offset
|
|
20
20
|
// and the offset needs to be the same for all audio tracks, before processing it further.
|
|
21
21
|
// This also affects the trimLeft and trimRight values, as they need to be adjusted.
|
|
22
22
|
if (forSeamlessAacConcatenation) {
|
|
23
|
-
const trimLeft =
|
|
24
|
-
|
|
25
|
-
const trimRight = trimLeft +
|
|
26
|
-
(asset.duration * asset.playbackRate) / fps +
|
|
27
|
-
trimRightOffset * asset.playbackRate;
|
|
23
|
+
const trimLeft = asset.trimLeft / fps + trimLeftOffset;
|
|
24
|
+
const trimRight = trimLeft + (asset.duration / fps + trimRightOffset);
|
|
28
25
|
const trimRightOrAssetDuration = assetDuration
|
|
29
|
-
? Math.min(trimRight, assetDuration
|
|
26
|
+
? Math.min(trimRight, assetDuration / asset.playbackRate)
|
|
30
27
|
: trimRight;
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
if (trimRightOrAssetDuration < trimLeft) {
|
|
29
|
+
throw new Error('trimRightOrAssetDuration < trimLeft: ' +
|
|
30
|
+
JSON.stringify({
|
|
31
|
+
trimRight,
|
|
32
|
+
trimLeft,
|
|
33
|
+
assetDuration,
|
|
34
|
+
assetTrimLeft: asset.trimLeft,
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
33
37
|
return {
|
|
34
38
|
filter: [
|
|
35
|
-
(0, calculate_atempo_1.calculateATempo)(playbackRate),
|
|
36
|
-
`atrim=${stringifyTrim(
|
|
39
|
+
(0, calculate_atempo_1.calculateATempo)(asset.playbackRate),
|
|
40
|
+
`atrim=${stringifyTrim(trimLeft)}:${stringifyTrim(trimRight)}`,
|
|
37
41
|
],
|
|
38
|
-
actualTrimLeft,
|
|
39
|
-
audibleDuration:
|
|
42
|
+
actualTrimLeft: trimLeft,
|
|
43
|
+
audibleDuration: trimRight - trimLeft,
|
|
40
44
|
};
|
|
41
45
|
}
|
|
42
46
|
// Otherwise, we first trim and then apply playback rate, as then the atempo
|
|
43
47
|
// filter needs to do less work.
|
|
44
48
|
if (!forSeamlessAacConcatenation) {
|
|
45
|
-
const trimLeft = asset.trimLeft / fps
|
|
46
|
-
const trimRight = trimLeft + asset.duration / fps
|
|
49
|
+
const trimLeft = asset.trimLeft / fps;
|
|
50
|
+
const trimRight = (trimLeft + asset.duration / fps) * asset.playbackRate;
|
|
47
51
|
const trimRightOrAssetDuration = assetDuration
|
|
48
52
|
? Math.min(trimRight, assetDuration)
|
|
49
53
|
: trimRight;
|
|
54
|
+
const actualTrimLeft = trimLeft * asset.playbackRate;
|
|
50
55
|
return {
|
|
51
56
|
filter: [
|
|
52
|
-
`atrim=${stringifyTrim(
|
|
53
|
-
(0, calculate_atempo_1.calculateATempo)(playbackRate),
|
|
57
|
+
`atrim=${stringifyTrim(actualTrimLeft)}:${stringifyTrim(trimRightOrAssetDuration)}`,
|
|
58
|
+
(0, calculate_atempo_1.calculateATempo)(asset.playbackRate),
|
|
54
59
|
],
|
|
55
|
-
actualTrimLeft
|
|
56
|
-
audibleDuration: (trimRightOrAssetDuration -
|
|
60
|
+
actualTrimLeft,
|
|
61
|
+
audibleDuration: (trimRightOrAssetDuration - actualTrimLeft) / asset.playbackRate,
|
|
57
62
|
};
|
|
58
63
|
}
|
|
59
64
|
throw new Error('This should never happen');
|
|
60
65
|
};
|
|
61
|
-
const stringifyFfmpegFilter = ({ channels,
|
|
66
|
+
const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, }) => {
|
|
62
67
|
if (channels === 0) {
|
|
63
68
|
return null;
|
|
64
69
|
}
|
|
70
|
+
const { toneFrequency, startInVideo, trimLeft, playbackRate } = asset;
|
|
65
71
|
const startInVideoSeconds = startInVideo / fps;
|
|
66
|
-
if (assetDuration &&
|
|
72
|
+
if (assetDuration && trimLeft / fps >= assetDuration / playbackRate) {
|
|
67
73
|
return null;
|
|
68
74
|
}
|
|
69
75
|
if (toneFrequency !== null && (toneFrequency <= 0 || toneFrequency > 2)) {
|
|
70
76
|
throw new Error('toneFrequency must be a positive number between 0.01 and 2');
|
|
71
77
|
}
|
|
72
78
|
const { actualTrimLeft, audibleDuration, filter: trimAndTempoFilter, } = trimAndSetTempo({
|
|
73
|
-
playbackRate,
|
|
74
79
|
forSeamlessAacConcatenation,
|
|
75
80
|
assetDuration,
|
|
76
81
|
trimLeftOffset,
|
|
@@ -82,7 +87,7 @@ const stringifyFfmpegFilter = ({ channels, startInVideo, volume, fps, playbackRa
|
|
|
82
87
|
volume,
|
|
83
88
|
fps,
|
|
84
89
|
trimLeft: actualTrimLeft,
|
|
85
|
-
allowAmplificationDuringRender,
|
|
90
|
+
allowAmplificationDuringRender: asset.allowAmplificationDuringRender,
|
|
86
91
|
});
|
|
87
92
|
const padAtEnd = chunkLengthInSeconds - audibleDuration - startInVideoSeconds;
|
|
88
93
|
// Set as few filters as possible, as combining them can create noise
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.134",
|
|
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.
|
|
21
|
+
"remotion": "4.0.134"
|
|
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.
|
|
44
|
-
"@remotion/compositor-
|
|
45
|
-
"@remotion/compositor-linux-arm64-
|
|
46
|
-
"@remotion/compositor-linux-
|
|
47
|
-
"@remotion/compositor-linux-x64-
|
|
48
|
-
"@remotion/compositor-
|
|
49
|
-
"@remotion/compositor-win32-x64-msvc": "4.0.
|
|
43
|
+
"@remotion/compositor-darwin-arm64": "4.0.134",
|
|
44
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.134",
|
|
45
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.134",
|
|
46
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.134",
|
|
47
|
+
"@remotion/compositor-linux-x64-musl": "4.0.134",
|
|
48
|
+
"@remotion/compositor-darwin-x64": "4.0.134",
|
|
49
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.134"
|
|
50
50
|
},
|
|
51
51
|
"keywords": [
|
|
52
52
|
"remotion",
|