@remotion/renderer 4.0.0-alpha10 → 4.0.0-alpha12

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.
Files changed (50) hide show
  1. package/dist/index.d.ts +8 -9
  2. package/dist/logger.d.ts +1 -1
  3. package/dist/provide-screenshot.d.ts +0 -1
  4. package/dist/puppeteer-screenshot.d.ts +0 -1
  5. package/dist/screenshot-dom-element.d.ts +0 -1
  6. package/dist/screenshot-task.d.ts +0 -1
  7. package/dist/seek-to-frame.js +1 -1
  8. package/dist/stitch-frames-to-video.d.ts +0 -1
  9. package/dist/take-frame-and-compose.d.ts +0 -1
  10. package/package.json +9 -9
  11. package/dist/assets/get-video-stream-duration.d.ts +0 -9
  12. package/dist/assets/get-video-stream-duration.js +0 -71
  13. package/dist/calculate-sar-dar-pixels.d.ts +0 -9
  14. package/dist/calculate-sar-dar-pixels.js +0 -19
  15. package/dist/determine-resize-params.d.ts +0 -1
  16. package/dist/determine-resize-params.js +0 -10
  17. package/dist/determine-vcodec-ffmpeg-flags.d.ts +0 -2
  18. package/dist/determine-vcodec-ffmpeg-flags.js +0 -13
  19. package/dist/ensure-ffmpeg.d.ts +0 -18
  20. package/dist/ensure-ffmpeg.js +0 -58
  21. package/dist/ensure-presentation-timestamp.d.ts +0 -15
  22. package/dist/ensure-presentation-timestamp.js +0 -88
  23. package/dist/extract-frame-from-video.d.ts +0 -16
  24. package/dist/extract-frame-from-video.js +0 -191
  25. package/dist/ffmpeg-executable.d.ts +0 -1
  26. package/dist/ffmpeg-executable.js +0 -2
  27. package/dist/ffmpeg-flags.d.ts +0 -31
  28. package/dist/ffmpeg-flags.js +0 -245
  29. package/dist/frame-to-ffmpeg-timestamp.d.ts +0 -1
  30. package/dist/frame-to-ffmpeg-timestamp.js +0 -8
  31. package/dist/get-can-extract-frames-fast.d.ts +0 -14
  32. package/dist/get-can-extract-frames-fast.js +0 -71
  33. package/dist/get-frame-of-video-slow.d.ts +0 -17
  34. package/dist/get-frame-of-video-slow.js +0 -72
  35. package/dist/get-video-info.d.ts +0 -8
  36. package/dist/get-video-info.js +0 -59
  37. package/dist/is-beyond-last-frame.d.ts +0 -3
  38. package/dist/is-beyond-last-frame.js +0 -12
  39. package/dist/last-frame-from-video-cache.d.ts +0 -17
  40. package/dist/last-frame-from-video-cache.js +0 -55
  41. package/dist/legacy-webpack-config.d.ts +0 -9
  42. package/dist/legacy-webpack-config.js +0 -13
  43. package/dist/quality.d.ts +0 -1
  44. package/dist/quality.js +0 -21
  45. package/dist/try-to-extract-frame-of-video-fast.d.ts +0 -12
  46. package/dist/try-to-extract-frame-of-video-fast.js +0 -55
  47. package/dist/validate-ffmpeg.d.ts +0 -7
  48. package/dist/validate-ffmpeg.js +0 -77
  49. package/dist/warn-about-ffmpeg-version.d.ts +0 -5
  50. package/dist/warn-about-ffmpeg-version.js +0 -37
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import execa from 'execa';
3
2
  import { HeadlessBrowser } from './browser/Browser';
4
3
  import { SymbolicateableError } from './error-handling/symbolicateable-error';
