MCPcopy
hub / github.com/CapSoftware/Cap / needsVideoTranscode

Function needsVideoTranscode

apps/media-server/src/lib/media-video.ts:1079–1093  ·  view source on GitHub ↗
(
	metadata: VideoMetadata,
	options: VideoProcessingOptions,
	sourceH264Level: number | null,
)

Source from the content-addressed store, hash-verified

1077}
1078
1079function needsVideoTranscode(
1080 metadata: VideoMetadata,
1081 options: VideoProcessingOptions,
1082 sourceH264Level: number | null,
1083): boolean {
1084 const maxWidth = options.maxWidth ?? DEFAULT_OPTIONS.maxWidth;
1085 const maxHeight = options.maxHeight ?? DEFAULT_OPTIONS.maxHeight;
1086 return (
1087 metadata.width > maxWidth ||
1088 metadata.height > maxHeight ||
1089 metadata.videoCodec !== "h264" ||
1090 (sourceH264Level !== null &&
1091 sourceH264Level > pickMobileSafeH264Level(metadata, options).value)
1092 );
1093}
1094
1095function needsAudioTranscode(metadata: VideoMetadata): boolean {
1096 return Boolean(metadata.audioCodec && metadata.audioCodec !== "aac");

Callers 1

processVideoFunction · 0.85

Calls 1

pickMobileSafeH264LevelFunction · 0.85

Tested by

no test coverage detected