aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/helpers/ffprobe-utils.ts34
-rw-r--r--shared/models/plugins/plugin-transcoding-manager.model.ts2
-rw-r--r--support/doc/plugins/guide.md2
3 files changed, 29 insertions, 9 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
diff --git a/shared/models/plugins/plugin-transcoding-manager.model.ts b/shared/models/plugins/plugin-transcoding-manager.model.ts
index 7dfb51ddf..8babccd4e 100644
--- a/shared/models/plugins/plugin-transcoding-manager.model.ts
+++ b/shared/models/plugins/plugin-transcoding-manager.model.ts
@@ -9,5 +9,5 @@ export interface PluginTranscodingManager {
9 9
10 addVODEncoderPriority (streamType: 'audio' | 'video', encoder: string, priority: number): void 10 addVODEncoderPriority (streamType: 'audio' | 'video', encoder: string, priority: number): void
11 11
12 removeAllProfilesAndEncoderPriorities() 12 removeAllProfilesAndEncoderPriorities(): void
13} 13}
diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md
index 9739d117a..a4a1a136d 100644
--- a/support/doc/plugins/guide.md
+++ b/support/doc/plugins/guide.md
@@ -516,7 +516,7 @@ async function register ({
516 } 516 }
517 } 517 }
518 518
519 // Support libopus and libvpx-vp9 encoders, just for the example (PeerTube player is only compatible with h264/aac) 519 // Support libopus and libvpx-vp9 encoders (these codecs could be incompatible with the player)
520 transcodingManager.addVODProfile('libopus', 'test-vod-profile', builder) 520 transcodingManager.addVODProfile('libopus', 'test-vod-profile', builder)
521 521
522 // Default priorities are ~100 522 // Default priorities are ~100