@remotion/renderer 3.2.1 → 3.2.2
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/get-video-stream-duration.d.ts +1 -0
- package/dist/assets/get-video-stream-duration.js +34 -10
- package/dist/create-ffmpeg-complex-filter.d.ts +4 -1
- 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 +6 -7
- package/dist/merge-audio-track.js +2 -1
- package/dist/provide-screenshot.d.ts +0 -1
- package/dist/puppeteer-screenshot.d.ts +0 -1
- package/dist/screenshot-dom-element.d.ts +0 -1
- package/dist/screenshot-task.d.ts +0 -1
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from '../ffmpeg-executable';
|
|
2
2
|
import type { DownloadMap, VideoDurationResult } from './download-map';
|
|
3
|
+
export declare const parseVideoStreamDuration: (stdout: string) => VideoDurationResult;
|
|
3
4
|
export declare const getVideoStreamDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable) => Promise<VideoDurationResult>;
|
|
@@ -3,10 +3,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getVideoStreamDuration = void 0;
|
|
6
|
+
exports.getVideoStreamDuration = exports.parseVideoStreamDuration = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
8
|
const p_limit_1 = require("../p-limit");
|
|
9
9
|
const limit = (0, p_limit_1.pLimit)(1);
|
|
10
|
+
const parseAlternativeDuration = (stdout) => {
|
|
11
|
+
const webmDuration = stdout.match(/TAG:DURATION=([0-9.]+):([0-9.]+):([0-9.]+)/);
|
|
12
|
+
if (!webmDuration) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const [, hours, minutes, seconds] = webmDuration;
|
|
16
|
+
const hoursAsNumber = Number(hours);
|
|
17
|
+
if (Number.isNaN(hoursAsNumber)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const minutesAsNumber = Number(minutes);
|
|
21
|
+
if (Number.isNaN(minutesAsNumber)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const secondsAsNumber = Number(seconds);
|
|
25
|
+
if (Number.isNaN(secondsAsNumber)) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return secondsAsNumber + minutesAsNumber * 60 + hoursAsNumber * 3600;
|
|
29
|
+
};
|
|
30
|
+
const parseVideoStreamDuration = (stdout) => {
|
|
31
|
+
const duration = stdout.match(/duration=([0-9.]+)/);
|
|
32
|
+
const alternativeDuration = parseAlternativeDuration(stdout);
|
|
33
|
+
const fps = stdout.match(/r_frame_rate=([0-9.]+)\/([0-9.]+)/);
|
|
34
|
+
const result = {
|
|
35
|
+
duration: duration ? parseFloat(duration[1]) : alternativeDuration,
|
|
36
|
+
fps: fps ? parseInt(fps[1], 10) / parseInt(fps[2], 10) : null,
|
|
37
|
+
};
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
exports.parseVideoStreamDuration = parseVideoStreamDuration;
|
|
10
41
|
async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable) {
|
|
11
42
|
if (downloadMap.videoDurationResultCache[src]) {
|
|
12
43
|
return downloadMap.videoDurationResultCache[src];
|
|
@@ -14,20 +45,13 @@ async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutab
|
|
|
14
45
|
const args = [
|
|
15
46
|
['-v', 'error'],
|
|
16
47
|
['-select_streams', 'v:0'],
|
|
17
|
-
['-show_entries', 'stream
|
|
48
|
+
['-show_entries', 'stream'],
|
|
18
49
|
[src],
|
|
19
50
|
]
|
|
20
51
|
.reduce((acc, val) => acc.concat(val), [])
|
|
21
52
|
.filter(Boolean);
|
|
22
53
|
const task = await (0, execa_1.default)(ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : 'ffprobe', args);
|
|
23
|
-
|
|
24
|
-
const fps = task.stdout.match(/r_frame_rate=([0-9.]+)\/([0-9.]+)/);
|
|
25
|
-
const result = {
|
|
26
|
-
duration: duration ? parseFloat(duration[1]) : null,
|
|
27
|
-
fps: fps ? parseInt(fps[1], 10) / parseInt(fps[2], 10) : null,
|
|
28
|
-
};
|
|
29
|
-
downloadMap.videoDurationResultCache[src] = result;
|
|
30
|
-
return result;
|
|
54
|
+
return (0, exports.parseVideoStreamDuration)(task.stdout);
|
|
31
55
|
}
|
|
32
56
|
const getVideoStreamDuration = (downloadMap, src, ffprobeExecutable) => {
|
|
33
57
|
return limit(() => getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable));
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { DownloadMap } from './assets/download-map';
|
|
2
2
|
export declare const createFfmpegComplexFilter: (filters: number, downloadMap: DownloadMap) => Promise<{
|
|
3
|
-
complexFilterFlag: [
|
|
3
|
+
complexFilterFlag: [
|
|
4
|
+
string,
|
|
5
|
+
string
|
|
6
|
+
] | null;
|
|
4
7
|
cleanup: () => void;
|
|
5
8
|
}>;
|
|
@@ -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" | "webm" | "mp4" | "mov" | "mkv";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const guessExtensionForVideo: (src: string) => Promise<"mp3" | "wav" | "
|
|
1
|
+
export declare const guessExtensionForVideo: (src: string) => Promise<"mp3" | "wav" | "webm" | "mp4">;
|
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';
|
|
@@ -68,7 +67,7 @@ export declare const RenderInternals: {
|
|
|
68
67
|
task: Promise<Buffer | null>;
|
|
69
68
|
getLogs: () => string;
|
|
70
69
|
}>;
|
|
71
|
-
getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "aac" | "wav" | "gif" | "
|
|
70
|
+
getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "aac" | "wav" | "gif" | "webm" | "mp4" | "mov" | "mkv";
|
|
72
71
|
tmpDir: (str: string) => string;
|
|
73
72
|
deleteDirectory: (directory: string) => Promise<void>;
|
|
74
73
|
isServeUrl: (potentialUrl: string) => boolean;
|
|
@@ -123,8 +122,8 @@ export declare const RenderInternals: {
|
|
|
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: "
|
|
125
|
+
DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | null;
|
|
126
|
+
validateOpenGlRenderer: (option: "angle" | "swangle" | "egl" | "swiftshader" | null) => "angle" | "swangle" | "egl" | "swiftshader" | null;
|
|
128
127
|
getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => number;
|
|
129
128
|
validateSelectedCrfAndCodecCombination: (crf: unknown, codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => void;
|
|
130
129
|
validImageFormats: readonly ["png", "jpeg", "none"];
|
|
@@ -136,12 +135,12 @@ export declare const RenderInternals: {
|
|
|
136
135
|
DEFAULT_TIMEOUT: number;
|
|
137
136
|
getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => [number, number];
|
|
138
137
|
validateSelectedPixelFormatAndCodecCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => void;
|
|
139
|
-
validateSelectedCodecAndProResCombination: (actualCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", actualProResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" |
|
|
140
|
-
validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", imageFormat: "
|
|
138
|
+
validateSelectedCodecAndProResCombination: (actualCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", actualProResProfile: "proxy" | "4444-xq" | "4444" | "hq" | "standard" | "light" | undefined) => void;
|
|
139
|
+
validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", imageFormat: "jpeg" | "png" | "none") => "none" | "valid";
|
|
141
140
|
DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
142
141
|
isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
|
|
143
142
|
logLevels: readonly ["verbose", "info", "warn", "error"];
|
|
144
|
-
isEqualOrBelowLogLevel: (currentLevel: "
|
|
143
|
+
isEqualOrBelowLogLevel: (currentLevel: "error" | "verbose" | "info" | "warn", level: "error" | "verbose" | "info" | "warn") => boolean;
|
|
145
144
|
isValidLogLevel: (level: string) => boolean;
|
|
146
145
|
validateEveryNthFrame: (everyNthFrame: unknown) => void;
|
|
147
146
|
perf: typeof perf;
|
|
@@ -70,7 +70,8 @@ const mergeAudioTrackUnlimited = async ({ ffmpegExecutable, outName, files, numb
|
|
|
70
70
|
await task;
|
|
71
71
|
cleanup();
|
|
72
72
|
};
|
|
73
|
-
|
|
73
|
+
// Must be at least 3 because recursively called twice in mergeAudioTrack
|
|
74
|
+
const limit = (0, p_limit_1.pLimit)(3);
|
|
74
75
|
const mergeAudioTrack = (options) => {
|
|
75
76
|
return limit(mergeAudioTrackUnlimited, options);
|
|
76
77
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
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.2.
|
|
25
|
+
"remotion": "3.2.2",
|
|
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": "8e5f2d05adf7ddd3824ea734fa888b4b4761f364"
|
|
61
61
|
}
|