+
+ let baseProfile = baseProfileMatrix[videoStream.profile]
+ if (!baseProfile) {
+ logger.warn('Cannot get video profile codec of %s.', path, { videoStream })
+ baseProfile = baseProfileMatrix['High'] // Fallback
+ }
+
+ const level = videoStream.level.toString(16)
+
+ return `${videoCodec}.${baseProfile}${level}`
+}
+
+async function getAudioStreamCodec (path: string) {
+ const { audioStream } = await audio.get(path)
+
+ if (!audioStream) return ''
+
+ const audioCodec = audioStream.codec_name
+ if (audioCodec === 'aac') return 'mp4a.40.2'
+
+ logger.warn('Cannot get audio codec of %s.', path, { audioStream })
+
+ return 'mp4a.40.2' // Fallback