@@ -124,7 +123,7 @@ export declare const RenderInternals: {
124
123
  DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
125
124
  isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
126
125
  logLevels: readonly ["verbose", "info", "warn", "error"];
127
- isEqualOrBelowLogLevel: (currentLevel: "verbose" | "error" | "info" | "warn", level: "verbose" | "error" | "info" | "warn") => boolean;
126
+ isEqualOrBelowLogLevel: (currentLevel: "verbose" | "info" | "warn" | "error", level: "verbose" | "info" | "warn" | "error") => boolean;
128
127
  isValidLogLevel: (level: string) => boolean;
129
128
  perf: typeof perf;
130
129
  makeDownloadMap: () => import("./assets/download-map").DownloadMap;
@@ -303,8 +302,8 @@ export declare const RenderInternals: {
303
302
  };
304
303
  validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
305
304
  validVideoImageFormats: readonly ["png", "jpeg", "none"];
306
- DEFAULT_STILL_IMAGE_FORMAT: "png" | "jpeg" | "pdf" | "webp";
307
- DEFAULT_VIDEO_IMAGE_FORMAT: "none" | "png" | "jpeg";
305
+ DEFAULT_STILL_IMAGE_FORMAT: "jpeg" | "png" | "webp" | "pdf";
306
+ DEFAULT_VIDEO_IMAGE_FORMAT: "jpeg" | "png" | "none";
308
307
  chalk: {
309
308
  enabled: boolean;
310
309
  visible: boolean;
@@ -358,24 +357,24 @@ export declare const RenderInternals: {
358
357
  verbose: (message?: any, ...optionalParams: any[]) => void;
359
358
  verboseAdvanced: (options: {
360
359
  indent: boolean;
361
- logLevel: "verbose" | "error" | "info" | "warn";
360
+ logLevel: "verbose" | "info" | "warn" | "error";
362
361
  } & {
363
362
  tag?: string | undefined;
364
363
  }, message?: any, ...optionalParams: any[]) => void;
365
364
  info: (message?: any, ...optionalParams: any[]) => void;
366
365
  infoAdvanced: (options: {
367
366
  indent: boolean;
368
- logLevel: "verbose" | "error" | "info" | "warn";
367
+ logLevel: "verbose" | "info" | "warn" | "error";
369
368
  }, message?: any, ...optionalParams: any[]) => void;
370
369
  warn: (message?: any, ...optionalParams: any[]) => void;
371
370
  warnAdvanced: (options: {
372
371
  indent: boolean;
373
- logLevel: "verbose" | "error" | "info" | "warn";
372
+ logLevel: "verbose" | "info" | "warn" | "error";
374
373
  }, message?: any, ...optionalParams: any[]) => void;
375
374
  error: (message?: any, ...optionalParams: any[]) => void;
376
375
  };
377
- getLogLevel: () => "verbose" | "error" | "info" | "warn";
378
- setLogLevel: (newLogLevel: "verbose" | "error" | "info" | "warn") => void;
376
+ getLogLevel: () => "verbose" | "info" | "warn" | "error";
377
+ setLogLevel: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
379
378
  INDENT_TOKEN: string;
380
379
  isColorSupported: boolean;
381
380
  HeadlessBrowser: typeof HeadlessBrowser;
package/dist/logger.d.ts CHANGED
@@ -17,6 +17,6 @@ export declare const Log: {
17
17
  warnAdvanced: (options: LogOptions, message?: any, ...optionalParams: any[]) => void;
18
18
  error: (message?: any, ...optionalParams: any[]) => void;
19
19
  };
20
- export declare const getLogLevel: () => "verbose" | "error" | "info" | "warn";
20
+ export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error";
21
21
  export declare const setLogLevel: (newLogLevel: LogLevel) => void;
22
22
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ClipRegion } from 'remotion';
3
2
  import type { Page } from './browser/BrowserPage';
4
3
  import type { StillImageFormat } from './image-format';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ClipRegion } from 'remotion';
3
2
  import type { Page } from './browser/BrowserPage';
4
3
  import type { StillImageFormat } from './image-format';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ClipRegion } from 'remotion';
3
2
  import type { Page } from './browser/BrowserPage';
4
3
  import type { StillImageFormat } from './image-format';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ClipRegion } from 'remotion';
3
2
  import type { Page } from './browser/BrowserPage';
4
3
  import type { StillImageFormat } from './image-format';
@@ -18,7 +18,7 @@ const waitForReady = (page) => {
18
18
  }),
19
19
  page
20
20
  .mainFrame()
