summaryrefslogtreecommitdiff
path: root/apps/web/src/services/renderer/export-encoding.ts
blob: cc333ea4240b70d2ab69da30ff1e19e06e841b95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import type { ExportQuality } from "@/export";

const videoBitsPerPixelFrame: Record<ExportQuality, number> = {
	low: 0.05,
	medium: 0.1,
	high: 0.2,
	very_high: 0.4,
};

export function computeVideoBitrate({
	width,
	height,
	fps,
	quality,
}: {
	width: number;
	height: number;
	fps: number;
	quality: ExportQuality;
}): number {
	return Math.round(width * height * fps * videoBitsPerPixelFrame[quality]);
}