]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Added 144p encoding (#4492)
authorFlorian CUNY <poslovitch@bentobox.world>
Fri, 5 Nov 2021 09:23:02 +0000 (10:23 +0100)
committerGitHub <noreply@github.com>
Fri, 5 Nov 2021 09:23:02 +0000 (10:23 +0100)
* Added 144p encoding

Implements https://github.com/Chocobozzz/PeerTube/issues/4428

* Fixed typo in core-utils

* Increased BitPerPixel for 144p

* Disabled 144p by default in test.yaml

* Another try at fixing tests

* Fixed test in video-transcoder (api-3)

* Fixed test in video-imports (api-4)

* Fixed test in live-constraints (api-2)

* Tried to fix tests in api-3 again

* Revert "Tried to fix tests in api-3 again"

This reverts commit 266e1143fa37f333d149c2c2791c7bd33621ac14.

* Fixed test in config.ts (api-2)

* Try to fix test in video-hls.ts (api-3)

* Fixed test in video-transcoder.ts (api-3)

* Fix tests

Co-authored-by: Chocobozzz <me@florianbigard.com>
28 files changed:
client/src/app/+admin/config/edit-custom-config/edit-configuration.service.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.ts
server/tests/api/object-storage/live.ts
server/tests/api/object-storage/video-imports.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/api/videos/video-imports.ts
server/tests/api/videos/video-transcoder.ts
server/tests/cli/create-transcoding-job.ts
server/tests/helpers/core-utils.ts
shared/core-utils/videos/bitrate.ts
shared/extra-utils/server/config-command.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 63e0343face7d8106635a529852709433ffe264e..9b55cb43cdb9c34b6d5c9866cd84d3862a1040e5 100644 (file)
@@ -17,6 +17,10 @@ export class EditConfigurationService {
         label: $localize`Audio-only`,
         description: $localize`A <code>.mp4</code> that keeps the original audio track, with no video`
       },
+      {
+        id: '144p',
+        label: $localize`144p`
+      },
       {
         id: '240p',
         label: $localize`240p`
index cf9d69a621150562b8c5d7786a795a971f2ca584..c70e6a205886a05dc87fb320da50ed31eec38035 100644 (file)
@@ -323,6 +323,7 @@ transcoding:
 
   resolutions: # Only created if the original video has a higher resolution, uses more storage!
     0p: false # audio-only (creates mp4 without video stream, always created when enabled)
+    144p: false
     240p: false
     360p: false
     480p: false
@@ -382,6 +383,7 @@ live:
     profile: 'default'
 
     resolutions:
+      144p: false
       240p: false
       360p: false
       480p: false
index 70993bf57a30126279b916f2ce8b32f42bd691ce..0da96f612c9f9685683d6a20980590d7ea77e8c2 100644 (file)
@@ -333,6 +333,7 @@ transcoding:
 
   resolutions: # Only created if the original video has a higher resolution, uses more storage!
     0p: false # audio-only (creates mp4 without video stream, always created when enabled)
+    144p: false
     240p: false
     360p: false
     480p: false
@@ -392,6 +393,7 @@ live:
     profile: 'default'
 
     resolutions:
+      144p: false
       240p: false
       360p: false
       480p: false
index 3eb2f04d83be9807522be28ac93dae0b2c9f007f..e9731d863ccf2a94dae1f2929bd6d2c16e7aa125 100644 (file)
@@ -80,6 +80,7 @@ transcoding:
   concurrency: 2
   resolutions:
     0p: false
+    144p: false
     240p: true
     360p: true
     480p: true
@@ -105,6 +106,7 @@ live:
     threads: 2
 
     resolutions:
+      144p: false
       240p: false
       360p: false
       480p: false
index 8965cacc9b4a66f1260db783e0be0b1322f5f8af..805ad99c7e0d48ddad6fec74f17ea0e440585cb3 100644 (file)
@@ -208,6 +208,7 @@ function customConfig (): CustomConfig {
       profile: CONFIG.TRANSCODING.PROFILE,
       resolutions: {
         '0p': CONFIG.TRANSCODING.RESOLUTIONS['0p'],
+        '144p': CONFIG.TRANSCODING.RESOLUTIONS['144p'],
         '240p': CONFIG.TRANSCODING.RESOLUTIONS['240p'],
         '360p': CONFIG.TRANSCODING.RESOLUTIONS['360p'],
         '480p': CONFIG.TRANSCODING.RESOLUTIONS['480p'],
@@ -234,6 +235,7 @@ function customConfig (): CustomConfig {
         threads: CONFIG.LIVE.TRANSCODING.THREADS,
         profile: CONFIG.LIVE.TRANSCODING.PROFILE,
         resolutions: {
+          '144p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['144p'],
           '240p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['240p'],
           '360p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['360p'],
           '480p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['480p'],
index 767f37f9ca3141fbfd539321e1605c42908c1ba0..907f13651535bccb388faceb5fc899f2d37e0153 100644 (file)
@@ -220,6 +220,7 @@ function computeResolutionsToTranscode (videoFileResolution: number, type: 'vod'
     VideoResolution.H_360P,
     VideoResolution.H_720P,
     VideoResolution.H_240P,
+    VideoResolution.H_144P,
     VideoResolution.H_1080P,
     VideoResolution.H_1440P,
     VideoResolution.H_4K
index 72acdd422f94dc96b36791f8fdc8699042e5f217..39f0cebf652c3e3b3dc638d0ba34f6f6db226e2a 100644 (file)
@@ -28,8 +28,9 @@ function checkMissedConfig () {
     'redundancy.videos.strategies', 'redundancy.videos.check_interval',
     'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions', 'transcoding.hls.enabled',
     'transcoding.profile', 'transcoding.concurrency',
-    'transcoding.resolutions.0p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p', 'transcoding.resolutions.480p',
-    'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', 'transcoding.resolutions.2160p',
+    'transcoding.resolutions.0p', 'transcoding.resolutions.144p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p',
+    'transcoding.resolutions.480p', 'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p',
+    'transcoding.resolutions.2160p',
     'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'auto_blacklist.videos.of_users.enabled',
     'trending.videos.interval_days',
     'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route',
@@ -47,9 +48,9 @@ function checkMissedConfig () {
     'search.search_index.disable_local_search', 'search.search_index.is_default_search',
     'live.enabled', 'live.allow_replay', 'live.max_duration', 'live.max_user_lives', 'live.max_instance_lives',
     'live.transcoding.enabled', 'live.transcoding.threads', 'live.transcoding.profile',
-    'live.transcoding.resolutions.240p', 'live.transcoding.resolutions.360p', 'live.transcoding.resolutions.480p',
-    'live.transcoding.resolutions.720p', 'live.transcoding.resolutions.1080p', 'live.transcoding.resolutions.1440p',
-    'live.transcoding.resolutions.2160p'
+    'live.transcoding.resolutions.144p', 'live.transcoding.resolutions.240p', 'live.transcoding.resolutions.360p',
+    'live.transcoding.resolutions.480p', 'live.transcoding.resolutions.720p', 'live.transcoding.resolutions.1080p',
+    'live.transcoding.resolutions.1440p', 'live.transcoding.resolutions.2160p'
   ]
 
   const requiredAlternatives = [
index 8375bf4304cda5e3794bf79871596de32f316f50..0d5e2949950704cf305dbdc797fdb8763f1b185c 100644 (file)
@@ -245,6 +245,7 @@ const CONFIG = {
     get PROFILE () { return config.get<string>('transcoding.profile') },
     RESOLUTIONS: {
       get '0p' () { return config.get<boolean>('transcoding.resolutions.0p') },
+      get '144p' () { return config.get<boolean>('transcoding.resolutions.144p') },
       get '240p' () { return config.get<boolean>('transcoding.resolutions.240p') },
       get '360p' () { return config.get<boolean>('transcoding.resolutions.360p') },
       get '480p' () { return config.get<boolean>('transcoding.resolutions.480p') },
@@ -279,6 +280,7 @@ const CONFIG = {
       get PROFILE () { return config.get<string>('live.transcoding.profile') },
 
       RESOLUTIONS: {
+        get '144p' () { return config.get<boolean>('live.transcoding.resolutions.144p') },
         get '240p' () { return config.get<boolean>('live.transcoding.resolutions.240p') },
         get '360p' () { return config.get<boolean>('live.transcoding.resolutions.360p') },
         get '480p' () { return config.get<boolean>('live.transcoding.resolutions.480p') },
index da52b14bab09cb1c27a4e2102641e2e482f17245..8b14feb3c336f721a9ba406c013d60b871a845f9 100644 (file)
@@ -45,6 +45,7 @@ const customConfigUpdateValidator = [
   body('transcoding.threads').isInt().withMessage('Should have a valid transcoding threads number'),
   body('transcoding.concurrency').isInt({ min: 1 }).withMessage('Should have a valid transcoding concurrency number'),
   body('transcoding.resolutions.0p').isBoolean().withMessage('Should have a valid transcoding 0p resolution enabled boolean'),
+  body('transcoding.resolutions.144p').isBoolean().withMessage('Should have a valid transcoding 144p resolution enabled boolean'),
   body('transcoding.resolutions.240p').isBoolean().withMessage('Should have a valid transcoding 240p resolution enabled boolean'),
   body('transcoding.resolutions.360p').isBoolean().withMessage('Should have a valid transcoding 360p resolution enabled boolean'),
   body('transcoding.resolutions.480p').isBoolean().withMessage('Should have a valid transcoding 480p resolution enabled boolean'),
@@ -80,6 +81,7 @@ const customConfigUpdateValidator = [
   body('live.maxUserLives').custom(isIntOrNull).withMessage('Should have a valid max user lives'),
   body('live.transcoding.enabled').isBoolean().withMessage('Should have a valid live transcoding enabled boolean'),
   body('live.transcoding.threads').isInt().withMessage('Should have a valid live transcoding threads'),
+  body('live.transcoding.resolutions.144p').isBoolean().withMessage('Should have a valid transcoding 144p resolution enabled boolean'),
   body('live.transcoding.resolutions.240p').isBoolean().withMessage('Should have a valid transcoding 240p resolution enabled boolean'),
   body('live.transcoding.resolutions.360p').isBoolean().withMessage('Should have a valid transcoding 360p resolution enabled boolean'),
   body('live.transcoding.resolutions.480p').isBoolean().withMessage('Should have a valid transcoding 480p resolution enabled boolean'),
index 273b1f71841294b9af725883547c064fa25254ec..d0cd7722b7c48d8b8626af0164ee018bfee6077e 100644 (file)
@@ -93,6 +93,7 @@ describe('Test config API validators', function () {
       profile: 'vod_profile',
       resolutions: {
         '0p': false,
+        '144p': false,
         '240p': false,
         '360p': true,
         '480p': true,
@@ -121,6 +122,7 @@ describe('Test config API validators', function () {
         threads: 4,
         profile: 'live_profile',
         resolutions: {
+          '144p': true,
           '240p': true,
           '360p': true,
           '480p': true,
index 4acde3cc55af033a1dbcfb8c1cc9dc6b0f6545c0..6a6a11796f86cb3180c51f0a03b4d6b47119b4a3 100644 (file)
@@ -168,7 +168,7 @@ describe('Test live constraints', function () {
     await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
     await waitJobs(servers)
 
-    await checkSaveReplay(userVideoLiveoId, [ 720, 480, 360, 240 ])
+    await checkSaveReplay(userVideoLiveoId, [ 720, 480, 360, 240, 144 ])
   })
 
   after(async function () {
index 0b405dd94dcbfe44b48c8d2a6cd1f1f93f09a9ea..619602d0b89d17632899017304c320b972956a6b 100644 (file)
@@ -421,6 +421,7 @@ describe('Test live', function () {
             transcoding: {
               enabled: true,
               resolutions: {
+                '144p': resolutions.includes(144),
                 '240p': resolutions.includes(240),
                 '360p': resolutions.includes(360),
                 '480p': resolutions.includes(480),
index d3e6777f2930b8e76dff3102dbd12fefb1d75538..3726a717bd74b3eca51c653e1319b581430649ae 100644 (file)
@@ -123,7 +123,7 @@ describe('Object storage for lives', function () {
         expect(video.streamingPlaylists).to.have.lengthOf(1)
 
         const files = video.streamingPlaylists[0].files
-        expect(files).to.have.lengthOf(4)
+        expect(files).to.have.lengthOf(5)
 
         await checkFiles(files)
       }
index efc01f55041f7628ab6d30419d67de84dfe127c9..363fe3b5be59992d34f14bcfb53bdb9676aaec23 100644 (file)
@@ -88,9 +88,9 @@ describe('Object storage for video import', function () {
 
       const video = await server.videos.get({ id: uuid })
 
-      expect(video.files).to.have.lengthOf(4)
+      expect(video.files).to.have.lengthOf(5)
       expect(video.streamingPlaylists).to.have.lengthOf(1)
-      expect(video.streamingPlaylists[0].files).to.have.lengthOf(4)
+      expect(video.streamingPlaylists[0].files).to.have.lengthOf(5)
 
       for (const file of video.files) {
         expectStartWith(file.fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl())
index 8d5b3ac7fb509010e78aead99026cc788fc7db45..ea524723cfee2d20976fba22ffd87c7fb8e80f92 100644 (file)
@@ -66,6 +66,7 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
   expect(data.transcoding.threads).to.equal(2)
   expect(data.transcoding.concurrency).to.equal(2)
   expect(data.transcoding.profile).to.equal('default')
+  expect(data.transcoding.resolutions['144p']).to.be.false
   expect(data.transcoding.resolutions['240p']).to.be.true
   expect(data.transcoding.resolutions['360p']).to.be.true
   expect(data.transcoding.resolutions['480p']).to.be.true
@@ -84,6 +85,7 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
   expect(data.live.transcoding.enabled).to.be.false
   expect(data.live.transcoding.threads).to.equal(2)
   expect(data.live.transcoding.profile).to.equal('default')
+  expect(data.live.transcoding.resolutions['144p']).to.be.false
   expect(data.live.transcoding.resolutions['240p']).to.be.false
   expect(data.live.transcoding.resolutions['360p']).to.be.false
   expect(data.live.transcoding.resolutions['480p']).to.be.false
@@ -163,6 +165,7 @@ function checkUpdatedConfig (data: CustomConfig) {
   expect(data.transcoding.allowAdditionalExtensions).to.be.true
   expect(data.transcoding.allowAudioFiles).to.be.true
   expect(data.transcoding.profile).to.equal('vod_profile')
+  expect(data.transcoding.resolutions['144p']).to.be.false
   expect(data.transcoding.resolutions['240p']).to.be.false
   expect(data.transcoding.resolutions['360p']).to.be.true
   expect(data.transcoding.resolutions['480p']).to.be.true
@@ -180,6 +183,7 @@ function checkUpdatedConfig (data: CustomConfig) {
   expect(data.live.transcoding.enabled).to.be.true
   expect(data.live.transcoding.threads).to.equal(4)
   expect(data.live.transcoding.profile).to.equal('live_profile')
+  expect(data.live.transcoding.resolutions['144p']).to.be.true
   expect(data.live.transcoding.resolutions['240p']).to.be.true
   expect(data.live.transcoding.resolutions['360p']).to.be.true
   expect(data.live.transcoding.resolutions['480p']).to.be.true
@@ -281,6 +285,7 @@ const newCustomConfig: CustomConfig = {
     profile: 'vod_profile',
     resolutions: {
       '0p': false,
+      '144p': false,
       '240p': false,
       '360p': true,
       '480p': true,
@@ -307,6 +312,7 @@ const newCustomConfig: CustomConfig = {
       threads: 4,
       profile: 'live_profile',
       resolutions: {
+        '144p': true,
         '240p': true,
         '360p': true,
         '480p': true,
index 5ec771429b41737e115b1701bf7cf293975b4dee..efc80463cccf52dd8a24b40d118e0a9ebbb8f2b4 100644 (file)
@@ -198,6 +198,7 @@ describe('Test stats (excluding redundancy)', function () {
           },
           resolutions: {
             '0p': false,
+            '144p': false,
             '240p': false,
             '360p': false,
             '480p': false,
index 7fac6e7389e7e9ef20297f12c33f0b1fd2443eb7..f4b635bd5cbac711d15d62b3116c226828e6acb5 100644 (file)
@@ -21,6 +21,7 @@ describe('Test audio only video transcoding', function () {
         enabled: true,
         resolutions: {
           '0p': true,
+          '144p': false,
           '240p': true,
           '360p': false,
           '480p': false,
index 91124725fa87dca76a4040acd5ba50934c1af90a..a18c3d6720402589150f5e97b82f3fad292ad257 100644 (file)
@@ -243,6 +243,7 @@ describe('Test HLS videos', function () {
             enabled: true,
             allowAudioFiles: true,
             resolutions: {
+              '144p': false,
               '240p': true,
               '360p': true,
               '480p': true,
index bb1627a27786ae5d86561c0b3e7a362e52c2c089..987f34e977ee25df25e6b35d39d480ac83c4fd73 100644 (file)
@@ -300,6 +300,7 @@ describe('Test video imports', function () {
           transcoding: {
             enabled: true,
             resolutions: {
+              '144p': true,
               '240p': true,
               '360p': false,
               '480p': false,
index 21609fd822da0a000c44ef0969fdf3817c2aa28b..b3226dbf7289f869c2fb22639b1d6cbfbb2f15cd 100644 (file)
@@ -40,6 +40,7 @@ function updateConfigForTranscoding (server: PeerTubeServer) {
         webtorrent: { enabled: true },
         resolutions: {
           '0p': false,
+          '144p': true,
           '240p': true,
           '360p': true,
           '480p': true,
@@ -119,7 +120,7 @@ describe('Test video transcoding', function () {
         const video = data.find(v => v.name === attributes.name)
         const videoDetails = await server.videos.get({ id: video.id })
 
-        expect(videoDetails.files).to.have.lengthOf(4)
+        expect(videoDetails.files).to.have.lengthOf(5)
 
         const magnetUri = videoDetails.files[0].magnetUri
         expect(magnetUri).to.match(/\.mp4/)
@@ -205,7 +206,7 @@ describe('Test video transcoding', function () {
 
           const video = data.find(v => v.name === attributes.name)
           const videoDetails = await server.videos.get({ id: video.id })
-          expect(videoDetails.files).to.have.lengthOf(4)
+          expect(videoDetails.files).to.have.lengthOf(5)
 
           const magnetUri = videoDetails.files[0].magnetUri
           expect(magnetUri).to.contain('.mp4')
@@ -226,7 +227,7 @@ describe('Test video transcoding', function () {
 
       await waitJobs(servers)
 
-      const resolutions = [ 240, 360, 480, 720, 1080, 1440, 2160 ]
+      const resolutions = [ 144, 240, 360, 480, 720, 1080, 1440, 2160 ]
 
       for (const server of servers) {
         const videoDetails = await server.videos.get({ id: video4k })
@@ -259,7 +260,7 @@ describe('Test video transcoding', function () {
         const video = data.find(v => v.name === attributes.name)
         const videoDetails = await server.videos.get({ id: video.id })
 
-        expect(videoDetails.files).to.have.lengthOf(4)
+        expect(videoDetails.files).to.have.lengthOf(5)
 
         const file = videoDetails.files.find(f => f.resolution.id === 240)
         const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl)
@@ -316,7 +317,7 @@ describe('Test video transcoding', function () {
         const video = data.find(v => v.name === attributes.name)
         const videoDetails = await server.videos.get({ id: video.id })
 
-        expect(videoDetails.files).to.have.lengthOf(4)
+        expect(videoDetails.files).to.have.lengthOf(5)
 
         const fixturePath = buildAbsoluteFixturePath(attributes.fixture)
         const fixtureVideoProbe = await getAudioStream(fixturePath)
@@ -348,6 +349,7 @@ describe('Test video transcoding', function () {
               webtorrent: { enabled: true },
               resolutions: {
                 '0p': false,
+                '144p': false,
                 '240p': false,
                 '360p': false,
                 '480p': false,
@@ -419,6 +421,7 @@ describe('Test video transcoding', function () {
               webtorrent: { enabled: true },
               resolutions: {
                 '0p': true,
+                '144p': false,
                 '240p': false,
                 '360p': false
               }
@@ -473,13 +476,14 @@ describe('Test video transcoding', function () {
         const video = data.find(v => v.name === attributes.name)
         const videoDetails = await server.videos.get({ id: video.id })
 
-        expect(videoDetails.files).to.have.lengthOf(4)
+        expect(videoDetails.files).to.have.lengthOf(5)
         expect(videoDetails.files[0].fps).to.be.above(58).and.below(62)
         expect(videoDetails.files[1].fps).to.be.below(31)
         expect(videoDetails.files[2].fps).to.be.below(31)
         expect(videoDetails.files[3].fps).to.be.below(31)
+        expect(videoDetails.files[4].fps).to.be.below(31)
 
-        for (const resolution of [ 240, 360, 480 ]) {
+        for (const resolution of [ 144, 240, 360, 480 ]) {
           const file = videoDetails.files.find(f => f.resolution.id === resolution)
           const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl)
           const fps = await getVideoFileFPS(path)
@@ -586,6 +590,7 @@ describe('Test video transcoding', function () {
         transcoding: {
           enabled: true,
           resolutions: {
+            '144p': true,
             '240p': true,
             '360p': true,
             '480p': true,
@@ -667,7 +672,7 @@ describe('Test video transcoding', function () {
 
         const videoFiles = videoDetails.files
                                       .concat(videoDetails.streamingPlaylists[0].files)
-        expect(videoFiles).to.have.lengthOf(8)
+        expect(videoFiles).to.have.lengthOf(10)
 
         for (const file of videoFiles) {
           expect(file.metadata).to.be.undefined
@@ -695,21 +700,21 @@ describe('Test video transcoding', function () {
       const body = await servers[1].jobs.list({
         start: 0,
         count: 100,
-        sort: '-createdAt',
+        sort: 'createdAt',
         jobType: 'video-transcoding'
       })
 
       const jobs = body.data
       const transcodingJobs = jobs.filter(j => j.data.videoUUID === video4k)
 
-      expect(transcodingJobs).to.have.lengthOf(14)
+      expect(transcodingJobs).to.have.lengthOf(16)
 
       const hlsJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-hls')
       const webtorrentJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-webtorrent')
       const optimizeJobs = transcodingJobs.filter(j => j.data.type === 'optimize-to-webtorrent')
 
-      expect(hlsJobs).to.have.lengthOf(7)
-      expect(webtorrentJobs).to.have.lengthOf(6)
+      expect(hlsJobs).to.have.lengthOf(8)
+      expect(webtorrentJobs).to.have.lengthOf(7)
       expect(optimizeJobs).to.have.lengthOf(1)
 
       for (const j of optimizeJobs.concat(hlsJobs.concat(webtorrentJobs))) {
index 2b388ab0ca0de87de53547c7dac50df983f42c1e..fb9c2584fbf7c593de5b33b7b9b65082e5555b48 100644 (file)
@@ -220,9 +220,9 @@ function runTests (objectStorage: boolean) {
     for (const server of servers) {
       const videoDetails = await server.videos.get({ id: videosUUID[4] })
 
-      expect(videoDetails.files).to.have.lengthOf(4)
+      expect(videoDetails.files).to.have.lengthOf(5)
       expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
-      expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(4)
+      expect(videoDetails.streamingPlaylists[0].files).to.have.lengthOf(5)
 
       if (objectStorage) {
         await checkFilesInObjectStorage(videoDetails.files, 'webtorrent')
index a6bf5b4c54e635e3afd903c5d66d170eee41c816..fa0a713412b6926469298420152f51f22c235112 100644 (file)
@@ -104,6 +104,7 @@ describe('Bitrate', function () {
 
   it('Should get appropriate max bitrate', function () {
     const tests = [
+      { resolution: VideoResolution.H_144P, ratio: 16 / 9, fps: 24, min: 200, max: 400 },
       { resolution: VideoResolution.H_240P, ratio: 16 / 9, fps: 24, min: 600, max: 800 },
       { resolution: VideoResolution.H_360P, ratio: 16 / 9, fps: 24, min: 1200, max: 1600 },
       { resolution: VideoResolution.H_480P, ratio: 16 / 9, fps: 24, min: 2000, max: 2300 },
@@ -119,6 +120,7 @@ describe('Bitrate', function () {
 
   it('Should get appropriate average bitrate', function () {
     const tests = [
+      { resolution: VideoResolution.H_144P, ratio: 16 / 9, fps: 24, min: 50, max: 300 },
       { resolution: VideoResolution.H_240P, ratio: 16 / 9, fps: 24, min: 350, max: 450 },
       { resolution: VideoResolution.H_360P, ratio: 16 / 9, fps: 24, min: 700, max: 900 },
       { resolution: VideoResolution.H_480P, ratio: 16 / 9, fps: 24, min: 1100, max: 1300 },
index a6712f8a4a8abafb333fbe17ed9d6f694af5c8d9..18c6e2f6cef4ef6c45de5b97cf3b0399959317ad 100644 (file)
@@ -6,6 +6,7 @@ type BitPerPixel = { [ id in VideoResolution ]: number }
 
 const averageBitPerPixel: BitPerPixel = {
   [VideoResolution.H_NOVIDEO]: 0,
+  [VideoResolution.H_144P]: 0.19,
   [VideoResolution.H_240P]: 0.17,
   [VideoResolution.H_360P]: 0.15,
   [VideoResolution.H_480P]: 0.12,
@@ -17,6 +18,7 @@ const averageBitPerPixel: BitPerPixel = {
 
 const maxBitPerPixel: BitPerPixel = {
   [VideoResolution.H_NOVIDEO]: 0,
+  [VideoResolution.H_144P]: 0.32,
   [VideoResolution.H_240P]: 0.29,
   [VideoResolution.H_360P]: 0.26,
   [VideoResolution.H_480P]: 0.22,
@@ -73,6 +75,7 @@ function calculateBitrate (options: {
     VideoResolution.H_480P,
     VideoResolution.H_360P,
     VideoResolution.H_240P,
+    VideoResolution.H_144P,
     VideoResolution.H_NOVIDEO
   ]
 
index 2746e9ac407f0823f35538f58ef6dfaee7d889d4..7a768b4df4151bd03e7d44f181cc2e7ffc8e4181 100644 (file)
@@ -8,6 +8,7 @@ export class ConfigCommand extends AbstractCommand {
 
   static getCustomConfigResolutions (enabled: boolean) {
     return {
+      '144p': enabled,
       '240p': enabled,
       '360p': enabled,
       '480p': enabled,
@@ -232,6 +233,7 @@ export class ConfigCommand extends AbstractCommand {
         profile: 'default',
         resolutions: {
           '0p': false,
+          '144p': false,
           '240p': false,
           '360p': true,
           '480p': true,
@@ -258,6 +260,7 @@ export class ConfigCommand extends AbstractCommand {
           threads: 4,
           profile: 'default',
           resolutions: {
+            '144p': true,
             '240p': true,
             '360p': true,
             '480p': true,
index 322fbb797ba1e424433d570ae4a8c446c0d5012d..3ed93249460c7a553456d6d30df27e21c936112e 100644 (file)
@@ -2,6 +2,7 @@ import { NSFWPolicyType } from '../videos/nsfw-policy.type'
 import { BroadcastMessageLevel } from './broadcast-message-level.type'
 
 export type ConfigResolutions = {
+  '144p': boolean
   '240p': boolean
   '360p': boolean
   '480p': boolean
index 24cd2d04d723514de57ac786dc094c7235d5ba22..5b48ad35340087efe8d4a981df9ffe095d8add8d 100644 (file)
@@ -1,5 +1,6 @@
 export const enum VideoResolution {
   H_NOVIDEO = 0,
+  H_144P = 144,
   H_240P = 240,
   H_360P = 360,
   H_480P = 480,
index ec246bca0f9949dd4d27194e34ff71f2c8209455..48109664a6108857bbcda3e2cc4792d692b27d27 100644 (file)
@@ -6167,6 +6167,8 @@ components:
               properties:
                 0p:
                   type: boolean
+                144p:
+                  type: boolean
                 240p:
                   type: boolean
                 360p:
index c7cd28e65211941a7ee2c89262871a2f9137cc80..d5304b0dd226feb7fd8fd856bde4941ae85a3202 100644 (file)
@@ -130,6 +130,9 @@ transcoding:
     __name: "PEERTUBE_TRANSCODING_THREADS"
     __format: "json"
   resolutions:
+    144p:
+      __name: "PEERTUBE_TRANSCODING_144P"
+      __format: "json"
     240p:
       __name: "PEERTUBE_TRANSCODING_240P"
       __format: "json"