MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / shouldCopyAacSidecar

Function shouldCopyAacSidecar

packages/engine/src/services/chunkEncoder.ts:75–92  ·  view source on GitHub ↗
(
  audioPath: string,
  options: MuxVideoWithAudioOptions | undefined,
)

Source from the content-addressed store, hash-verified

73}
74
75async function shouldCopyAacSidecar(
76 audioPath: string,
77 options: MuxVideoWithAudioOptions | undefined,
78) {
79 if (options?.audioCodec === "aac" || isAacSidecar(audioPath)) return true;
80
81 const audioExtension = extname(audioPath).toLowerCase();
82 if (KNOWN_NON_AAC_AUDIO_EXTENSIONS.has(audioExtension)) return false;
83
84 try {
85 const metadata = await extractAudioMetadata(audioPath);
86 return metadata.audioCodec === "aac";
87 } catch {
88 // Preserve the pre-existing fallback for invalid or unprobeable sidecars:
89 // let the final ffmpeg transcode path surface the actionable mux error.
90 return false;
91 }
92}
93
94/**
95 * Get encoder preset for a given quality and output format.

Callers 1

muxVideoWithAudioFunction · 0.85

Calls 2

isAacSidecarFunction · 0.85
extractAudioMetadataFunction · 0.85

Tested by

no test coverage detected