21
- ._mainWorld.waitForFunction(page.browser, 'window.ready === true')
21
+ ._mainWorld.waitForFunction(page.browser, 'window.remotion_renderReady === true')
22
22
  .catch((err) => {
23
23
  throw err;
24
24
  }),
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
3
2
  import type { RenderAssetInfo } from './assets/download-map';
4
3
  import type { AudioCodec } from './audio-codec';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { TAsset } from 'remotion';
3
2
  import type { DownloadMap } from './assets/download-map';
4
3
  import type { Page } from './browser/BrowserPage';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.0-alpha10",
3
+ "version": "4.0.0-alpha12",
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.0-alpha10"
21
+ "remotion": "4.0.0-alpha12"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -42,13 +42,13 @@
42
42
  "zod": "^3.21.4"
43
43
  },
44
44
  "optionalDependencies": {
45
- "@remotion/compositor-darwin-arm64": "4.0.0-alpha10",
46
- "@remotion/compositor-linux-arm64-gnu": "4.0.0-alpha10",
47
- "@remotion/compositor-linux-x64-gnu": "4.0.0-alpha10",
48
- "@remotion/compositor-darwin-x64": "4.0.0-alpha10",
49
- "@remotion/compositor-linux-x64-musl": "4.0.0-alpha10",
50
- "@remotion/compositor-linux-arm64-musl": "4.0.0-alpha10",
51
- "@remotion/compositor-win32-x64-msvc": "4.0.0-alpha10"
45
+ "@remotion/compositor-linux-arm64-gnu": "4.0.0-alpha12",
46
+ "@remotion/compositor-darwin-x64": "4.0.0-alpha12",
47
+ "@remotion/compositor-darwin-arm64": "4.0.0-alpha12",
48
+ "@remotion/compositor-linux-arm64-musl": "4.0.0-alpha12",
49
+ "@remotion/compositor-linux-x64-musl": "4.0.0-alpha12",
50
+ "@remotion/compositor-win32-x64-msvc": "4.0.0-alpha12",
51
+ "@remotion/compositor-linux-x64-gnu": "4.0.0-alpha12"
52
52
  },
