@hyperframes/producer 0.8.154 → 0.8.156

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.
@@ -93,7 +93,7 @@ import {
93
93
  LOW_MEMORY_TOTAL_MB_THRESHOLD,
94
94
  assertConfiguredFfmpegBinariesExist,
95
95
  resolveBrowserGpuMode,
96
- resolveHeadlessShellPath as resolveHeadlessShellPath2,
96
+ resolveHeadlessShellPath,
97
97
  compositionRequiresWebGpu as compositionRequiresWebGpu2,
98
98
  applyConcreteGpuScreenshotClamp,
99
99
  explainDrawElementDisabled,
@@ -1200,7 +1200,6 @@ import {
1200
1200
  getCapturePerfSummary as getCapturePerfSummary2,
1201
1201
  initializeSession as initializeSession2,
1202
1202
  prepareCaptureSessionForReuse as prepareCaptureSessionForReuse2,
1203
- resolveHeadlessShellPath,
1204
1203
  shouldDisableBrowserPoolForParallelWorker,
1205
1204
  spawnStreamingEncoder as spawnStreamingEncoder2
1206
1205
  } from "@hyperframes/engine";
@@ -8517,12 +8516,20 @@ import {
8517
8516
  appendRenderProvenanceArgs,
8518
8517
  applyFaststart as applyFaststart2,
8519
8518
  describeFfmpegFailure as describeFfmpegFailure2,
8519
+ getEncoderPreset as getEncoderPreset5,
8520
8520
  MIXED_AUDIO_FILENAME as MIXED_AUDIO_FILENAME4,
8521
8521
  muxVideoWithAudio as muxVideoWithAudio2,
8522
8522
  resolveConfig as resolveConfig4,
8523
8523
  runFfmpeg as runFfmpeg5
8524
8524
  } from "@hyperframes/engine";
8525
8525
  import { fpsToFfmpegArg as fpsToFfmpegArg3 } from "@hyperframes/core";
8526
+ function cfrRateControlArgs(locked) {
8527
+ const preset = getEncoderPreset5(locked.quality ?? "standard", "mp4");
8528
+ if (locked.crf == null && locked.bitrate) {
8529
+ return ["-preset", preset.preset, "-b:v", locked.bitrate];
8530
+ }
8531
+ return ["-preset", preset.preset, "-crf", String(locked.crf ?? preset.quality)];
8532
+ }
8526
8533
  async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
8527
8534
  const start = Date.now();
8528
8535
  const log = options?.logger ?? defaultLogger;
@@ -8619,7 +8626,9 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
8619
8626
  if (!existsSync16(encoderJsonPath)) {
8620
8627
  throw new Error(`[assemble] planDir missing meta/encoder.json: ${encoderJsonPath}`);
8621
8628
  }
8622
- const encoderJson = JSON.parse(readFileSync10(encoderJsonPath, "utf-8"));
8629
+ const encoderJson = JSON.parse(
8630
+ readFileSync10(encoderJsonPath, "utf-8")
8631
+ );
8623
8632
  if (encoderJson.encoder === "libx265-software") {
8624
8633
  throw new Error(
8625
8634
  `[assemble] cfr=true is not yet supported with codec: "h265". The cfr re-encode pass uses libx264 and would silently transcode the h265 chunks. Either disable cfr or render with codec: "h264".`
@@ -8631,10 +8640,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
8631
8640
  concatOutputPath,
8632
8641
  "-c:v",
8633
8642
  "libx264",
8634
- "-preset",
8635
- "medium",
8636
- "-crf",
8637
- "18",
8643
+ ...cfrRateControlArgs(encoderJson),
8638
8644
  "-pix_fmt",
8639
8645
  "yuv420p",
8640
8646
  "-fps_mode",
@@ -8786,7 +8792,7 @@ import {
8786
8792
  createVideoFrameInjector as createVideoFrameInjector2,
8787
8793
  deriveBeginFrameProbeTimeTicks as deriveBeginFrameProbeTimeTicks2,
8788
8794
  extractVideoFramesRange,
8789
- getEncoderPreset as getEncoderPreset5,
8795
+ getEncoderPreset as getEncoderPreset6,
8790
8796
  initializeSession as initializeSession8,
8791
8797
  probeBeginFrameLiveness as probeBeginFrameLiveness2,
8792
8798
  readWebGlVendorInfoFromCanvas,
@@ -9337,7 +9343,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
9337
9343
  const isPngSequence = plan2.dimensions.format === "png-sequence";
9338
9344
  outputKind = isPngSequence ? "frame-dir" : "file";
9339
9345
  const presetFormat = isPngSequence ? "mp4" : plan2.dimensions.format;
9340
- const basePreset = getEncoderPreset5(job.config.quality, presetFormat, void 0);
9346
+ const basePreset = getEncoderPreset6(job.config.quality, presetFormat, void 0);
9341
9347
  const preset = resolvePresetForLockedEncoder(basePreset, encoder.encoder);
9342
9348
  const effectiveQuality = encoder.crf ?? preset.quality;
9343
9349
  const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "4042fe30acc3f58fb1b80dc0a7681ae6d101993d01e43d47f4a933b19dcb49e7",
4
+ "sha256": "f2d0658edf33bffe2f15e0cc94af6e2b13e1465cd235cf0734a4e7accd36f41c",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"