refactor(studio-server): read the piece check's frame rate outside the copy setup

This commit is contained in:
Miguel Angel Simon Sierra
2026-11-19 23:28:35 -05:00
parent 30acf95e81
commit 56cf7c74bf
@@ -15,7 +15,7 @@ import {
import { alphaDecoderFor } from "@hyperframes/parsers/media-alpha"; import { alphaDecoderFor } from "@hyperframes/parsers/media-alpha";
import { ffmpegHasHdrFilters } from "./hdrFilters.js"; import { ffmpegHasHdrFilters } from "./hdrFilters.js";
import { mediaInputArgs, NOT_MEDIA } from "./mediaExtensions.js"; import { mediaInputArgs, NOT_MEDIA } from "./mediaExtensions.js";
import { probeFirstFrameColour, probeMediaMetadata } from "./mediaMetadata.js"; import { type MediaMetadata, probeFirstFrameColour, probeMediaMetadata } from "./mediaMetadata.js";
import { cleanupProxyCache } from "./proxyCache.js"; import { cleanupProxyCache } from "./proxyCache.js";
import { import {
contentCopyKey, contentCopyKey,
@@ -884,7 +884,7 @@ async function runFfmpeg(
gate, gate,
chunks, chunks,
encode, encode,
frameRate: metadata.source?.frameRate, source: metadata.source,
onDone: (doneSeconds) => onProgress({ doneSeconds, totalSeconds }), onDone: (doneSeconds) => onProgress({ doneSeconds, totalSeconds }),
}); });
} catch (err) { } catch (err) {
@@ -907,7 +907,7 @@ type PieceCopy = {
gate: PieceGate; gate: PieceGate;
chunks: ChunkFiles; chunks: ChunkFiles;
encode: EncodeFn; encode: EncodeFn;
frameRate: number | undefined; source: MediaMetadata["source"];
onDone: (doneSeconds: number) => void; onDone: (doneSeconds: number) => void;
}; };
@@ -935,7 +935,7 @@ async function copyInPieces(ranges: ChunkRange[], outputPath: string, copy: Piec
}, },
copy.signal, copy.signal,
copy.gate, copy.gate,
(piece, range) => stillWhole(piece, range, copy.frameRate, copy.signal), (piece, range) => stillWhole(piece, range, copy.source?.frameRate, copy.signal),
copy.onDone, copy.onDone,
); );
if (withSound) await addSoundFromSource(copy, picturePath, outputPath); if (withSound) await addSoundFromSource(copy, picturePath, outputPath);