@hyperframes/studio-server 0.8.183 → 0.8.184

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.
@@ -2,7 +2,7 @@ import {
2
2
  PROXY_VARIANT_CONFIG,
3
3
  probeFirstFrameColour,
4
4
  probeMediaMetadata
5
- } from "./chunk-E3VGIAMJ.js";
5
+ } from "./chunk-OVOXGASQ.js";
6
6
  import {
7
7
  mkdirWithinProject,
8
8
  realProjectRoot,
@@ -19,6 +19,7 @@ import {
19
19
  hdrToSdrToneMapFilter
20
20
  } from "@hyperframes/core";
21
21
  import { findFfBinary } from "@hyperframes/parsers/ff-binaries";
22
+ import { alphaDecoderFor } from "@hyperframes/parsers/media-alpha";
22
23
 
23
24
  // src/helpers/proxyCache.ts
24
25
  import { existsSync, readdirSync, statSync, unlinkSync } from "fs";
@@ -390,7 +391,9 @@ async function runFfmpeg(sourcePath, outputPath, variant, box, signal) {
390
391
  `format=${pixelFormat}`
391
392
  ].join(",") : [evenScale, `format=${pixelFormat}`].join(",");
392
393
  return new Promise((resolvePromise, reject) => {
393
- const commonArgs = ["-y", "-i", sourcePath, "-vf", videoFilter];
394
+ const alphaDecoder = keepsAlpha ? alphaDecoderFor(metadata.color.codecName) : null;
395
+ const decoderArgs = alphaDecoder ? ["-c:v", alphaDecoder] : [];
396
+ const commonArgs = ["-y", ...decoderArgs, "-i", sourcePath, "-vf", videoFilter];
394
397
  const h264Args = [
395
398
  "-c:v",
396
399
  "libx264",
@@ -22,6 +22,7 @@ import {
22
22
  parseFirstFrameColour
23
23
  } from "@hyperframes/core";
24
24
  import { findFfBinary } from "@hyperframes/parsers/ff-binaries";
25
+ import { videoStreamHasAlpha } from "@hyperframes/parsers/media-alpha";
25
26
  var execFileRunner = (command, args, options) => new Promise((resolvePromise) => {
26
27
  execFile(
27
28
  command,
@@ -76,10 +77,6 @@ function colorLabel(input) {
76
77
  }
77
78
  return "SDR/unknown";
78
79
  }
79
- var ALPHA_PIX_FMT_RE = /^(?:yuva|rgba|argb|bgra|abgr|gbrap|ya)/;
80
- function pixelFormatHasAlpha(pixFmt) {
81
- return pixFmt !== void 0 && ALPHA_PIX_FMT_RE.test(pixFmt.toLowerCase());
82
- }
83
80
  function classifyMediaColor(stream) {
84
81
  const colorPrimaries = lower(stream?.color_primaries);
85
82
  const colorSpace = lower(stream?.color_space);
@@ -124,7 +121,7 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
124
121
  "-v",
125
122
  "error",
126
123
  "-show_entries",
127
- "stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample:stream_disposition=attached_pic",
124
+ "stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample:stream_disposition=attached_pic:stream_tags=alpha_mode",
128
125
  "-of",
129
126
  "json",
130
127
  "--",
@@ -147,6 +144,7 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
147
144
  const metadata = { kind, color: classifyMediaColor(stream) };
148
145
  if (kind === "video") {
149
146
  metadata.hasAudio = (parsed.streams ?? []).some((item) => item.codec_type === "audio");
147
+ metadata.hasAlpha = stream !== void 0 && videoStreamHasAlpha(stream);
150
148
  }
151
149
  return metadata;
152
150
  } catch {
@@ -239,7 +237,7 @@ async function probeCodecFacts(filePath, runner) {
239
237
  if (metadata.kind !== "video") return null;
240
238
  const codecName = metadata.color.codecName;
241
239
  if (!codecName) return null;
242
- return codecFactsFor(codecName, pixelFormatHasAlpha(metadata.color.pixelFormat));
240
+ return codecFactsFor(codecName, metadata.hasAlpha === true);
243
241
  }
244
242
  function createMediaCodecProbeCache() {
245
243
  return /* @__PURE__ */ new Map();
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  PROXY_PARAMS_VERSION,
3
3
  resolveProxy
4
- } from "./chunk-D5RQMNZQ.js";
4
+ } from "./chunk-25IT6FMR.js";
5
5
  import {
6
6
  createMediaCodecProbeCache,
7
7
  proxyVariantFor,
8
8
  recordProxyPrewarm,
9
9
  scanProjectMediaCodecMap,
10
10
  shouldPrewarmProxy
11
- } from "./chunk-E3VGIAMJ.js";
11
+ } from "./chunk-OVOXGASQ.js";
12
12
 
13
13
  // src/helpers/mediaProxyPreview.ts
14
14
  import { resolve } from "path";
@@ -28,7 +28,7 @@ interface AssetCodecFacts {
28
28
  * when no representative mime exists (ProRes: browsers never decode it, so
29
29
  * the runtime always proxies rather than probing `canPlayType`). */
30
30
  representativeMime: string | null;
31
- /** Source carries an alpha channel (ffprobe pix_fmt). Alpha sources use a
31
+ /** Source carries an alpha channel (`MediaMetadata.hasAlpha`). Alpha sources use a
32
32
  * VP8/WebM proxy so their transparency is preserved across Chromium builds. */
33
33
  hasAlpha: boolean;
34
34
  }
@@ -13,7 +13,7 @@ import {
13
13
  resolveProxyVariantRequest,
14
14
  scanProjectMediaCodecMap,
15
15
  shouldPrewarmProxy
16
- } from "../chunk-E3VGIAMJ.js";
16
+ } from "../chunk-OVOXGASQ.js";
17
17
  import "../chunk-QF7MFJJU.js";
18
18
  import "../chunk-SVQFE44C.js";
19
19
  import "../chunk-L3HJVTQE.js";
@@ -4,9 +4,9 @@ import {
4
4
  isAutoProxyEnabled,
5
5
  proxyEtagSalt,
6
6
  resolvePreviewMediaCodecProbeCache
7
- } from "../chunk-436CO7P5.js";
8
- import "../chunk-D5RQMNZQ.js";
9
- import "../chunk-E3VGIAMJ.js";
7
+ } from "../chunk-T5CGF7VZ.js";
8
+ import "../chunk-25IT6FMR.js";
9
+ import "../chunk-OVOXGASQ.js";
10
10
  import "../chunk-QF7MFJJU.js";
11
11
  import "../chunk-SVQFE44C.js";
12
12
  import "../chunk-L3HJVTQE.js";
@@ -16,8 +16,8 @@ import {
16
16
  resolveProxies,
17
17
  resolveProxy,
18
18
  waitForProxy
19
- } from "../chunk-D5RQMNZQ.js";
20
- import "../chunk-E3VGIAMJ.js";
19
+ } from "../chunk-25IT6FMR.js";
20
+ import "../chunk-OVOXGASQ.js";
21
21
  import "../chunk-QF7MFJJU.js";
22
22
  import "../chunk-SVQFE44C.js";
23
23
  import "../chunk-L3HJVTQE.js";
package/dist/index.js CHANGED
@@ -80,7 +80,7 @@ import {
80
80
  isAutoProxyEnabled,
81
81
  proxyEtagSalt,
82
82
  resolvePreviewMediaCodecProbeCache
83
- } from "./chunk-436CO7P5.js";
83
+ } from "./chunk-T5CGF7VZ.js";
84
84
  import {
85
85
  CACHE_DIR_NAME,
86
86
  PROXY_PENDING_RETRY_AFTER_SECONDS,
@@ -91,7 +91,7 @@ import {
91
91
  proxyActivityMark,
92
92
  resolveProxy,
93
93
  waitForProxy
94
- } from "./chunk-D5RQMNZQ.js";
94
+ } from "./chunk-25IT6FMR.js";
95
95
  import {
96
96
  PROXY_VARIANT_CONFIG,
97
97
  decideMediaProxyEligibility,
@@ -100,7 +100,7 @@ import {
100
100
  probeMediaMetadata,
101
101
  recordProxyRequest,
102
102
  resolveProxyVariantRequest
103
- } from "./chunk-E3VGIAMJ.js";
103
+ } from "./chunk-OVOXGASQ.js";
104
104
  import {
105
105
  folderGone,
106
106
  isInHiddenOrVendorDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio-server",
3
- "version": "0.8.183",
3
+ "version": "0.8.184",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -84,8 +84,8 @@
84
84
  "linkedom": "^0.18.12",
85
85
  "postcss": "^8.5.8",
86
86
  "postcss-selector-parser": "^7.1.2",
87
- "@hyperframes/core": "0.8.183",
88
- "@hyperframes/parsers": "0.8.183"
87
+ "@hyperframes/core": "0.8.184",
88
+ "@hyperframes/parsers": "0.8.184"
89
89
  },
90
90
  "devDependencies": {
91
91
  "@types/node": "^25.0.10",