( audioPath: string, options: MuxVideoWithAudioOptions | undefined, )
| 73 | } |
| 74 | |
| 75 | async 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. |
no test coverage detected