@poe-platform/safe-bash 0.1.831 → 0.1.832

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.
@@ -19,6 +19,8 @@ export interface ParsedH264Sps {
19
19
  readonly fps?: number | undefined;
20
20
  readonly maxNumRefFrames: number;
21
21
  readonly maxNumReorderFrames?: number | undefined;
22
+ readonly colorRange?: string | undefined;
23
+ readonly colorSpace?: string | undefined;
22
24
  }
23
25
  export declare function parseH264Sps(nalu: Uint8Array): ParsedH264Sps;
24
26
  export declare function parseAvcC(payload: Uint8Array): Mp4AvcCConfig;
@@ -331956,6 +331956,21 @@ var H264_PROFILES = {
331956
331956
  122: "High 4:2:2",
331957
331957
  244: "High 4:4:4 Predictive"
331958
331958
  };
331959
+ var H264_COLOR_SPACES = {
331960
+ 0: "gbr",
331961
+ 1: "bt709",
331962
+ 4: "fcc",
331963
+ 5: "bt470bg",
331964
+ 6: "smpte170m",
331965
+ 7: "smpte240m",
331966
+ 8: "ycgco",
331967
+ 9: "bt2020nc",
331968
+ 10: "bt2020c",
331969
+ 11: "smpte2085",
331970
+ 12: "chroma-derived-nc",
331971
+ 13: "chroma-derived-c",
331972
+ 14: "ictcp"
331973
+ };
331959
331974
  var H264_SAR_TABLE = [
331960
331975
  [1, 1],
331961
331976
  [1, 1],
@@ -332076,6 +332091,8 @@ function parseH264Sps(nalu) {
332076
332091
  let sarHeight = 1;
332077
332092
  let fps;
332078
332093
  let maxNumReorderFrames;
332094
+ let colorRange;
332095
+ let colorSpace;
332079
332096
  const vuiPresent = bits.readBit();
332080
332097
  if (vuiPresent && bits.bitsRemaining > 0) {
332081
332098
  const aspectRatioInfoPresent = bits.readBit();
@@ -332094,10 +332111,11 @@ function parseH264Sps(nalu) {
332094
332111
  const videoSignalTypePresent = bits.readBit();
332095
332112
  if (videoSignalTypePresent) {
332096
332113
  bits.readBits(3);
332097
- bits.readBit();
332114
+ colorRange = bits.readBit() ? "pc" : "tv";
332098
332115
  const colourDescriptionPresent = bits.readBit();
332099
332116
  if (colourDescriptionPresent) {
332100
- bits.readBits(24);
332117
+ bits.readBits(16);
332118
+ colorSpace = H264_COLOR_SPACES[bits.readBits(8)];
332101
332119
  }
332102
332120
  }
332103
332121
  const chromaLocInfoPresent = bits.readBit();
@@ -332161,7 +332179,9 @@ function parseH264Sps(nalu) {
332161
332179
  sarHeight,
332162
332180
  fps,
332163
332181
  maxNumRefFrames,
332164
- maxNumReorderFrames
332182
+ maxNumReorderFrames,
332183
+ colorRange,
332184
+ colorSpace
332165
332185
  };
332166
332186
  }
332167
332187
  function parseAvcC(payload) {
@@ -332922,6 +332942,8 @@ function applyCodecMetadata(state, child) {
332922
332942
  if (child.sps) {
332923
332943
  const sps = parseH264Sps(child.sps);
332924
332944
  metadata.maxNumReorderFrames = sps.maxNumReorderFrames;
332945
+ metadata.colorRange = sps.colorRange;
332946
+ metadata.colorSpace = sps.colorSpace;
332925
332947
  metadata.profile = sps.profileName;
332926
332948
  metadata.width = sps.width || metadata.width;
332927
332949
  metadata.height = sps.height || metadata.height;
@@ -333063,13 +333085,13 @@ function buildProbeStream(track, desc, stats, idx, containerFormat) {
333063
333085
  height: h,
333064
333086
  coded_width: w ? Math.ceil(w / 16) * 16 : void 0,
333065
333087
  coded_height: h ? Math.ceil(h / 16) * 16 : void 0,
333066
- has_b_frames: track.type === "video" ? desc?.maxNumReorderFrames ?? (stats.hasCts ? 1 : 0) : void 0,
333088
+ has_b_frames: track.type === "video" ? desc?.maxNumReorderFrames ?? (stats.hasReorderedSamples ? 1 : 0) : void 0,
333067
333089
  sample_aspect_ratio: track.type === "video" ? `${desc?.sarWidth ?? 1}:${desc?.sarHeight ?? 1}` : void 0,
333068
333090
  display_aspect_ratio: track.type === "video" && w && h ? `${w / darGcd}:${h / darGcd}` : void 0,
333069
333091
  pix_fmt: track.type === "video" ? desc?.pixFmt ?? "yuv420p" : void 0,
333070
333092
  level: desc?.level,
333071
- color_range: track.type === "video" ? "tv" : void 0,
333072
- color_space: track.type === "video" ? "bt709" : void 0,
333093
+ color_range: track.type === "video" ? desc?.colorRange : void 0,
333094
+ color_space: track.type === "video" ? desc?.colorSpace : void 0,
333073
333095
  sample_fmt: sampleFormat,
333074
333096
  sample_rate: track.type === "audio" ? String(desc?.sampleRate ?? track.timescale) : void 0,
333075
333097
  channels: track.type === "audio" ? desc?.channels ?? 2 : void 0,
@@ -334989,7 +335011,7 @@ function buildProbeResultFromDoc(doc, byteLength, filename = "input.mp4", option
334989
335011
  count: materialized.samples.length,
334990
335012
  ticks: materialized.samples.reduce((total, sample) => total + sample.duration, 0),
334991
335013
  firstPts,
334992
- hasCts: materialized.samples.some((sample) => sample.cts !== 0)
335014
+ hasReorderedSamples: materialized.samples.some((sample, i, samples) => i > 0 && sample.pts < samples[i - 1].pts)
334993
335015
  }, idx, doc.containerFormat);
334994
335016
  streams.push(stream);
334995
335017
  const w = stream.width, h = stream.height, sampleFormat = stream.sample_fmt;
@@ -340052,14 +340074,15 @@ async function* scanProbeRecords(source, options, mode) {
340052
340074
  formatStart = Math.min(formatStart, start);
340053
340075
  formatEnd = Math.max(formatEnd, start + probeDuration / Math.max(1, timescale));
340054
340076
  if (mode === "summary") continue;
340055
- let bytePos = 0, cursor = 0;
340056
- const stats = { totalBytes: 0, count: 0, ticks: 0, firstPts: startPts, hasCts: false };
340077
+ let bytePos = 0, cursor = 0, previousPts = -Infinity;
340078
+ const stats = { totalBytes: 0, count: 0, ticks: 0, firstPts: startPts, hasReorderedSamples: false };
340057
340079
  const packet = (sample) => {
340058
340080
  if (mode === "streams") {
340059
340081
  stats.count++;
340060
340082
  stats.totalBytes += sample.size;
340061
340083
  stats.ticks += sample.duration;
340062
- stats.hasCts ||= sample.pts !== sample.dts;
340084
+ stats.hasReorderedSamples ||= sample.pts < previousPts;
340085
+ previousPts = sample.pts;
340063
340086
  }
340064
340087
  const record = { sample, track, bytePos };
340065
340088
  bytePos += sample.size;
@@ -12,7 +12,7 @@ import {
12
12
  probeOggStreamMetadata,
13
13
  scanMp4Frames,
14
14
  scanMp4Packets
15
- } from "./chunk-R6PMUP4E.js";
15
+ } from "./chunk-GQQUZGIZ.js";
16
16
 
17
17
  // packages/safe-bash-command-ffprobe/src/probe-text.ts
18
18
  import { yieldTurn } from "../../safe-bash-contracts/yield.js";
@@ -20,7 +20,7 @@ import {
20
20
  sliceMp4,
21
21
  srtAst,
22
22
  webvttAst
23
- } from "../safe-bash/command-chunks/chunk-R6PMUP4E.js";
23
+ } from "../safe-bash/command-chunks/chunk-GQQUZGIZ.js";
24
24
  import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
25
25
 
26
26
  // packages/safe-bash-command-ffmpeg/src/index.ts
@@ -786,6 +786,8 @@ async function applyVideoFilterChain(frames, filterChainStr, budget, subtitleCue
786
786
  }
787
787
  return { ...f, data: nextData };
788
788
  }, signal);
789
+ } else if (name !== "format" && name !== "null") {
790
+ throw new Error(`Unsupported video filter: ${name}`);
789
791
  }
790
792
  }
791
793
  return current;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createFfprobeCommand
3
- } from "../safe-bash/command-chunks/chunk-M3QUDUEM.js";
3
+ } from "../safe-bash/command-chunks/chunk-THJIIMGT.js";
4
4
  import "../safe-bash/command-chunks/chunk-MGBHGZEX.js";
