@remotion/renderer 4.0.0-offthread.8 → 4.0.0-offthread.9

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.
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { FfmpegExecutable } from 'remotion';
4
3
  import { Readable } from 'stream';
5
4
  export declare function streamToString(stream: Readable): Promise<string>;
@@ -7,6 +7,7 @@ exports.extractFrameFromVideo = exports.extractFrameFromVideoFn = exports.stream
7
7
  const execa_1 = __importDefault(require("execa"));
8
8
  const remotion_1 = require("remotion");
9
9
  const frame_to_ffmpeg_timestamp_1 = require("./frame-to-ffmpeg-timestamp");
10
+ const is_beyond_last_frame_1 = require("./is-beyond-last-frame");
10
11
  const last_frame_from_video_cache_1 = require("./last-frame-from-video-cache");
11
12
  const p_limit_1 = require("./p-limit");
12
13
  function streamToString(stream) {
@@ -83,6 +84,13 @@ const getLastFrameOfVideo = async (options) => {
83
84
  return result;
84
85
  };
85
86
  const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, }) => {
87
+ if ((0, is_beyond_last_frame_1.isBeyondLastFrame)(src, time)) {
88
+ return getLastFrameOfVideo({
89
+ ffmpegExecutable,
90
+ offset: 0,
91
+ src,
92
+ });
93
+ }
86
94
  const ffmpegTimestamp = (0, frame_to_ffmpeg_timestamp_1.frameToFfmpegTimestamp)(time);
87
95
  const { stdout, stderr } = (0, execa_1.default)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : 'ffmpeg', [
88
96
  '-ss',
@@ -132,6 +140,7 @@ const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, }) => {
132
140
  stdoutBuffer,
133
141
  ]);
134
142
  if (stderrStr.includes('Output file is empty')) {
143
+ (0, is_beyond_last_frame_1.markAsBeyondLastFrame)(src, time);
135
144
  return getLastFrameOfVideo({
136
145
  ffmpegExecutable,
137
146
  offset: 0,
@@ -0,0 +1,2 @@
1
+ export declare const isBeyondLastFrame: (src: string, time: number) => boolean | 0;
2
+ export declare const markAsBeyondLastFrame: (src: string, time: number) => void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.markAsBeyondLastFrame = exports.isBeyondLastFrame = void 0;
4
+ const map = {};
5
+ const isBeyondLastFrame = (src, time) => {
6
+ return map[src] && time >= map[src];
7
+ };
8
+ exports.isBeyondLastFrame = isBeyondLastFrame;
9
+ const markAsBeyondLastFrame = (src, time) => {
10
+ map[src] = time;
11
+ };
12
+ exports.markAsBeyondLastFrame = markAsBeyondLastFrame;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import puppeteer from 'puppeteer-core';
3
2
  import { ImageFormat } from 'remotion';
4
3
  export declare const provideScreenshot: ({ page, imageFormat, options, quality, }: {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.provideScreenshot = void 0;
4
4
  const screenshot_dom_element_1 = require("./screenshot-dom-element");
5
- const provideScreenshot = async ({ page, imageFormat, options, quality, }) => {
5
+ const provideScreenshot = ({ page, imageFormat, options, quality, }) => {
6
6
  return (0, screenshot_dom_element_1.screenshotDOMElement)({
7
7
  page,
8
8
  opts: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.0-offthread.8+cc05bc8a0",
3
+ "version": "4.0.0-offthread.9+41e641761",
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
  "puppeteer-core": "13.5.1",
25
- "remotion": "4.0.0-offthread.8+cc05bc8a0",
25
+ "remotion": "4.0.0-offthread.9+41e641761",
26
26
  "serve-handler": "6.1.3",
27
27
  "source-map": "^0.8.0-beta.0"
28
28
  },
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "cc05bc8a03feb46a3a100ab5b4069c8e16f404b4"
62
+ "gitHead": "41e641761b9df6c7c876fb8bbb5ca4e5a0fe6e2a"
63
63
  }