- return {
- width: videoStream.width,
- height: videoStream.height
+ return videoStream === null
+ ? { width: 0, height: 0 }
+ : { width: videoStream.width, height: videoStream.height }
+}
+
+async function getVideoStreamCodec (path: string) {
+ const videoStream = await getVideoStreamFromFile(path)
+
+ if (!videoStream) return ''
+
+ const videoCodec = videoStream.codec_tag_string
+
+ const baseProfileMatrix = {
+ 'High': '6400',
+ 'Main': '4D40',
+ 'Baseline': '42E0'
+ }
+
+ let baseProfile = baseProfileMatrix[videoStream.profile]
+ if (!baseProfile) {
+ logger.warn('Cannot get video profile codec of %s.', path, { videoStream })
+ baseProfile = baseProfileMatrix['High'] // Fallback