]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
add support for 1440p (Quad HD/QHD/WQHD) videos
authorRigel Kent <sendmemail@rigelk.eu>
Thu, 24 Dec 2020 17:02:04 +0000 (18:02 +0100)
committerChocobozzz <chocobozzz@cpy.re>
Wed, 13 Jan 2021 08:14:09 +0000 (09:14 +0100)
23 files changed:
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
config/default.yaml
config/production.yaml.example
config/test.yaml
server/controllers/api/config.ts
server/helpers/ffprobe-utils.ts
server/initializers/checker-before-init.ts
server/initializers/config.ts
server/middlewares/validators/config.ts
server/tests/api/check-params/config.ts
server/tests/api/live/live-constraints.ts
server/tests/api/live/live-permanent.ts
server/tests/api/live/live-save-replay.ts
server/tests/api/server/config.ts
server/tests/api/server/stats.ts
server/tests/api/videos/audio-only.ts
server/tests/api/videos/video-hls.ts
server/tests/cli/create-transcoding-job.ts
shared/extra-utils/server/config.ts
shared/models/server/custom-config.model.ts
shared/models/videos/video-resolution.enum.ts
support/doc/api/openapi.yaml
support/docker/production/config/custom-environment-variables.yaml

index f74229af016f7a4d676ad53dda525bc3f0dc58a2..330ab075a91bc1c59d35de5e339f0687e7a02ab9 100644 (file)
@@ -81,6 +81,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
         id: '1080p',
         label: $localize`1080p`
       },
