aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/helpers/ffprobe-utils.ts34
1 files changed, 27 insertions, 7 deletions
diff --git a/server/helpers/ffprobe-utils.ts b/server/helpers/ffprobe-utils.ts
index 5b1ad9066..fefed25ae 100644
--- a/server/helpers/ffprobe-utils.ts
+++ b/server/helpers/ffprobe-utils.ts
@@ -91,18 +91,35 @@ async function getVideoStreamCodec (path: string) {
91 91
92 const videoCodec = videoStream.codec_tag_string 92 const videoCodec = videoStream.codec_tag_string
93 93
94 if (videoCodec === 'vp09') return 'vp09.00.50.08'
95
94 const baseProfileMatrix = { 96 const baseProfileMatrix = {
95 High: '6400', 97 avc1: {
96 Main: '4D40', 98 High: '6400',
97 Baseline: '42E0' 99 Main: '4D40',
100 Baseline: '42E0'
101 },
102 av01: {
103 High: '1',
104 Main: '0',
105 Professional: '2'
106 }
98 } 107 }
99 108
100 let baseProfile = baseProfileMatrix[videoStream.profile] 109 let baseProfile = baseProfileMatrix[videoCodec][videoStream.profile]
101 if (!baseProfile) { 110 if (!baseProfile) {
102 logger.warn('Cannot get video profile codec of %s.', path, { videoStream }) 111 logger.warn('Cannot get video profile codec of %s.', path, { videoStream })
103 baseProfile = baseProfileMatrix['High'] // Fallback 112 baseProfile = baseProfileMatrix[videoCodec]['High'] // Fallback
113 }
114
115 if (videoCodec === 'av01') {
116 const level = videoStream.level
117
118 // Guess the tier indicator and bit depth
119 return `${videoCodec}.${baseProfile}.${level}M.08`
104 } 120 }
105 121
122 // Default, h264 codec
106 let level = videoStream.level.toString(16) 123 let level = videoStream.level.toString(16)
107 if (level.length === 1) level = `0${level}` 124 if (level.length === 1) level = `0${level}`
108 125
@@ -114,8 +131,11 @@ async function getAudioStreamCodec (path: string, existingProbe?: ffmpeg.Ffprobe
114 131
115 if (!audioStream) return '' 132 if (!audioStream) return ''
116 133
117 const audioCodec = audioStream.codec_name 134 const audioCodecName = audioStream.codec_name
118 if (audioCodec === 'aac') return 'mp4a.40.2' 135
136 if (audioCodecName === 'opus') return 'opus'
137 if (audioCodecName === 'vorbis') return 'vorbis'
138 if (audioCodecName === 'aac') return 'mp4a.40.2'
119 139
120 logger.warn('Cannot get audio codec of %s.', path, { audioStream }) 140 logger.warn('Cannot get audio codec of %s.', path, { audioStream })
121 141