mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
* fix(producer): auto renders with color-graded media stay SDR instead of promoting to HDR * fix(producer): keep auto renders SDR when a graded canvas is present
34 lines
989 B
TypeScript
34 lines
989 B
TypeScript
import {
|
|
extractMediaMetadata,
|
|
findHdrAutoPromotion,
|
|
gradingKeepsSdr,
|
|
type HdrAutoPromotion,
|
|
} from "@hyperframes/engine";
|
|
import type { ProjectDir } from "./project.js";
|
|
import { mediaPath, type ProjectMedia } from "./projectMedia.js";
|
|
|
|
type ExtractMetadata = typeof extractMediaMetadata;
|
|
|
|
export async function inspectHdrAutoPromotion(
|
|
project: ProjectDir,
|
|
media: Pick<ProjectMedia, "videos" | "images">,
|
|
extractMetadata: ExtractMetadata = extractMediaMetadata,
|
|
): Promise<HdrAutoPromotion | null> {
|
|
if (gradingKeepsSdr("auto", media)) return null;
|
|
const assets: Array<{
|
|
asset: string;
|
|
colorSpace: Awaited<ReturnType<typeof extractMediaMetadata>>["colorSpace"];
|
|
}> = [];
|
|
for (const { src } of [...media.videos, ...media.images]) {
|
|
try {
|
|
assets.push({
|
|
asset: src,
|
|
colorSpace: (await extractMetadata(mediaPath(src, project.dir))).colorSpace,
|
|
});
|
|
} catch {
|
|
continue;
|
|
}
|
|
}
|
|
return findHdrAutoPromotion(assets);
|
|
}
|