+      {
+        id: '1440p',
+        label: $localize`1440p`
+      },
       {
         id: '2160p',
         label: $localize`2160p`
index b68a96f5103b21e093b1f386deb236d84199965b..d2c713b526518a547a5d43d971b99f40e9a3efee 100644 (file)
@@ -227,6 +227,7 @@ transcoding:
     480p: false
     720p: false
     1080p: false
+    1440p: false
     2160p: false
 
   # Generate videos in a WebTorrent format (what we do since the first PeerTube release)
@@ -280,6 +281,7 @@ live:
       480p: false
       720p: false
       1080p: false
+      1440p: false
       2160p: false
 
 import:
index 91eecbd67b51f90cbb9275553eff7a8472e68525..4506ce2596bb3a5ef447d9ef93824c2bf3f47f04 100644 (file)
@@ -240,6 +240,7 @@ transcoding:
     480p: false
     720p: false
     1080p: false
+    1440p: false
     2160p: false
 
   # Generate videos in a WebTorrent format (what we do since the first PeerTube release)
@@ -293,6 +294,7 @@ live:
       480p: false
       720p: false
       1080p: false
+      1440p: false
       2160p: false
 
 import:
index a8a7242552342037a1f682edd2472b7ba03b2104..3e0346d64d53ce57b8f46bde02518285abebf6ae 100644 (file)
@@ -78,6 +78,7 @@ transcoding:
     480p: true
     720p: true
     1080p: true
+    1440p: true
     2160p: true
   hls:
     enabled: true
@@ -98,6 +99,7 @@ live:
       480p: false
       720p: false
       1080p: false
+      1440p: false
       2160p: false
 
 import:
index 2401e2ff428a4b64b7c54e554718596d27b8f988..8bc3123bf72eee17a1a2da5cba0d4dc507fed53c 100644 (file)
@@ -423,6 +423,7 @@ function customConfig (): CustomConfig {
         '480p': CONFIG.TRANSCODING.RESOLUTIONS['480p'],
         '720p': CONFIG.TRANSCODING.RESOLUTIONS['720p'],
         '1080p': CONFIG.TRANSCODING.RESOLUTIONS['1080p'],
+        '1440p': CONFIG.TRANSCODING.RESOLUTIONS['1440p'],
         '2160p': CONFIG.TRANSCODING.RESOLUTIONS['2160p']
       },
       webtorrent: {
@@ -447,6 +448,7 @@ function customConfig (): CustomConfig {
           '480p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['480p'],
           '720p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['720p'],
           '1080p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['1080p'],
+          '1440p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['1440p'],
           '2160p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['2160p']
         }
       }
index 4dea6283cc060725f53e0b1a09966277e6e760d1..adb459ed39042b67e13c0f8b8af8a0e9fb6b1bd4 100644 (file)
@@ -188,6 +188,7 @@ function computeResolutionsToTranscode (videoFileResolution: number, type: 'vod'
     VideoResolution.H_720P,
     VideoResolution.H_240P,
     VideoResolution.H_1080P,
+    VideoResolution.H_1440P,
     VideoResolution.H_4K
   ]
 
index 765ef157ec8cd1a74e3d29ec031db56084a1d604..7945e85863fec6230da58ce09d03235dc96d33f3 100644 (file)
@@ -23,7 +23,7 @@ function checkMissedConfig () {
     'redundancy.videos.strategies', 'redundancy.videos.check_interval',
     'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions', 'transcoding.hls.enabled',
     'transcoding.resolutions.0p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p', 'transcoding.resolutions.480p',
-    'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.2160p',
+    'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', 'transcoding.resolutions.2160p',
     'import.videos.http.enabled', 'import.videos.torrent.enabled', 'auto_blacklist.videos.of_users.enabled',
     'trending.videos.interval_days',
     'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route',
@@ -41,7 +41,8 @@ function checkMissedConfig () {
     'live.enabled', 'live.allow_replay', 'live.max_duration', 'live.max_user_lives', 'live.max_instance_lives',
     'live.transcoding.enabled', 'live.transcoding.threads',
     'live.transcoding.resolutions.240p', 'live.transcoding.resolutions.360p', 'live.transcoding.resolutions.480p',
-    'live.transcoding.resolutions.720p', 'live.transcoding.resolutions.1080p', 'live.transcoding.resolutions.2160p'
+    'live.transcoding.resolutions.720p', 'live.transcoding.resolutions.1080p', 'live.transcoding.resolutions.1440p',
+    'live.transcoding.resolutions.2160p'
   ]
 
   const requiredAlternatives = [
index 705223b0adcf329efdae6862ecd8efc1ab98a715..0f58dc1d4c11ced86be9159545ce221872ade0f7 100644 (file)
@@ -189,6 +189,7 @@ const CONFIG = {
       get '480p' () { return config.get<boolean>('transcoding.resolutions.480p') },
       get '720p' () { return config.get<boolean>('transcoding.resolutions.720p') },
       get '1080p' () { return config.get<boolean>('transcoding.resolutions.1080p') },
+      get '1440p' () { return config.get<boolean>('transcoding.resolutions.1440p') },
       get '2160p' () { return config.get<boolean>('transcoding.resolutions.2160p') }
     },
     HLS: {
@@ -221,6 +222,7 @@ const CONFIG = {
         get '480p' () { return config.get<boolean>('live.transcoding.resolutions.480p') },
         get '720p' () { return config.get<boolean>('live.transcoding.resolutions.720p') },
         get '1080p' () { return config.get<boolean>('live.transcoding.resolutions.1080p') },
+        get '1440p' () { return config.get<boolean>('live.transcoding.resolutions.1440p') },
         get '2160p' () { return config.get<boolean>('live.transcoding.resolutions.2160p') }
       }
     }
index 9c1cfa7e733288faaa925c00b4a2fd5a2d22e110..faabf17d7156c8684f9b895cc65b3fea578a688b 100644 (file)
@@ -45,6 +45,7 @@ const customConfigUpdateValidator = [
   body('transcoding.resolutions.480p').isBoolean().withMessage('Should have a valid transcoding 480p resolution enabled boolean'),
   body('transcoding.resolutions.720p').isBoolean().withMessage('Should have a valid transcoding 720p resolution enabled boolean'),
   body('transcoding.resolutions.1080p').isBoolean().withMessage('Should have a valid transcoding 1080p resolution enabled boolean'),
+  body('transcoding.resolutions.1440p').isBoolean().withMessage('Should have a valid transcoding 1440p resolution enabled boolean'),
   body('transcoding.resolutions.2160p').isBoolean().withMessage('Should have a valid transcoding 2160p resolution enabled boolean'),
 
   body('transcoding.webtorrent.enabled').isBoolean().withMessage('Should have a valid webtorrent transcoding enabled boolean'),
@@ -75,6 +76,7 @@ const customConfigUpdateValidator = [
   body('live.transcoding.resolutions.480p').isBoolean().withMessage('Should have a valid transcoding 480p resolution enabled boolean'),
   body('live.transcoding.resolutions.720p').isBoolean().withMessage('Should have a valid transcoding 720p resolution enabled boolean'),
   body('live.transcoding.resolutions.1080p').isBoolean().withMessage('Should have a valid transcoding 1080p resolution enabled boolean'),
+  body('live.transcoding.resolutions.1440p').isBoolean().withMessage('Should have a valid transcoding 1440p resolution enabled boolean'),
   body('live.transcoding.resolutions.2160p').isBoolean().withMessage('Should have a valid transcoding 2160p resolution enabled boolean'),
 
   body('search.remoteUri.users').isBoolean().withMessage('Should have a remote URI search for users boolean'),
index fab440fc529e28c2238f62700628f69ceb32adf5..e36cdeab2cefd661418e4707a4ea9a18c76a62f9 100644 (file)
@@ -92,6 +92,7 @@ describe('Test config API validators', function () {
         '480p': true,
         '720p': false,
         '1080p': false,
+        '1440p': false,
         '2160p': false
       },
       webtorrent: {
@@ -118,6 +119,7 @@ describe('Test config API validators', function () {
           '480p': true,
           '720p': true,
           '1080p': true,
+          '1440p': true,
           '2160p': true
         }
       }
index 257673b66b6a9d027e946c24893cbd485ab83778..1c60a7c76a641e66641a2e7cc012329d4cc70c49 100644 (file)
@@ -179,6 +179,7 @@ describe('Test live constraints', function () {
             '480p': true,
             '720p': true,
             '1080p': true,
+            '1440p': true,
             '2160p': true
           }
         }
index 1128e993cae2f1574e271a39873b77c09b0e0e74..a5bda009fccb0ef8cd44374716503b5c892e9723 100644 (file)
@@ -75,6 +75,7 @@ describe('Permenant live', function () {
             '480p': true,
             '720p': true,
             '1080p': true,
+            '1440p': true,
             '2160p': true
           }
         }
@@ -164,6 +165,7 @@ describe('Permenant live', function () {
             '480p': false,
             '720p': false,
             '1080p': false,
+            '1440p': false,
             '2160p': false
           }
         }
index 35fe4e7bdf51b54c804e611dbda1a1afb9f4df5d..757e1184527dfd7a72370afb4da6c45d3ac51f09 100644 (file)
@@ -99,6 +99,7 @@ describe('Save replay setting', function () {
             '480p': true,
             '720p': true,
             '1080p': true,
+            '1440p': true,
             '2160p': true
           }
         }
index bfaad36884a537155590409bbdd7a29333a990f2..af25f4800276106e763a7a4a0827619e5145eb50 100644 (file)
@@ -75,6 +75,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
   expect(data.transcoding.resolutions['480p']).to.be.true
   expect(data.transcoding.resolutions['720p']).to.be.true
   expect(data.transcoding.resolutions['1080p']).to.be.true
+  expect(data.transcoding.resolutions['1440p']).to.be.true
   expect(data.transcoding.resolutions['2160p']).to.be.true
   expect(data.transcoding.webtorrent.enabled).to.be.true
   expect(data.transcoding.hls.enabled).to.be.true
@@ -91,6 +92,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
   expect(data.live.transcoding.resolutions['480p']).to.be.false
   expect(data.live.transcoding.resolutions['720p']).to.be.false
   expect(data.live.transcoding.resolutions['1080p']).to.be.false
+  expect(data.live.transcoding.resolutions['1440p']).to.be.false
   expect(data.live.transcoding.resolutions['2160p']).to.be.false
 
   expect(data.import.videos.http.enabled).to.be.true
@@ -322,6 +324,7 @@ describe('Test config', function () {
           '480p': true,
           '720p': false,
           '1080p': false,
+          '1440p': false,
           '2160p': false
         },
         webtorrent: {
@@ -346,6 +349,7 @@ describe('Test config', function () {
             '480p': true,
             '720p': true,
             '1080p': true,
+            '1440p': true,
             '2160p': true
           }
         }
index 6fbf3218631d935eb05b54721e57b25e19a0ee91..82065e77022a2d6836c3f3cf9736dbf6ce8cd3c3 100644 (file)
@@ -153,6 +153,7 @@ describe('Test stats (excluding redundancy)', function () {
           '480p': false,
           '720p': false,
           '1080p': false,
+          '1440p': false,
           '2160p': false
         }
       }
index 294a001121a40409e28b20b3fb062497473ac8db..7ddbd5cd9c701736e04e6ed1c976711e30cbe73f 100644 (file)
@@ -36,6 +36,7 @@ describe('Test audio only video transcoding', function () {
           '480p': false,
           '720p': false,
           '1080p': false,
+          '1440p': false,
           '2160p': false
         },
         hls: {
index f3dbbb1143daa871c33a638a9d31ff3c91ce39a6..d1720d0d9781af55af1aa023704c1011bcb98421 100644 (file)
@@ -202,6 +202,7 @@ describe('Test HLS videos', function () {
             '480p': true,
             '720p': true,
             '1080p': true,
+            '1440p': true,
             '2160p': true
           },
           hls: {
index 997a9a1fda5c7d74ee91f1cacc4e6f8f3178a60e..5bc1687cd5621503a9aaae0b5317bb9b8f21c8b1 100644 (file)
@@ -33,6 +33,7 @@ describe('Test create transcoding jobs', function () {
         '480p': true,
         '720p': true,
         '1080p': true,
+        '1440p': true,
         '2160p': true
       },
       hls: {
index 8702659c493d195b61109683e223dfeddf4e1162..f7c488c0bbea34a49824391aa36e7fd847ff608c 100644 (file)
@@ -117,6 +117,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
         '480p': true,
         '720p': false,
         '1080p': false,
+        '1440p': false,
         '2160p': false
       },
       webtorrent: {
@@ -141,6 +142,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
           '480p': true,
           '720p': true,
           '1080p': true,
+          '1440p': true,
           '2160p': true
         }
       }
index 67e05e23fe712539645c096f0cd169357e59919a..9a6a249231e6c5fcd76cb29cb582a64f715abbff 100644 (file)
@@ -7,6 +7,7 @@ export type ConfigResolutions = {
   '480p': boolean
   '720p': boolean
   '1080p': boolean
+  '1440p': boolean
   '2160p': boolean
 }
 
index dcd55dad8b10b39668475c5f10c7d8ddeac3f993..a5d2ac7fae3d56e02a31b8815b8197e95f8294b6 100644 (file)
@@ -7,6 +7,7 @@ export const enum VideoResolution {
   H_480P = 480,
   H_720P = 720,
   H_1080P = 1080,
+  H_1440P = 1440,
   H_4K = 2160
 }
 
@@ -53,9 +54,15 @@ function getBaseBitrate (resolution: number) {
     return 5200 * 1000
   }
 
+  if (resolution <= VideoResolution.H_1440P) {
+    // quality according to Google Live Encoder: 6000 - 13000 Kbps
+    // Quality according to YouTube Video Info: 8600 (av01) - 17000 (vp9.2) Kbps
+    return 10_000 * 1000
+  }
+
   // 4K
   // quality according to Google Live Encoder: 13000 - 34000 Kbps
-  return 22000 * 1000
+  return 22_000 * 1000
 }
 
 /**
index 74b2dee281e42a003bbc8b218521b6b62b3080ea..fe4552ff77a777a6882521437dc2de3e8ec24907 100644 (file)
@@ -3941,7 +3941,7 @@ components:
       properties:
         id:
           type: integer
-          description: 'Video resolution (240, 360, 720 ...)'
+          description: 'Video resolution (240, 360, 720, 1080, 1440 or 2160)'
           example: 240
         label:
           type: string
@@ -4829,6 +4829,8 @@ components:
                   type: boolean
                 1080p:
                   type: boolean
+                1440p:
+                  type: boolean
                 2160p:
                   type: boolean
             hls:
index c4c62755171362e18f193ee597cfdfe13efe54e7..954c3714b6dc9dd0e2be15d406e9a4d90d990b76 100644 (file)
@@ -106,6 +106,9 @@ transcoding:
     1080p:
       __name: "PEERTUBE_TRANSCODING_1080P"
       __format: "json"
+    1440p:
+      __name: "PEERTUBE_TRANSCODING_1440P"
+      __format: "json"
     2160p:
       __name: "PEERTUBE_TRANSCODING_2160P"
       __format: "json"