feat: 新增导出设置、过渡与缓动及重做支持

This commit is contained in:
2026-09-19 04:41:48 +08:00
parent 482d649f84
commit 2c59709f6b
18 changed files with 1174 additions and 351 deletions

View File

@@ -322,6 +322,63 @@ export interface DirectorCameraShot {
captures?: DirectorCameraCapture[];
}
// ===== 视频导出设置 =====
/** 编码档位偏好:统一走 H.264(MP4),这里只决定 profile(清晰度 / 兼容性权衡) */
export type ExportCodecPreference = "auto" | "avc-high" | "avc-main" | "avc-baseline";
/** 画质档位:决定目标码率;custom 时改用手填的 customBitrate */
export type ExportQuality = "low" | "medium" | "high" | "custom";
export interface ExportSettings {
/** 导出视频短边分辨率(像素):长边按画面比例自动计算 */
resolutionShortEdge: number;
/** 画质档位:决定码率(custom 时用手填的 customBitrate) */
quality: ExportQuality;
/** 自定义码率(bps),仅 quality === "custom" 时生效 */
customBitrate: number;
/** 编码档位偏好(H.264 profile 选择) */
codec: ExportCodecPreference;
}
/** 短边分辨率档位(像素) */
export const EXPORT_RESOLUTION_OPTIONS: { value: number; label: string }[] = [
{ value: 480, label: "480p(短边 480)" },
{ value: 720, label: "720p(短边 720)" },
{ value: 1080, label: "1080p(短边 1080)" },
{ value: 1440, label: "2K(短边 1440)" },
{ value: 2160, label: "4K(短边 2160)" },
];
/** 画质 → 码率系数(相对 宽×高×帧率)。统一 H.264 编码,这里只影响目标码率。 */
export const EXPORT_QUALITY_OPTIONS: {
value: ExportQuality;
label: string;
bitrateMultiplier: number;
}[] = [
{ value: "low", label: "低(省空间)", bitrateMultiplier: 0.08 },
{ value: "medium", label: "中(推荐)", bitrateMultiplier: 0.15 },
{ value: "high", label: "高(清晰)", bitrateMultiplier: 0.3 },
{ value: "custom", label: "自定义(手动填码率)", bitrateMultiplier: 0 },
];
/** 编码档位 → H.264 codec 串(auto 时由浏览器挑支持的最高规格) */
export const EXPORT_CODEC_OPTIONS: {
value: ExportCodecPreference;
label: string;
codec: string | null;
}[] = [
{ value: "auto", label: "自动(挑浏览器支持的最高规格)", codec: null },
{ value: "avc-high", label: "H.264 High(高质量)", codec: "avc1.640028" },
{ value: "avc-main", label: "H.264 Main(兼容性)", codec: "avc1.4d0028" },
{ value: "avc-baseline", label: "H.264 Baseline(最兼容)", codec: "avc1.42001f" },
];
export const DEFAULT_EXPORT_SETTINGS: ExportSettings = {
resolutionShortEdge: 720,
quality: "medium",
customBitrate: 8_000_000,
codec: "auto",
};
export interface DirectorProject {
version: 2;
scene: SceneSettings;
@@ -331,4 +388,6 @@ export interface DirectorProject {
activeCameraId: string | null;
panoramaAssetId: string | null;
timeline: Timeline;
/** 视频导出设置:分辨率 / 码率 / 编码档位,存进工程随工程一起保存 */
exportSettings: ExportSettings;
}