5
- import "../safe-bash/command-chunks/chunk-R6PMUP4E.js";
5
+ import "../safe-bash/command-chunks/chunk-GQQUZGIZ.js";
6
6
  import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
7
7
 
8
8
  // packages/safe-bash-command-ffprobe/src/index.ts
@@ -11,9 +11,9 @@ import {
11
11
  loadManifestResources,
12
12
  resolvePath,
13
13
  rethrowRuntimeError
14
- } from "../safe-bash/command-chunks/chunk-M3QUDUEM.js";
14
+ } from "../safe-bash/command-chunks/chunk-THJIIMGT.js";
15
15
  import "../safe-bash/command-chunks/chunk-MGBHGZEX.js";
16
- import "../safe-bash/command-chunks/chunk-R6PMUP4E.js";
16
+ import "../safe-bash/command-chunks/chunk-GQQUZGIZ.js";
17
17
  import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
18
18
  export {
19
19
  createFfprobeCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-bash",
3
- "version": "0.1.831",
3
+ "version": "0.1.832",
4
4
  "description": "Extensible virtual shell with pluggable filesystems and streaming commands",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1415,7 +1415,7 @@
1415
1415
  "access": "public"
1416
1416
  },
1417
1417
  "dependencies": {
1418
- "@poe-platform/safe-fs": "0.1.831",
1418
+ "@poe-platform/safe-fs": "0.1.832",
1419
1419
  "pdf-lib": "1.17.1",
1420
1420
  "@types/node": "^25.2.2",
1421
1421
  "@formatjs/intl-numberformat": "9.4.0",