@remotion/renderer 3.1.7 → 3.1.8
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/assets/download-and-map-assets-to-file.js +0 -1
- package/dist/assets/download-map.d.ts +7 -0
- package/dist/assets/download-map.js +55 -2
- package/dist/create-ffmpeg-complex-filter.d.ts +6 -2
- package/dist/create-ffmpeg-complex-filter.js +2 -11
- package/dist/extract-frame-from-video.d.ts +0 -1
- package/dist/ffmpeg-filter-file.d.ts +2 -1
- package/dist/ffmpeg-filter-file.js +4 -6
- package/dist/get-compositions.js +4 -0
- package/dist/get-extension-from-codec.d.ts +1 -1
- package/dist/guess-extension-for-media.d.ts +1 -1
- package/dist/index.d.ts +15 -15
- package/dist/index.js +1 -0
- package/dist/last-frame-from-video-cache.d.ts +0 -1
- package/dist/merge-audio-track.d.ts +2 -0
- package/dist/merge-audio-track.js +4 -2
- package/dist/preprocess-audio-track.js +1 -1
- package/dist/render-frames.js +1 -0
- package/dist/render-media.d.ts +1 -2
- package/dist/render-media.js +11 -7
- package/dist/render-still.js +7 -1
- package/dist/stitch-frames-to-video.js +14 -32
- package/package.json +3 -3
- package/dist/assets/get-files-in-folder.d.ts +0 -9
- package/dist/assets/get-files-in-folder.js +0 -50
|
@@ -109,7 +109,6 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
|
|
|
109
109
|
downloadMap.isDownloadingMap[src][downloadDir] = false;
|
|
110
110
|
}
|
|
111
111
|
if ((_c = downloadMap.isDownloadingMap[src]) === null || _c === void 0 ? void 0 : _c[downloadDir]) {
|
|
112
|
-
console.log('TRIGGER WAIT', { src, downloadDir });
|
|
113
112
|
return waitForAssetToBeDownloaded({ downloadMap, src, downloadDir });
|
|
114
113
|
}
|
|
115
114
|
if (!downloadMap.isDownloadingMap[src]) {
|
|
@@ -46,6 +46,12 @@ export declare type DownloadMap = {
|
|
|
46
46
|
videoDurationResultCache: Record<string, VideoDurationResult>;
|
|
47
47
|
durationOfAssetCache: Record<string, AudioChannelsAndDurationResultCache>;
|
|
48
48
|
downloadDir: string;
|
|
49
|
+
preEncode: string;
|
|
50
|
+
audioMixing: string;
|
|
51
|
+
complexFilter: string;
|
|
52
|
+
audioPreprocessing: string;
|
|
53
|
+
stitchFrames: string;
|
|
54
|
+
assetDir: string;
|
|
49
55
|
};
|
|
50
56
|
export declare type RenderAssetInfo = {
|
|
51
57
|
assets: TAsset[][];
|
|
@@ -54,4 +60,5 @@ export declare type RenderAssetInfo = {
|
|
|
54
60
|
downloadMap: DownloadMap;
|
|
55
61
|
};
|
|
56
62
|
export declare const makeDownloadMap: () => DownloadMap;
|
|
63
|
+
export declare const cleanDownloadMap: (downloadMap: DownloadMap) => Promise<void>;
|
|
57
64
|
export {};
|
|
@@ -1,8 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeDownloadMap = void 0;
|
|
29
|
+
exports.cleanDownloadMap = exports.makeDownloadMap = void 0;
|
|
30
|
+
const fs_1 = __importStar(require("fs"));
|
|
31
|
+
const path_1 = __importDefault(require("path"));
|
|
32
|
+
const delete_directory_1 = require("../delete-directory");
|
|
4
33
|
const tmp_dir_1 = require("../tmp-dir");
|
|
34
|
+
const makeAndReturn = (dir, name) => {
|
|
35
|
+
const p = path_1.default.join(dir, name);
|
|
36
|
+
(0, fs_1.mkdirSync)(p);
|
|
37
|
+
return p;
|
|
38
|
+
};
|
|
39
|
+
const packageJsonPath = path_1.default.join(__dirname, '..', '..', 'package.json');
|
|
40
|
+
const packageJson = fs_1.default.existsSync(packageJsonPath)
|
|
41
|
+
? JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
|
|
42
|
+
: null;
|
|
5
43
|
const makeDownloadMap = () => {
|
|
44
|
+
const dir = (0, tmp_dir_1.tmpDir)(packageJson
|
|
45
|
+
? `remotion-v${packageJson.version.replace(/\./g, '-')}-assets`
|
|
46
|
+
: 'remotion-assets');
|
|
6
47
|
return {
|
|
7
48
|
isDownloadingMap: {},
|
|
8
49
|
hasBeenDownloadedMap: {},
|
|
@@ -14,7 +55,19 @@ const makeDownloadMap = () => {
|
|
|
14
55
|
videoDurationResultCache: {},
|
|
15
56
|
durationOfAssetCache: {},
|
|
16
57
|
id: String(Math.random()),
|
|
17
|
-
|
|
58
|
+
assetDir: dir,
|
|
59
|
+
downloadDir: makeAndReturn(dir, 'remotion-assets-dir'),
|
|
60
|
+
complexFilter: makeAndReturn(dir, 'remotion-complex-filter'),
|
|
61
|
+
preEncode: makeAndReturn(dir, 'pre-encode'),
|
|
62
|
+
audioMixing: makeAndReturn(dir, 'remotion-audio-mixing'),
|
|
63
|
+
audioPreprocessing: makeAndReturn(dir, 'remotion-audio-preprocessing'),
|
|
64
|
+
stitchFrames: makeAndReturn(dir, 'remotion-stitch-temp-dir'),
|
|
18
65
|
};
|
|
19
66
|
};
|
|
20
67
|
exports.makeDownloadMap = makeDownloadMap;
|
|
68
|
+
const cleanDownloadMap = async (downloadMap) => {
|
|
69
|
+
await (0, delete_directory_1.deleteDirectory)(downloadMap.downloadDir);
|
|
70
|
+
await (0, delete_directory_1.deleteDirectory)(downloadMap.complexFilter);
|
|
71
|
+
await (0, delete_directory_1.deleteDirectory)(downloadMap.assetDir);
|
|
72
|
+
};
|
|
73
|
+
exports.cleanDownloadMap = cleanDownloadMap;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { DownloadMap } from './assets/download-map';
|
|
2
|
+
export declare const createFfmpegComplexFilter: (filters: number, downloadMap: DownloadMap) => Promise<{
|
|
3
|
+
complexFilterFlag: [
|
|
4
|
+
string,
|
|
5
|
+
string
|
|
6
|
+
] | null;
|
|
3
7
|
cleanup: () => void;
|
|
4
8
|
}>;
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.createFfmpegComplexFilter = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
4
|
const create_ffmpeg_merge_filter_1 = require("./create-ffmpeg-merge-filter");
|
|
10
5
|
const ffmpeg_filter_file_1 = require("./ffmpeg-filter-file");
|
|
11
|
-
const
|
|
12
|
-
const createFfmpegComplexFilter = async (filters) => {
|
|
6
|
+
const createFfmpegComplexFilter = async (filters, downloadMap) => {
|
|
13
7
|
if (filters === 0) {
|
|
14
8
|
return { complexFilterFlag: null, cleanup: () => undefined };
|
|
15
9
|
}
|
|
16
10
|
const complexFilter = (0, create_ffmpeg_merge_filter_1.createFfmpegMergeFilter)(filters);
|
|
17
|
-
const { file, cleanup } = await (0, ffmpeg_filter_file_1.makeFfmpegFilterFile)(complexFilter);
|
|
18
|
-
const tempPath = (0, tmp_dir_1.tmpDir)('remotion-complex-filter-script');
|
|
19
|
-
const filterFile = path_1.default.join(tempPath, 'complex-filter.txt');
|
|
20
|
-
await fs_1.default.promises.writeFile(filterFile, complexFilter);
|
|
11
|
+
const { file, cleanup } = await (0, ffmpeg_filter_file_1.makeFfmpegFilterFile)(complexFilter, downloadMap);
|
|
21
12
|
return {
|
|
22
13
|
complexFilterFlag: ['-filter_complex_script', file],
|
|
23
14
|
cleanup,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DownloadMap } from './assets/download-map';
|
|
2
|
+
export declare const makeFfmpegFilterFile: (complexFilter: string, downloadMap: DownloadMap) => Promise<{
|
|
2
3
|
file: string;
|
|
3
4
|
cleanup: () => void;
|
|
4
5
|
}>;
|
|
@@ -8,16 +8,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.makeFfmpegFilterFile = void 0;
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const tempPath = (0, tmp_dir_1.tmpDir)('remotion-complex-filter');
|
|
15
|
-
const filterFile = path_1.default.join(tempPath, 'complex-filter.txt');
|
|
11
|
+
const makeFfmpegFilterFile = async (complexFilter, downloadMap) => {
|
|
12
|
+
const random = Math.random().toString().replace('.', '');
|
|
13
|
+
const filterFile = path_1.default.join(downloadMap.complexFilter, 'complex-filter-' + random + '.txt');
|
|
16
14
|
await fs_1.default.promises.writeFile(filterFile, complexFilter);
|
|
17
15
|
return {
|
|
18
16
|
file: filterFile,
|
|
19
17
|
cleanup: () => {
|
|
20
|
-
|
|
18
|
+
fs_1.default.unlinkSync(filterFile);
|
|
21
19
|
},
|
|
22
20
|
};
|
|
23
21
|
};
|
package/dist/get-compositions.js
CHANGED
|
@@ -89,6 +89,10 @@ const getCompositions = async (serveUrlOrWebpackUrl, config) => {
|
|
|
89
89
|
cleanup();
|
|
90
90
|
close === null || close === void 0 ? void 0 : close();
|
|
91
91
|
cleanupPageError();
|
|
92
|
+
// Clean download map if it was not passed in
|
|
93
|
+
if (!(config === null || config === void 0 ? void 0 : config.downloadMap)) {
|
|
94
|
+
(0, download_map_1.cleanDownloadMap)(downloadMap);
|
|
95
|
+
}
|
|
92
96
|
});
|
|
93
97
|
});
|
|
94
98
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Codec } from './codec';
|
|
2
|
-
export declare const getFileExtensionFromCodec: (codec: Codec, type: 'chunk' | 'final') => "mp3" | "aac" | "wav" | "gif" | "
|
|
2
|
+
export declare const getFileExtensionFromCodec: (codec: Codec, type: 'chunk' | 'final') => "mp3" | "aac" | "wav" | "gif" | "mp4" | "mkv" | "mov" | "webm";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const guessExtensionForVideo: (src: string) => Promise<"mp3" | "wav" | "
|
|
1
|
+
export declare const guessExtensionForVideo: (src: string) => Promise<"mp3" | "wav" | "mp4" | "webm">;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import execa from 'execa';
|
|
3
2
|
import { SymbolicateableError } from './error-handling/symbolicateable-error';
|
|
4
3
|
import { mimeContentType, mimeLookup } from './mime-types';
|
|
@@ -61,14 +60,14 @@ export declare const RenderInternals: {
|
|
|
61
60
|
width: number;
|
|
62
61
|
height: number;
|
|
63
62
|
scale: number;
|
|
64
|
-
codec: "
|
|
63
|
+
codec: "vp9" | "vp8" | "h264" | "h265" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
65
64
|
}) => void;
|
|
66
65
|
normalizeServeUrl: (unnormalized: string) => string;
|
|
67
66
|
spawnFfmpeg: (options: import("./stitch-frames-to-video").StitcherOptions) => Promise<{
|
|
68
67
|
task: Promise<Buffer | null>;
|
|
69
68
|
getLogs: () => string;
|
|
70
69
|
}>;
|
|
71
|
-
getFileExtensionFromCodec: (codec: "
|
|
70
|
+
getFileExtensionFromCodec: (codec: "vp9" | "vp8" | "h264" | "h265" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "aac" | "wav" | "gif" | "mp4" | "mkv" | "mov" | "webm";
|
|
72
71
|
tmpDir: (str: string) => string;
|
|
73
72
|
deleteDirectory: (directory: string) => Promise<void>;
|
|
74
73
|
isServeUrl: (potentialUrl: string) => boolean;
|
|
@@ -116,17 +115,17 @@ export declare const RenderInternals: {
|
|
|
116
115
|
};
|
|
117
116
|
registerErrorSymbolicationLock: () => number;
|
|
118
117
|
unlockErrorSymbolicationLock: (id: number) => void;
|
|
119
|
-
canUseParallelEncoding: (codec: "
|
|
118
|
+
canUseParallelEncoding: (codec: "vp9" | "vp8" | "h264" | "h265" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => boolean;
|
|
120
119
|
mimeContentType: typeof mimeContentType;
|
|
121
120
|
mimeLookup: typeof mimeLookup;
|
|
122
121
|
validateConcurrency: (value: unknown, setting: string) => void;
|
|
123
122
|
validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
|
|
124
123
|
DEFAULT_BROWSER: import("./browser").Browser;
|
|
125
124
|
validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
|
|
126
|
-
DEFAULT_OPENGL_RENDERER: "
|
|
127
|
-
validateOpenGlRenderer: (option: "
|
|
128
|
-
getDefaultCrfForCodec: (codec: "
|
|
129
|
-
validateSelectedCrfAndCodecCombination: (crf: unknown, codec: "
|
|
125
|
+
DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | null;
|
|
126
|
+
validateOpenGlRenderer: (option: "swangle" | "angle" | "egl" | "swiftshader" | null) => "swangle" | "angle" | "egl" | "swiftshader" | null;
|
|
127
|
+
getDefaultCrfForCodec: (codec: "vp9" | "vp8" | "h264" | "h265" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => number;
|
|
128
|
+
validateSelectedCrfAndCodecCombination: (crf: unknown, codec: "vp9" | "vp8" | "h264" | "h265" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => void;
|
|
130
129
|
validImageFormats: readonly ["png", "jpeg", "none"];
|
|
131
130
|
validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
|
|
132
131
|
DEFAULT_OVERWRITE: boolean;
|
|
@@ -134,16 +133,17 @@ export declare const RenderInternals: {
|
|
|
134
133
|
validateQuality: (q: number | undefined) => void;
|
|
135
134
|
validateFrame: (frame: number, durationInFrames: number) => void;
|
|
136
135
|
DEFAULT_TIMEOUT: number;
|
|
137
|
-
getValidCrfRanges: (codec: "
|
|
138
|
-
validateSelectedPixelFormatAndCodecCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", codec: "
|
|
139
|
-
validateSelectedCodecAndProResCombination: (actualCodec: "
|
|
140
|
-
validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", imageFormat: "
|
|
141
|
-
DEFAULT_CODEC: "
|
|
142
|
-
isAudioCodec: (codec: "
|
|
136
|
+
getValidCrfRanges: (codec: "vp9" | "vp8" | "h264" | "h265" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => [number, number];
|
|
137
|
+
validateSelectedPixelFormatAndCodecCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", codec: "vp9" | "vp8" | "h264" | "h265" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => void;
|
|
138
|
+
validateSelectedCodecAndProResCombination: (actualCodec: "vp9" | "vp8" | "h264" | "h265" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", actualProResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined) => void;
|
|
139
|
+
validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", imageFormat: "none" | "png" | "jpeg") => "none" | "valid";
|
|
140
|
+
DEFAULT_CODEC: "vp9" | "vp8" | "h264" | "h265" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
141
|
+
isAudioCodec: (codec: "vp9" | "vp8" | "h264" | "h265" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
|
|
143
142
|
logLevels: readonly ["verbose", "info", "warn", "error"];
|
|
144
|
-
isEqualOrBelowLogLevel: (currentLevel: "
|
|
143
|
+
isEqualOrBelowLogLevel: (currentLevel: "verbose" | "info" | "warn" | "error", level: "verbose" | "info" | "warn" | "error") => boolean;
|
|
145
144
|
isValidLogLevel: (level: string) => boolean;
|
|
146
145
|
validateEveryNthFrame: (everyNthFrame: unknown) => void;
|
|
147
146
|
perf: typeof perf;
|
|
148
147
|
makeDownloadMap: () => import("./assets/download-map").DownloadMap;
|
|
148
|
+
cleanDownloadMap: (downloadMap: import("./assets/download-map").DownloadMap) => Promise<void>;
|
|
149
149
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { DownloadMap } from './assets/download-map';
|
|
1
2
|
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
2
3
|
declare type Options = {
|
|
3
4
|
ffmpegExecutable: FfmpegExecutable;
|
|
4
5
|
files: string[];
|
|
5
6
|
outName: string;
|
|
6
7
|
numberOfSeconds: number;
|
|
8
|
+
downloadMap: DownloadMap;
|
|
7
9
|
};
|
|
8
10
|
export declare const mergeAudioTrack: (options: Options) => Promise<void>;
|
|
9
11
|
export {};
|
|
@@ -14,7 +14,7 @@ const delete_directory_1 = require("./delete-directory");
|
|
|
14
14
|
const p_limit_1 = require("./p-limit");
|
|
15
15
|
const tmp_dir_1 = require("./tmp-dir");
|
|
16
16
|
const truthy_1 = require("./truthy");
|
|
17
|
-
const mergeAudioTrackUnlimited = async ({ ffmpegExecutable, outName, files, numberOfSeconds, }) => {
|
|
17
|
+
const mergeAudioTrackUnlimited = async ({ ffmpegExecutable, outName, files, numberOfSeconds, downloadMap, }) => {
|
|
18
18
|
if (files.length === 0) {
|
|
19
19
|
await (0, create_silent_audio_1.createSilentAudio)({
|
|
20
20
|
outName,
|
|
@@ -42,6 +42,7 @@ const mergeAudioTrackUnlimited = async ({ ffmpegExecutable, outName, files, numb
|
|
|
42
42
|
files: chunkFiles,
|
|
43
43
|
numberOfSeconds,
|
|
44
44
|
outName: chunkOutname,
|
|
45
|
+
downloadMap,
|
|
45
46
|
});
|
|
46
47
|
return chunkOutname;
|
|
47
48
|
}));
|
|
@@ -50,11 +51,12 @@ const mergeAudioTrackUnlimited = async ({ ffmpegExecutable, outName, files, numb
|
|
|
50
51
|
files: chunkNames,
|
|
51
52
|
numberOfSeconds,
|
|
52
53
|
outName,
|
|
54
|
+
downloadMap,
|
|
53
55
|
});
|
|
54
56
|
await (0, delete_directory_1.deleteDirectory)(tempPath);
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
|
-
const { complexFilterFlag: mergeFilter, cleanup } = await (0, create_ffmpeg_complex_filter_1.createFfmpegComplexFilter)(files.length);
|
|
59
|
+
const { complexFilterFlag: mergeFilter, cleanup } = await (0, create_ffmpeg_complex_filter_1.createFfmpegComplexFilter)(files.length, downloadMap);
|
|
58
60
|
const args = [
|
|
59
61
|
...files.map((f) => ['-i', f]),
|
|
60
62
|
mergeFilter,
|
|
@@ -22,7 +22,7 @@ const preprocessAudioTrackUnlimited = async ({ ffmpegExecutable, ffprobeExecutab
|
|
|
22
22
|
if (filter === null) {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
-
const { cleanup, file } = await (0, ffmpeg_filter_file_1.makeFfmpegFilterFile)(filter);
|
|
25
|
+
const { cleanup, file } = await (0, ffmpeg_filter_file_1.makeFfmpegFilterFile)(filter, downloadMap);
|
|
26
26
|
const args = [
|
|
27
27
|
['-i', (0, resolve_asset_src_1.resolveAssetSrc)(asset.src)],
|
|
28
28
|
['-ac', '2'],
|
package/dist/render-frames.js
CHANGED
package/dist/render-media.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { SmallTCompMetadata } from 'remotion';
|
|
3
2
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
4
3
|
import type { DownloadMap } from './assets/download-map';
|
|
@@ -63,4 +62,4 @@ export declare type RenderMediaOptions = {
|
|
|
63
62
|
* @description Render a video from a composition
|
|
64
63
|
* @link https://www.remotion.dev/docs/renderer/render-media
|
|
65
64
|
*/
|
|
66
|
-
export declare const renderMedia: ({ parallelism, proResProfile, crf, composition, imageFormat, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, quality, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal,
|
|
65
|
+
export declare const renderMedia: ({ parallelism, proResProfile, crf, composition, imageFormat, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, quality, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, ...options }: RenderMediaOptions) => Promise<Buffer | null>;
|
package/dist/render-media.js
CHANGED
|
@@ -11,6 +11,7 @@ const remotion_1 = require("remotion");
|
|
|
11
11
|
const download_map_1 = require("./assets/download-map");
|
|
12
12
|
const can_use_parallel_encoding_1 = require("./can-use-parallel-encoding");
|
|
13
13
|
const crf_1 = require("./crf");
|
|
14
|
+
const delete_directory_1 = require("./delete-directory");
|
|
14
15
|
const ensure_frames_in_order_1 = require("./ensure-frames-in-order");
|
|
15
16
|
const ensure_output_directory_1 = require("./ensure-output-directory");
|
|
16
17
|
const get_duration_from_frame_range_1 = require("./get-duration-from-frame-range");
|
|
@@ -25,7 +26,6 @@ const prespawn_ffmpeg_1 = require("./prespawn-ffmpeg");
|
|
|
25
26
|
const quality_1 = require("./quality");
|
|
26
27
|
const render_frames_1 = require("./render-frames");
|
|
27
28
|
const stitch_frames_to_video_1 = require("./stitch-frames-to-video");
|
|
28
|
-
const tmp_dir_1 = require("./tmp-dir");
|
|
29
29
|
const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
|
|
30
30
|
const validate_output_filename_1 = require("./validate-output-filename");
|
|
31
31
|
const validate_scale_1 = require("./validate-scale");
|
|
@@ -34,8 +34,8 @@ const validate_scale_1 = require("./validate-scale");
|
|
|
34
34
|
* @description Render a video from a composition
|
|
35
35
|
* @link https://www.remotion.dev/docs/renderer/render-media
|
|
36
36
|
*/
|
|
37
|
-
const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, quality, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal,
|
|
38
|
-
var _a, _b;
|
|
37
|
+
const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, quality, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, ...options }) => {
|
|
38
|
+
var _a, _b, _c;
|
|
39
39
|
(0, quality_1.validateQuality)(quality);
|
|
40
40
|
if (typeof crf !== 'undefined' && crf !== null) {
|
|
41
41
|
(0, crf_1.validateSelectedCrfAndCodecCombination)(crf, codec);
|
|
@@ -56,11 +56,11 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
56
56
|
let encodedDoneIn = null;
|
|
57
57
|
let cancelled = false;
|
|
58
58
|
const renderStart = Date.now();
|
|
59
|
-
const
|
|
59
|
+
const downloadMap = (_c = options.downloadMap) !== null && _c !== void 0 ? _c : (0, download_map_1.makeDownloadMap)();
|
|
60
60
|
const parallelEncoding = (0, can_use_parallel_encoding_1.canUseParallelEncoding)(codec);
|
|
61
61
|
const actualImageFormat = imageFormat !== null && imageFormat !== void 0 ? imageFormat : 'jpeg';
|
|
62
62
|
const preEncodedFileLocation = parallelEncoding
|
|
63
|
-
? path_1.default.join(
|
|
63
|
+
? path_1.default.join(downloadMap.preEncode, 'pre-encode.' + (0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, 'chunk'))
|
|
64
64
|
: null;
|
|
65
65
|
const outputDir = parallelEncoding
|
|
66
66
|
? null
|
|
@@ -174,7 +174,7 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
174
174
|
browserExecutable,
|
|
175
175
|
port,
|
|
176
176
|
cancelSignal: cancelRenderFrames.cancelSignal,
|
|
177
|
-
downloadMap
|
|
177
|
+
downloadMap,
|
|
178
178
|
});
|
|
179
179
|
return renderFramesProc;
|
|
180
180
|
})
|
|
@@ -252,7 +252,11 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
252
252
|
.finally(() => {
|
|
253
253
|
if (preEncodedFileLocation !== null &&
|
|
254
254
|
fs_1.default.existsSync(preEncodedFileLocation)) {
|
|
255
|
-
|
|
255
|
+
(0, delete_directory_1.deleteDirectory)(path_1.default.dirname(preEncodedFileLocation));
|
|
256
|
+
}
|
|
257
|
+
// Clean download map if it was not passed in
|
|
258
|
+
if (!(options === null || options === void 0 ? void 0 : options.downloadMap)) {
|
|
259
|
+
(0, download_map_1.cleanDownloadMap)(downloadMap);
|
|
256
260
|
}
|
|
257
261
|
});
|
|
258
262
|
return Promise.race([
|
package/dist/render-still.js
CHANGED
|
@@ -175,7 +175,13 @@ const renderStill = (options) => {
|
|
|
175
175
|
})
|
|
176
176
|
.then((res) => resolve(res))
|
|
177
177
|
.catch((err) => reject(err))
|
|
178
|
-
.finally(() =>
|
|
178
|
+
.finally(() => {
|
|
179
|
+
// Clean download map if it was not passed in
|
|
180
|
+
if (!(options === null || options === void 0 ? void 0 : options.downloadMap)) {
|
|
181
|
+
(0, download_map_1.cleanDownloadMap)(downloadMap);
|
|
182
|
+
}
|
|
183
|
+
return close === null || close === void 0 ? void 0 : close();
|
|
184
|
+
});
|
|
179
185
|
});
|
|
180
186
|
return Promise.race([
|
|
181
187
|
happyPath,
|
|
@@ -1,34 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.stitchFramesToVideo = exports.spawnFfmpeg = void 0;
|
|
30
7
|
const execa_1 = __importDefault(require("execa"));
|
|
31
|
-
const fs_1 =
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
32
9
|
const promises_1 = require("fs/promises");
|
|
33
10
|
const path_1 = __importDefault(require("path"));
|
|
34
11
|
const remotion_1 = require("remotion");
|
|
@@ -48,7 +25,6 @@ const merge_audio_track_1 = require("./merge-audio-track");
|
|
|
48
25
|
const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
|
|
49
26
|
const pixel_format_1 = require("./pixel-format");
|
|
50
27
|
const preprocess_audio_track_1 = require("./preprocess-audio-track");
|
|
51
|
-
const tmp_dir_1 = require("./tmp-dir");
|
|
52
28
|
const truthy_1 = require("./truthy");
|
|
53
29
|
const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
|
|
54
30
|
const validate_ffmpeg_1 = require("./validate-ffmpeg");
|
|
@@ -67,13 +43,12 @@ const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose,
|
|
|
67
43
|
if (verbose) {
|
|
68
44
|
console.log('asset positions', assetPositions);
|
|
69
45
|
}
|
|
70
|
-
const tempPath = (0, tmp_dir_1.tmpDir)('remotion-audio-mixing');
|
|
71
46
|
const preprocessProgress = new Array(assetPositions.length).fill(0);
|
|
72
47
|
const updateProgress = () => {
|
|
73
48
|
onProgress(preprocessProgress.reduce((a, b) => a + b, 0) / assetPositions.length);
|
|
74
49
|
};
|
|
75
50
|
const preprocessed = (await Promise.all(assetPositions.map(async (asset, index) => {
|
|
76
|
-
const filterFile = path_1.default.join(
|
|
51
|
+
const filterFile = path_1.default.join(downloadMap.audioMixing, `${index}.wav`);
|
|
77
52
|
const result = await (0, preprocess_audio_track_1.preprocessAudioTrack)({
|
|
78
53
|
ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
|
|
79
54
|
ffprobeExecutable: ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : null,
|
|
@@ -87,14 +62,15 @@ const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose,
|
|
|
87
62
|
updateProgress();
|
|
88
63
|
return result;
|
|
89
64
|
}))).filter(truthy_1.truthy);
|
|
90
|
-
const outName = path_1.default.join(
|
|
65
|
+
const outName = path_1.default.join(downloadMap.audioPreprocessing, `audio.wav`);
|
|
91
66
|
await (0, merge_audio_track_1.mergeAudioTrack)({
|
|
92
67
|
ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
|
|
93
68
|
files: preprocessed,
|
|
94
69
|
outName,
|
|
95
70
|
numberOfSeconds: Number((expectedFrames / fps).toFixed(3)),
|
|
71
|
+
downloadMap,
|
|
96
72
|
});
|
|
97
|
-
(0, delete_directory_1.deleteDirectory)(
|
|
73
|
+
(0, delete_directory_1.deleteDirectory)(downloadMap.audioMixing);
|
|
98
74
|
onProgress(1);
|
|
99
75
|
preprocessed.forEach((p) => {
|
|
100
76
|
(0, delete_directory_1.deleteDirectory)(p);
|
|
@@ -123,7 +99,7 @@ const spawnFfmpeg = async (options) => {
|
|
|
123
99
|
const supportsCrf = encoderName && codec !== 'prores';
|
|
124
100
|
const tempFile = options.outputLocation
|
|
125
101
|
? null
|
|
126
|
-
: path_1.default.join(
|
|
102
|
+
: path_1.default.join(options.assetsInfo.downloadMap.stitchFrames, `out.${(0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, 'final')}`);
|
|
127
103
|
if (options.verbose) {
|
|
128
104
|
console.log('[verbose] ffmpeg', (_e = options.ffmpegExecutable) !== null && _e !== void 0 ? _e : 'ffmpeg in PATH');
|
|
129
105
|
console.log('[verbose] encoder', encoderName);
|
|
@@ -184,7 +160,6 @@ const spawnFfmpeg = async (options) => {
|
|
|
184
160
|
if (tempFile) {
|
|
185
161
|
(0, promises_1.readFile)(tempFile)
|
|
186
162
|
.then((f) => {
|
|
187
|
-
(0, fs_1.unlinkSync)(tempFile);
|
|
188
163
|
return resolve(f);
|
|
189
164
|
})
|
|
190
165
|
.catch((e) => reject(e));
|
|
@@ -193,6 +168,7 @@ const spawnFfmpeg = async (options) => {
|
|
|
193
168
|
resolve(null);
|
|
194
169
|
}
|
|
195
170
|
});
|
|
171
|
+
await (0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.stitchFrames);
|
|
196
172
|
return {
|
|
197
173
|
getLogs: () => '',
|
|
198
174
|
task: Promise.resolve(file),
|
|
@@ -280,12 +256,18 @@ const spawnFfmpeg = async (options) => {
|
|
|
280
256
|
});
|
|
281
257
|
return {
|
|
282
258
|
task: task.then(() => {
|
|
259
|
+
(0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.audioPreprocessing);
|
|
283
260
|
if (tempFile === null) {
|
|
261
|
+
(0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.stitchFrames);
|
|
284
262
|
return null;
|
|
285
263
|
}
|
|
286
264
|
return (0, promises_1.readFile)(tempFile)
|
|
287
265
|
.then((file) => {
|
|
288
|
-
return Promise.all([
|
|
266
|
+
return Promise.all([
|
|
267
|
+
file,
|
|
268
|
+
(0, delete_directory_1.deleteDirectory)(path_1.default.dirname(tempFile)),
|
|
269
|
+
(0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.stitchFrames),
|
|
270
|
+
]);
|
|
289
271
|
})
|
|
290
272
|
.then(([file]) => file);
|
|
291
273
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.8",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"execa": "5.1.1",
|
|
24
24
|
"extract-zip": "2.0.1",
|
|
25
|
-
"remotion": "3.1.
|
|
25
|
+
"remotion": "3.1.8",
|
|
26
26
|
"source-map": "^0.8.0-beta.0",
|
|
27
27
|
"ws": "8.7.0"
|
|
28
28
|
},
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "57f34a02b0f830053f92af426a6b70b6824f887e"
|
|
61
61
|
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getTmpDirStateIfENoSp = exports.getFolderFiles = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
function getFolderFiles(folder) {
|
|
10
|
-
const files = fs_1.default.readdirSync(folder);
|
|
11
|
-
const paths = [];
|
|
12
|
-
files.forEach((file) => {
|
|
13
|
-
const full = path_1.default.join(folder, file);
|
|
14
|
-
try {
|
|
15
|
-
const stat = fs_1.default.statSync(full);
|
|
16
|
-
if (stat.isDirectory()) {
|
|
17
|
-
paths.push(...getFolderFiles(full));
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
paths.push({
|
|
21
|
-
filename: full,
|
|
22
|
-
size: stat.size,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
if (err.message.includes('ENOENT')) {
|
|
28
|
-
// Race condition: File was deleted in the meanwhile.
|
|
29
|
-
// Do nothing
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
throw err;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return paths;
|
|
37
|
-
}
|
|
38
|
-
exports.getFolderFiles = getFolderFiles;
|
|
39
|
-
const getTmpDirStateIfENoSp = () => {
|
|
40
|
-
const files = getFolderFiles('/tmp');
|
|
41
|
-
return {
|
|
42
|
-
files: files
|
|
43
|
-
.slice(0)
|
|
44
|
-
.sort((a, b) => a.size - b.size)
|
|
45
|
-
.reverse()
|
|
46
|
-
.slice(0, 100),
|
|
47
|
-
total: files.reduce((a, b) => a + b.size, 0),
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
exports.getTmpDirStateIfENoSp = getTmpDirStateIfENoSp;
|