@remotion/renderer 3.1.2 → 3.1.5

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.
@@ -96,7 +96,18 @@ const downloadAsset = async ({ src, onDownload, downloadDir, }) => {
96
96
  return src;
97
97
  }
98
98
  if ((_a = hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
99
- return (_b = hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir];
99
+ const claimedDownloadLocation = (_b = hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir];
100
+ // The OS might have deleted the file since even though we marked it as downloaded. In that case we reset the state and download it again
101
+ if (!fs_1.default.existsSync(claimedDownloadLocation)) {
102
+ return claimedDownloadLocation;
103
+ }
104
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
105
+ hasBeenDownloadedMap[src][downloadDir] = null;
106
+ if (!isDownloadingMap[src]) {
107
+ isDownloadingMap[src] = {};
108
+ }
109
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
110
+ isDownloadingMap[src][downloadDir] = false;
100
111
  }
101
112
  if ((_c = isDownloadingMap[src]) === null || _c === void 0 ? void 0 : _c[downloadDir]) {
102
113
  return waitForAssetToBeDownloaded({ src, downloadDir });
@@ -1,7 +1,4 @@
1
1
  export declare const createFfmpegComplexFilter: (filters: number) => Promise<{
2
- complexFilterFlag: [
3
- string,
4
- string
5
- ] | null;
2
+ complexFilterFlag: [string, string] | null;
6
3
  cleanup: () => void;
7
4
  }>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { FfmpegExecutable, OffthreadVideoImageFormat } from 'remotion';
2
3
  import type { LastFrameOptions } from './last-frame-from-video-cache';
3
4
  export declare const getLastFrameOfVideo: (options: LastFrameOptions) => Promise<Buffer>;
@@ -1,2 +1,2 @@
1
1
  import type { Codec } from 'remotion';
2
- export declare const getFileExtensionFromCodec: (codec: Codec, type: 'chunk' | 'final') => "mp3" | "webm" | "wav" | "mp4" | "aac" | "gif" | "mkv" | "mov";
2
+ export declare const getFileExtensionFromCodec: (codec: Codec, type: 'chunk' | 'final') => "mp3" | "aac" | "wav" | "gif" | "webm" | "mp4" | "mov" | "mkv";
@@ -1 +1 @@
1
- export declare const guessExtensionForVideo: (src: string) => Promise<"mp3" | "webm" | "wav" | "mp4">;
1
+ export declare const guessExtensionForVideo: (src: string) => Promise<"mp3" | "wav" | "webm" | "mp4">;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import execa from 'execa';
2
3
  import { SymbolicateableError } from './error-handling/symbolicateable-error';
3
4
  import { mimeContentType, mimeLookup } from './mime-types';
@@ -47,14 +48,14 @@ export declare const RenderInternals: {
47
48
  width: number;
48
49
  height: number;
49
50
  scale: number;
50
- codec: "mp3" | "wav" | "vp9" | "vp8" | "h264" | "h265" | "aac" | "prores" | "h264-mkv" | "gif";
51
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
51
52
  }) => void;
52
53
  normalizeServeUrl: (unnormalized: string) => string;
53
54
  spawnFfmpeg: (options: import("./stitch-frames-to-video").StitcherOptions) => Promise<{
54
55
  task: Promise<Buffer | null>;
55
56
  getLogs: () => string;
56
57
  }>;
57
- getFileExtensionFromCodec: (codec: "mp3" | "wav" | "vp9" | "vp8" | "h264" | "h265" | "aac" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "webm" | "wav" | "mp4" | "aac" | "gif" | "mkv" | "mov";
58
+ getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "aac" | "wav" | "gif" | "webm" | "mp4" | "mov" | "mkv";
58
59
  tmpDir: (str: string) => string;
59
60
  deleteDirectory: (directory: string) => Promise<void>;
60
61
  isServeUrl: (potentialUrl: string) => boolean;
@@ -102,7 +103,7 @@ export declare const RenderInternals: {
102
103
  };
103
104
  registerErrorSymbolicationLock: () => number;
104
105
  unlockErrorSymbolicationLock: (id: number) => void;
105
- canUseParallelEncoding: (codec: "mp3" | "wav" | "vp9" | "vp8" | "h264" | "h265" | "aac" | "prores" | "h264-mkv" | "gif") => boolean;
106
+ canUseParallelEncoding: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => boolean;
106
107
  mimeContentType: typeof mimeContentType;
107
108
  mimeLookup: typeof mimeLookup;
108
109
  validateConcurrency: (value: unknown, setting: string) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { FfmpegExecutable, OffthreadVideoImageFormat } from 'remotion';
2
3
  import type { SpecialVCodecForTransparency } from './get-video-info';
3
4
  export declare type LastFrameOptions = {
@@ -11,6 +11,7 @@ const chunk_1 = require("./chunk");
11
11
  const convert_to_pcm_1 = require("./convert-to-pcm");
12
12
  const create_ffmpeg_complex_filter_1 = require("./create-ffmpeg-complex-filter");
13
13
  const create_silent_audio_1 = require("./create-silent-audio");
14
+ const delete_directory_1 = require("./delete-directory");
14
15
  const p_limit_1 = require("./p-limit");
15
16
  const tmp_dir_1 = require("./tmp-dir");
16
17
  const mergeAudioTrackUnlimited = async ({ ffmpegExecutable, outName, files, numberOfSeconds, }) => {
@@ -44,12 +45,14 @@ const mergeAudioTrackUnlimited = async ({ ffmpegExecutable, outName, files, numb
44
45
  });
45
46
  return chunkOutname;
46
47
  }));
47
- return (0, exports.mergeAudioTrack)({
48
+ await (0, exports.mergeAudioTrack)({
48
49
  ffmpegExecutable,
49
50
  files: chunkNames,
50
51
  numberOfSeconds,
51
52
  outName,
52
53
  });
54
+ await (0, delete_directory_1.deleteDirectory)(tempPath);
55
+ return;
53
56
  }
54
57
  const { complexFilterFlag: mergeFilter, cleanup } = await (0, create_ffmpeg_complex_filter_1.createFfmpegComplexFilter)(files.length);
55
58
  const args = [
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { ImageFormat } from 'remotion';
2
3
  import type { Page } from './browser/BrowserPage';
3
4
  export declare const provideScreenshot: ({ page, imageFormat, options, quality, }: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { Page } from './browser/BrowserPage';
2
3
  import type { ScreenshotOptions } from './browser/ScreenshotOptions';
3
4
  export declare const screenshot: (page: Page, options: ScreenshotOptions) => Promise<Buffer | string | void>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { BrowserExecutable, Codec, FfmpegExecutable, FrameRange, PixelFormat, ProResProfile, SmallTCompMetadata } from 'remotion';
2
3
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
3
4
  import type { BrowserLog } from './browser-log';
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { ImageFormat } from 'remotion';
2
3
  import type { Page } from './browser/BrowserPage';
3
4
  export declare const screenshotDOMElement: ({ page, imageFormat, quality, opts, }: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { StillImageFormat } from 'remotion';
2
3
  import type { Page } from './browser/BrowserPage';
3
4
  import type { ScreenshotOptions } from './browser/ScreenshotOptions';
@@ -1,11 +1,34 @@
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
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
5
28
  Object.defineProperty(exports, "__esModule", { value: true });
6
29
  exports.stitchFramesToVideo = exports.spawnFfmpeg = void 0;
7
30
  const execa_1 = __importDefault(require("execa"));
8
- const fs_1 = __importDefault(require("fs"));
31
+ const fs_1 = __importStar(require("fs"));
9
32
  const promises_1 = require("fs/promises");
10
33
  const path_1 = __importDefault(require("path"));
11
34
  const remotion_1 = require("remotion");
@@ -59,13 +82,14 @@ const getAssetsData = async ({ assets, downloadDir, onDownload, fps, expectedFra
59
82
  updateProgress();
60
83
  return result;
61
84
  }))).filter(remotion_1.Internals.truthy);
62
- const outName = path_1.default.join(tempPath, `audio.wav`);
85
+ const outName = path_1.default.join((0, tmp_dir_1.tmpDir)('remotion-audio-preprocessing'), `audio.wav`);
63
86
  await (0, merge_audio_track_1.mergeAudioTrack)({
64
87
  ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
65
88
  files: preprocessed,
66
89
  outName,
67
90
  numberOfSeconds: Number((expectedFrames / fps).toFixed(3)),
68
91
  });
92
+ (0, delete_directory_1.deleteDirectory)(tempPath);
69
93
  onProgress(1);
70
94
  preprocessed.forEach((p) => {
71
95
  (0, delete_directory_1.deleteDirectory)(p);
@@ -148,7 +172,22 @@ const spawnFfmpeg = async (options) => {
148
172
  });
149
173
  await ffmpegTask;
150
174
  (_l = options.onProgress) === null || _l === void 0 ? void 0 : _l.call(options, expectedFrames);
151
- const file = tempFile ? await (0, promises_1.readFile)(tempFile) : null;
175
+ if (audio) {
176
+ await (0, delete_directory_1.deleteDirectory)(path_1.default.dirname(audio));
177
+ }
178
+ const file = await new Promise((resolve, reject) => {
179
+ if (tempFile) {
180
+ (0, promises_1.readFile)(tempFile)
181
+ .then((f) => {
182
+ (0, fs_1.unlinkSync)(tempFile);
183
+ return resolve(f);
184
+ })
185
+ .catch((e) => reject(e));
186
+ }
187
+ else {
188
+ resolve(null);
189
+ }
190
+ });
152
191
  return {
153
192
  getLogs: () => '',
154
193
  task: Promise.resolve(file),
@@ -236,12 +275,12 @@ const spawnFfmpeg = async (options) => {
236
275
  });
237
276
  return {
238
277
  task: task.then(() => {
239
- if (options.outputLocation) {
278
+ if (tempFile === null) {
240
279
  return null;
241
280
  }
242
281
  return (0, promises_1.readFile)(tempFile)
243
282
  .then((file) => {
244
- return Promise.all([file, (0, promises_1.unlink)(tempFile)]);
283
+ return Promise.all([file, (0, delete_directory_1.deleteDirectory)(path_1.default.dirname(tempFile))]);
245
284
  })
246
285
  .then(([file]) => file);
247
286
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.1.2",
3
+ "version": "3.1.5",
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.2",
25
+ "remotion": "3.1.5",
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": "7ac5f5675a7390cc776265c667d382149dee9814"
60
+ "gitHead": "965ca68bd4efce9ca5e27fe30c4a31aec594575c"
61
61
  }