diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-01-15 15:56:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-15 15:56:56 +0100 |
commit | 454c20fa7cdb05eba7f1be3c83389b54807af0b3 (patch) | |
tree | e9b364da69eaf88f0470414c506c3b5631984c60 /server/lib | |
parent | d43c6b1ffc5e6c895f9e9f9de6625f17a9755c20 (diff) | |
download | PeerTube-454c20fa7cdb05eba7f1be3c83389b54807af0b3.tar.gz PeerTube-454c20fa7cdb05eba7f1be3c83389b54807af0b3.tar.zst PeerTube-454c20fa7cdb05eba7f1be3c83389b54807af0b3.zip |
stricter youtubedl format selectors (#3516)
* stricter youtubedl format selectors
make sure selectors avoid av1, and otherwise match as closely to the
maximum resolution enabled for transcoding
* add support for merge formats in youtubedl
* avoid vp9.2 in youtubedl to avoid any HDR
* move getEnabledResolutions, safer replace of imported extension
* add test for youtube-dl selectors
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 6 | ||||
-rw-r--r-- | server/lib/video-transcoding.ts | 13 |
2 files changed, 17 insertions, 2 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index 5a82a8d2b..db3112418 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -79,7 +79,11 @@ async function processYoutubeDLImport (job: Bull.Job, payload: VideoImportYoutub | |||
79 | generatePreview: payload.generatePreview | 79 | generatePreview: payload.generatePreview |
80 | } | 80 | } |
81 | 81 | ||
82 | return processFile(() => downloadYoutubeDLVideo(videoImport.targetUrl, payload.fileExt, VIDEO_IMPORT_TIMEOUT), videoImport, options) | 82 | return processFile( |
83 | () => downloadYoutubeDLVideo(videoImport.targetUrl, payload.fileExt, VIDEO_IMPORT_TIMEOUT, payload.mergeExt), | ||
84 | videoImport, | ||
85 | options | ||
86 | ) | ||
83 | } | 87 | } |
84 | 88 | ||
85 | async function getVideoImportOrDie (videoImportId: number) { | 89 | async function getVideoImportOrDie (videoImportId: number) { |
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index 078e85acf..a6b79eaea 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts | |||
@@ -201,6 +201,16 @@ function generateHlsPlaylist (options: { | |||
201 | }) | 201 | }) |
202 | } | 202 | } |
203 | 203 | ||
204 | function getEnabledResolutions (type: 'vod' | 'live') { | ||
205 | const transcoding = type === 'vod' | ||
206 | ? CONFIG.TRANSCODING | ||
207 | : CONFIG.LIVE.TRANSCODING | ||
208 | |||
209 | return Object.keys(transcoding.RESOLUTIONS) | ||
210 | .filter(key => transcoding.ENABLED && transcoding.RESOLUTIONS[key] === true) | ||
211 | .map(r => parseInt(r, 10)) | ||
212 | } | ||
213 | |||
204 | // --------------------------------------------------------------------------- | 214 | // --------------------------------------------------------------------------- |
205 | 215 | ||
206 | export { | 216 | export { |
@@ -208,7 +218,8 @@ export { | |||
208 | generateHlsPlaylistFromTS, | 218 | generateHlsPlaylistFromTS, |
209 | optimizeOriginalVideofile, | 219 | optimizeOriginalVideofile, |
210 | transcodeNewResolution, | 220 | transcodeNewResolution, |
211 | mergeAudioVideofile | 221 | mergeAudioVideofile, |
222 | getEnabledResolutions | ||
212 | } | 223 | } |
213 | 224 | ||
214 | // --------------------------------------------------------------------------- | 225 | // --------------------------------------------------------------------------- |