53
53
  "keywords": [
54
54
  "remotion",
@@ -1,9 +0,0 @@
1
- import type { FfmpegExecutable } from '../ffmpeg-executable';
2
- import type { DownloadMap, VideoDurationResult } from './download-map';
3
- export declare const parseVideoStreamDuration: (stdout: string) => VideoDurationResult;
4
- export declare function getVideoStreamDurationwithoutCache({ src, ffprobeExecutable, remotionRoot, }: {
5
- src: string;
6
- ffprobeExecutable: FfmpegExecutable;
7
- remotionRoot: string;
8
- }): Promise<VideoDurationResult>;
9
- export declare const getVideoStreamDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable, remotionRoot: string) => Promise<VideoDurationResult>;
@@ -1,71 +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.getVideoStreamDuration = exports.getVideoStreamDurationwithoutCache = exports.parseVideoStreamDuration = void 0;
7
- const execa_1 = __importDefault(require("execa"));
8
- const ffmpeg_flags_1 = require("../ffmpeg-flags");
9
- const p_limit_1 = require("../p-limit");
10
- const limit = (0, p_limit_1.pLimit)(1);
11
- const parseAlternativeDuration = (stdout) => {
12
- const webmDuration = stdout.match(/TAG:DURATION=([0-9.]+):([0-9.]+):([0-9.]+)/);
13
- if (!webmDuration) {
14
- return null;
15
- }
16
- const [, hours, minutes, seconds] = webmDuration;
17
- const hoursAsNumber = Number(hours);
18
- if (Number.isNaN(hoursAsNumber)) {
19
- return null;
20
- }
21
- const minutesAsNumber = Number(minutes);
22
- if (Number.isNaN(minutesAsNumber)) {
23
- return null;
24
- }
25
- const secondsAsNumber = Number(seconds);
26
- if (Number.isNaN(secondsAsNumber)) {
27
- return null;
28
- }
29
- return secondsAsNumber + minutesAsNumber * 60 + hoursAsNumber * 3600;
30
- };
31
- const parseVideoStreamDuration = (stdout) => {
32
- const duration = stdout.match(/duration=([0-9.]+)/);
33
- const alternativeDuration = parseAlternativeDuration(stdout);
34
- const fps = stdout.match(/r_frame_rate=([0-9.]+)\/([0-9.]+)/);
35
- const result = {
36
- duration: duration ? parseFloat(duration[1]) : alternativeDuration,
37
- fps: fps ? parseInt(fps[1], 10) / parseInt(fps[2], 10) : null,
38
- };
39
- return result;
40
- };
41
- exports.parseVideoStreamDuration = parseVideoStreamDuration;
42
- async function getVideoStreamDurationwithoutCache({ src, ffprobeExecutable, remotionRoot, }) {
43
- const args = [
44
- ['-v', 'error'],
45
- ['-select_streams', 'v:0'],
46
- ['-show_entries', 'stream'],
47
- [src],
48
- ]
49
- .reduce((acc, val) => acc.concat(val), [])
50
- .filter(Boolean);
51
- const task = await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffprobeExecutable, remotionRoot, 'ffprobe'), args);
52
- const result = (0, exports.parseVideoStreamDuration)(task.stdout);
53
- return result;
54
- }
55
- exports.getVideoStreamDurationwithoutCache = getVideoStreamDurationwithoutCache;
56
- async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot) {
57
- if (downloadMap.videoDurationResultCache[src]) {
58
- return downloadMap.videoDurationResultCache[src];
59
- }
60
- const result = await getVideoStreamDurationwithoutCache({
61
- src,
62
- ffprobeExecutable,
63
- remotionRoot,
64
- });
65
- downloadMap.videoDurationResultCache[src] = result;
66
- return result;
67
- }
68
- const getVideoStreamDuration = (downloadMap, src, ffprobeExecutable, remotionRoot) => {
69
- return limit(() => getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot));
70
- };
71
- exports.getVideoStreamDuration = getVideoStreamDuration;
@@ -1,9 +0,0 @@
1
- export declare const calculateDisplayVideoSize: ({ darX, darY, x, y, }: {
2
- x: number;
3
- y: number;
4
- darX: number;
5
- darY: number;
6
- }) => {
7
- width: number;
8
- height: number;
9
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- // https://superuser.com/questions/907933/correct-aspect-ratio-without-re-encoding-video-file
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.calculateDisplayVideoSize = void 0;
5
- const calculateDisplayVideoSize = ({ darX, darY, x, y, }) => {
6
- // We know two equations:
7
- // newWidth / newHeight = darX / darY
8
- // and:
9
- // x * y = (newWidth * newHeight)
10
- // I solved it then on pen and paper and simplified the formula:
11
- const dimensions = x * y;
12
- const newWidth = Math.sqrt(dimensions * (darX / darY));
13
- const newHeight = dimensions / newWidth;
14
- return {
15
- height: Math.round(newHeight),
16
- width: Math.round(newWidth),
17
- };
18
- };
19
- exports.calculateDisplayVideoSize = calculateDisplayVideoSize;
@@ -1 +0,0 @@
1
- export declare const determineResizeParams: (needsResize: [number, number] | null) => string[];
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.determineResizeParams = void 0;
4
- const determineResizeParams = (needsResize) => {
5
- if (needsResize === null) {
6
- return [];
7
- }
8
- return ['-s', `${needsResize[0]}x${needsResize[1]}`];
9
- };
10
- exports.determineResizeParams = determineResizeParams;
@@ -1,2 +0,0 @@
1
- import type { SpecialVCodecForTransparency } from './assets/download-map';
2
- export declare const determineVcodecFfmpegFlags: (vcodecFlag: SpecialVCodecForTransparency) => string[];
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.determineVcodecFfmpegFlags = void 0;
4
- const truthy_1 = require("./truthy");
5
- const determineVcodecFfmpegFlags = (vcodecFlag) => {
6
- return [
7
- vcodecFlag === 'vp9' ? '-vcodec' : null,
8
- vcodecFlag === 'vp9' ? 'libvpx-vp9' : null,
9
- vcodecFlag === 'vp8' ? '-vcodec' : null,
10
- vcodecFlag === 'vp8' ? 'libvpx' : null,
11
- ].filter(truthy_1.truthy);
12
- };
13
- exports.determineVcodecFfmpegFlags = determineVcodecFfmpegFlags;
@@ -1,18 +0,0 @@
1
- export declare type EnsureFfmpegOptions = {
2
- remotionRoot?: string;
3
- };
4
- declare type Result = {
5
- result: 'found-in-path' | 'found-in-node-modules' | 'installed';
6
- wasAlreadyInstalled: boolean;
7
- };
8
- /**
9
- * @description Checks if the ffmpeg binary is installed and if it is not, downloads it and puts it into your node_modules folder.
10
- * @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffmpeg)
11
- */
12
- export declare const ensureFfmpeg: (options?: EnsureFfmpegOptions) => Promise<Result>;
13
- /**
14
- * @description Checks if the ffprobe binary is installed and if it is not, downloads it and puts it into your node_modules folder.
15
- * @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffprobe)
16
- */
17
- export declare const ensureFfprobe: (options?: EnsureFfmpegOptions) => Promise<Result>;
18
- export {};
@@ -1,58 +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.ensureFfprobe = exports.ensureFfmpeg = void 0;
7
- const fs_1 = require("fs");
8
- const os_1 = __importDefault(require("os"));
9
- const ffmpeg_flags_1 = require("./ffmpeg-flags");
10
- const validate_ffmpeg_1 = require("./validate-ffmpeg");
11
- const ensureFfmpegOrFfprobe = async (binary, options) => {
12
- var _a;
13
- const exists = (0, validate_ffmpeg_1.binaryExists)(binary);
14
- const remotionRoot = (_a = options === null || options === void 0 ? void 0 : options.remotionRoot) !== null && _a !== void 0 ? _a : process.cwd();
15
- if (exists) {
16
- return {
17
- wasAlreadyInstalled: true,
18
- result: 'found-in-path',
19
- };
20
- }
21
- if (process.platform === 'linux' && (0, fs_1.existsSync)(ffmpeg_flags_1.lambdaFfmpegPaths[binary])) {
22
- return {
23
- wasAlreadyInstalled: true,
24
- result: 'found-in-path',
25
- };
26
- }
27
- if ((0, ffmpeg_flags_1.ffmpegInNodeModules)(remotionRoot, binary)) {
28
- return {
29
- result: 'found-in-node-modules',
30
- wasAlreadyInstalled: true,
31
- };
32
- }
33
- const binaryUrl = (0, ffmpeg_flags_1.getBinaryDownloadUrl)(binary);
34
- if (binaryUrl) {
35
- await (0, ffmpeg_flags_1.downloadBinary)(remotionRoot, binaryUrl.url, binary);
36
- return {
37
- result: 'installed',
38
- wasAlreadyInstalled: false,
39
- };
40
- }
41
- throw new Error(`${binary} could not be installed automatically. Your architecture and OS combination (os = ${os_1.default.platform()}, arch = ${process.arch}) is not supported. Please install ${binary} manually and add "${binary}" to your PATH.`);
42
- };
43
- /**
44
- * @description Checks if the ffmpeg binary is installed and if it is not, downloads it and puts it into your node_modules folder.
45
- * @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffmpeg)
46
- */
47
- const ensureFfmpeg = (options) => {
48
- return ensureFfmpegOrFfprobe('ffmpeg', options);
49
- };
50
- exports.ensureFfmpeg = ensureFfmpeg;
51
- /**
52
- * @description Checks if the ffprobe binary is installed and if it is not, downloads it and puts it into your node_modules folder.
53
- * @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffprobe)
54
- */
55
- const ensureFfprobe = (options) => {
56
- return ensureFfmpegOrFfprobe('ffprobe', options);
57
- };
58
- exports.ensureFfprobe = ensureFfprobe;
@@ -1,15 +0,0 @@
1
- import type { DownloadMap } from './assets/download-map';
2
- import type { FfmpegExecutable } from './ffmpeg-executable';
3
- export declare const ensurePresentationTimestampWithoutCache: ({ src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }: {
4
- src: string;
5
- remotionRoot: string;
6
- ffmpegExecutable: FfmpegExecutable;
7
- ffprobeExecutable: FfmpegExecutable;
8
- }) => Promise<string>;
9
- export declare const ensurePresentationTimestamps: ({ downloadMap, src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }: {
10
- downloadMap: DownloadMap;
11
- src: string;
12
- remotionRoot: string;
13
- ffmpegExecutable: FfmpegExecutable;
14
- ffprobeExecutable: FfmpegExecutable;
15
- }) => Promise<string>;
@@ -1,88 +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.ensurePresentationTimestamps = exports.ensurePresentationTimestampWithoutCache = void 0;
7
- const execa_1 = __importDefault(require("execa"));
8
- const path_1 = __importDefault(require("path"));
9
- const ffmpeg_flags_1 = require("./ffmpeg-flags");
10
- const guess_extension_for_media_1 = require("./guess-extension-for-media");
11
- const truthy_1 = require("./truthy");
12
- let callbacks = [];
13
- const getTemporaryOutputName = async ({ src, remotionRoot, ffprobeBinary, }) => {
14
- const parts = src.split(path_1.default.sep);
15
- // If there is no file extension for the video, then we need to temporarily add an extension
16
- const lastPart = parts[parts.length - 1];
17
- const extraExtension = lastPart.includes('.')
18
- ? null
19
- : await (0, guess_extension_for_media_1.guessExtensionForVideo)({
20
- src,
21
- remotionRoot,
22
- ffprobeBinary,
23
- });
24
- return parts
25
- .map((p, i) => {
26
- if (i === parts.length - 1) {
27
- return [`pts-${p}`, extraExtension].filter(truthy_1.truthy).join('.');
28
- }
29
- return p;
30
- })
31
- .join(path_1.default.sep);
32
- };
33
- const ensurePresentationTimestampWithoutCache = async ({ src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }) => {
34
- // If there is no file extension for the video, then we need to tempoa
35
- const output = await getTemporaryOutputName({
36
- src,
37
- remotionRoot,
38
- ffprobeBinary: ffprobeExecutable,
39
- });
40
- await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
41
- '-i',
42
- src,
43
- '-fflags',
44
- '+genpts+igndts',
45
- '-vcodec',
46
- 'copy',
47
- '-acodec',
48
- 'copy',
49
- output,
50
- '-y',
51
- ]);
52
- return output;
53
- };
54
- exports.ensurePresentationTimestampWithoutCache = ensurePresentationTimestampWithoutCache;
55
- const ensurePresentationTimestamps = async ({ downloadMap, src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }) => {
56
- const elem = downloadMap.ensureFileHasPresentationTimestamp[src];
57
- if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'encoding') {
58
- return new Promise((resolve) => {
59
- callbacks.push({
60
- src,
61
- fn: (newSrc) => resolve(newSrc),
62
- });
63
- });
64
- }
65
- if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'done') {
66
- return elem.src;
67
- }
68
- downloadMap.ensureFileHasPresentationTimestamp[src] = { type: 'encoding' };
69
- const output = await (0, exports.ensurePresentationTimestampWithoutCache)({
70
- ffmpegExecutable,
71
- ffprobeExecutable,
72
- remotionRoot,
73
- src,
74
- });
75
- callbacks = callbacks.filter((c) => {
76
- if (c.src === src) {
77
- c.fn(output);
78
- return false;
79
- }
80
- return true;
81
- });
82
- downloadMap.ensureFileHasPresentationTimestamp[src] = {
83
- type: 'done',
84
- src: output,
85
- };
86
- return output;
87
- };
88
- exports.ensurePresentationTimestamps = ensurePresentationTimestamps;
@@ -1,16 +0,0 @@
1
- import type { OffthreadVideoImageFormat } from 'remotion';
2
- import type { DownloadMap } from './assets/download-map';
3
- import type { FfmpegExecutable } from './ffmpeg-executable';
4
- import type { LastFrameOptions } from './last-frame-from-video-cache';
5
- export declare const getLastFrameOfVideo: (options: LastFrameOptions) => Promise<Buffer>;
6
- declare type Options = {
7
- time: number;
8
- src: string;
9
- ffmpegExecutable: FfmpegExecutable;
10
- ffprobeExecutable: FfmpegExecutable;
11
- imageFormat: OffthreadVideoImageFormat;
12
- downloadMap: DownloadMap;
13
- remotionRoot: string;
14
- };
15
- export declare const extractFrameFromVideo: (options: Options) => Promise<Buffer>;
16
- export {};