@remotion/renderer 3.0.24 → 3.0.25

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.
@@ -0,0 +1,9 @@
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
+ };
@@ -0,0 +1,19 @@
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,9 +1,7 @@
1
+ /// <reference types="node" />
1
2
  import type { FfmpegExecutable, OffthreadVideoImageFormat } from 'remotion';
2
3
  import type { LastFrameOptions } from './last-frame-from-video-cache';
3
- export declare const determineResizeParams: (needsResize: [
4
- number,
5
- number
6
- ] | null) => string[];
4
+ export declare const determineResizeParams: (needsResize: [number, number] | null) => string[];
7
5
  export declare const getLastFrameOfVideo: (options: LastFrameOptions) => Promise<Buffer>;
8
6
  declare type Options = {
9
7
  time: number;
File without changes
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getVideoInfo = void 0;
7
7
  const execa_1 = __importDefault(require("execa"));
8
+ const calculate_sar_dar_pixels_1 = require("./calculate-sar-dar-pixels");
8
9
  const p_limit_1 = require("./p-limit");
9
10
  const isVp9VideoCache = {};
10
11
  const limit = (0, p_limit_1.pLimit)(1);
@@ -26,8 +27,12 @@ async function getVideoInfoUnlimited(src, ffprobeExecutable) {
26
27
  const height = parseInt(dimensions[2], 10);
27
28
  const darWidth = parseInt(dar[1], 10);
28
29
  const darHeight = parseInt(dar[2], 10);
29
- const actualWidth = Math.round(width * (darWidth / darHeight));
30
- const actualHeight = Math.round(height * (darHeight / darWidth));
30
+ const { width: actualWidth, height: actualHeight } = (0, calculate_sar_dar_pixels_1.calculateDisplayVideoSize)({
31
+ darX: darWidth,
32
+ darY: darHeight,
33
+ x: width,
34
+ y: height,
35
+ });
31
36
  if (actualWidth !== width || actualHeight !== height) {
32
37
  needsResize = [actualWidth, actualHeight];
33
38
  }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import execa from 'execa';
2
3
  import mime from 'mime-types';
3
4
  import { SymbolicateableError } from './error-handling/symbolicateable-error';
@@ -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 = {
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { ImageFormat } from 'remotion';
2
3
  import type { Page } from './browser/Page';
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/Page';
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 { ImageFormat } from 'remotion';
2
3
  import type { Page } from './browser/Page';
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/Page';
3
4
  import type { ScreenshotOptions } from './browser/ScreenshotOptions';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.0.24",
3
+ "version": "3.0.25",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "execa": "5.1.1",
24
24
  "extract-zip": "2.0.1",
25
25
  "mime-types": "2.1.35",
26
- "remotion": "3.0.24",
26
+ "remotion": "3.0.25",
27
27
  "source-map": "^0.8.0-beta.0",
28
28
  "ws": "8.7.0"
29
29
  },
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "7a9b3937f3d7eb41894a338cd92991e6d1226725"
66
+ "gitHead": "27ec369ebe9cf3d063095383c1e30dc83c60f010"
67
67
  }