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 /shared | |
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 'shared')
-rw-r--r-- | shared/core-utils/miscs/http-error-codes.ts | 8 | ||||
-rw-r--r-- | shared/extra-utils/videos/video-imports.ts | 24 | ||||
-rw-r--r-- | shared/models/server/job.model.ts | 1 |
3 files changed, 32 insertions, 1 deletions
diff --git a/shared/core-utils/miscs/http-error-codes.ts b/shared/core-utils/miscs/http-error-codes.ts index 9ac8a6c83..b2fbdfc5a 100644 --- a/shared/core-utils/miscs/http-error-codes.ts +++ b/shared/core-utils/miscs/http-error-codes.ts | |||
@@ -196,6 +196,8 @@ export enum HttpStatusCode { | |||
196 | * | 196 | * |
197 | * Indicates that the request could not be processed because of conflict in the request, | 197 | * Indicates that the request could not be processed because of conflict in the request, |
198 | * such as an edit conflict between multiple simultaneous updates. | 198 | * such as an edit conflict between multiple simultaneous updates. |
199 | * | ||
200 | * @see HttpStatusCode.UNPROCESSABLE_ENTITY_422 to denote a disabled feature | ||
199 | */ | 201 | */ |
200 | CONFLICT_409 = 409, | 202 | CONFLICT_409 = 409, |
201 | 203 | ||
@@ -269,6 +271,12 @@ export enum HttpStatusCode { | |||
269 | * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3 | 271 | * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3 |
270 | * | 272 | * |
271 | * The request was well-formed but was unable to be followed due to semantic errors. | 273 | * The request was well-formed but was unable to be followed due to semantic errors. |
274 | * The server understands the content type of the request entity (hence a 415 (Unsupported Media Type) status code is inappropriate), | ||
275 | * and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process | ||
276 | * the contained instructions. For example, this error condition may occur if an JSON request body contains well-formed (i.e., | ||
277 | * syntactically correct), but semantically erroneous, JSON instructions. | ||
278 | * | ||
279 | * Can also be used to denote disabled features (akin to disabled syntax). | ||
272 | * | 280 | * |
273 | * @see HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415 if the `Content-Type` was not supported. | 281 | * @see HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415 if the `Content-Type` was not supported. |
274 | * @see HttpStatusCode.BAD_REQUEST_400 if the request was not parsable (broken JSON, XML) | 282 | * @see HttpStatusCode.BAD_REQUEST_400 if the request was not parsable (broken JSON, XML) |
diff --git a/shared/extra-utils/videos/video-imports.ts b/shared/extra-utils/videos/video-imports.ts index 52e0075fb..259b8a314 100644 --- a/shared/extra-utils/videos/video-imports.ts +++ b/shared/extra-utils/videos/video-imports.ts | |||
@@ -4,7 +4,28 @@ import { makeGetRequest, makeUploadRequest } from '../requests/requests' | |||
4 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | 4 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
5 | 5 | ||
6 | function getYoutubeVideoUrl () { | 6 | function getYoutubeVideoUrl () { |
7 | return 'http://www.youtube.com/watch?v=msX3jv1XdvM' | 7 | return 'https://www.youtube.com/watch?v=msX3jv1XdvM' |
8 | } | ||
9 | |||
10 | function getYoutubeHDRVideoUrl () { | ||
11 | /** | ||
12 | * The video is used to check format-selection correctness wrt. HDR, | ||
13 | * which brings its own set of oddities outside of a MediaSource. | ||
14 | * FIXME: refactor once HDR is supported at playback | ||
15 | * | ||
16 | * The video needs to have the following format_ids: | ||
17 | * (which you can check by using `youtube-dl <url> -F`): | ||
18 | * - 303 (1080p webm vp9) | ||
19 | * - 299 (1080p mp4 avc1) | ||
20 | * - 335 (1080p webm vp9.2 HDR) | ||
21 | * | ||
22 | * 15 jan. 2021: TEST VIDEO NOT CURRENTLY PROVIDING | ||
23 | * - 400 (1080p mp4 av01) | ||
24 | * - 315 (2160p webm vp9 HDR) | ||
25 | * - 337 (2160p webm vp9.2 HDR) | ||
26 | * - 401 (2160p mp4 av01 HDR) | ||
27 | */ | ||
28 | return 'https://www.youtube.com/watch?v=MSJ25EqI19c' | ||
8 | } | 29 | } |
9 | 30 | ||
10 | function getMagnetURI () { | 31 | function getMagnetURI () { |
@@ -61,6 +82,7 @@ function getMyVideoImports (url: string, token: string, sort?: string) { | |||
61 | export { | 82 | export { |
62 | getBadVideoUrl, | 83 | getBadVideoUrl, |
63 | getYoutubeVideoUrl, | 84 | getYoutubeVideoUrl, |
85 | getYoutubeHDRVideoUrl, | ||
64 | importVideo, | 86 | importVideo, |
65 | getMagnetURI, | 87 | getMagnetURI, |
66 | getMyVideoImports, | 88 | getMyVideoImports, |
diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts index b0ed860a7..2af2a25a6 100644 --- a/shared/models/server/job.model.ts +++ b/shared/models/server/job.model.ts | |||
@@ -82,6 +82,7 @@ export type VideoImportYoutubeDLPayload = { | |||
82 | generatePreview: boolean | 82 | generatePreview: boolean |
83 | 83 | ||
84 | fileExt?: string | 84 | fileExt?: string |
85 | mergeExt?: string | ||
85 | } | 86 | } |
86 | export type VideoImportTorrentPayload = { | 87 | export type VideoImportTorrentPayload = { |
87 | type: VideoImportTorrentPayloadType | 88 | type: VideoImportTorrentPayloadType |