diff options
author | Florian CUNY <poslovitch@bentobox.world> | 2021-11-05 10:23:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 10:23:02 +0100 |
commit | 8dd754c76735417305c4b68e2ada6f623e9d7650 (patch) | |
tree | ac08054cc81f7aff812e175443298f287f66b96d /server/tests/api/videos/video-transcoder.ts | |
parent | dd6d2a7ce50e7ff02e00995ccc87f8f929ad9709 (diff) | |
download | PeerTube-8dd754c76735417305c4b68e2ada6f623e9d7650.tar.gz PeerTube-8dd754c76735417305c4b68e2ada6f623e9d7650.tar.zst PeerTube-8dd754c76735417305c4b68e2ada6f623e9d7650.zip |
Added 144p encoding (#4492)
* 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>
Diffstat (limited to 'server/tests/api/videos/video-transcoder.ts')
-rw-r--r-- | server/tests/api/videos/video-transcoder.ts | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index 21609fd82..b3226dbf7 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts | |||
@@ -40,6 +40,7 @@ function updateConfigForTranscoding (server: PeerTubeServer) { | |||
40 | webtorrent: { enabled: true }, | 40 | webtorrent: { enabled: true }, |
41 | resolutions: { | 41 | resolutions: { |
42 | '0p': false, | 42 | '0p': false, |
43 | '144p': true, | ||
43 | '240p': true, | 44 | '240p': true, |
44 | '360p': true, | 45 | '360p': true, |
45 | '480p': true, | 46 | '480p': true, |
@@ -119,7 +120,7 @@ describe('Test video transcoding', function () { | |||
119 | const video = data.find(v => v.name === attributes.name) | 120 | const video = data.find(v => v.name === attributes.name) |
120 | const videoDetails = await server.videos.get({ id: video.id }) | 121 | const videoDetails = await server.videos.get({ id: video.id }) |
121 | 122 | ||
122 | expect(videoDetails.files).to.have.lengthOf(4) | 123 | expect(videoDetails.files).to.have.lengthOf(5) |
123 | 124 | ||
124 | const magnetUri = videoDetails.files[0].magnetUri | 125 | const magnetUri = videoDetails.files[0].magnetUri |
125 | expect(magnetUri).to.match(/\.mp4/) | 126 | expect(magnetUri).to.match(/\.mp4/) |
@@ -205,7 +206,7 @@ describe('Test video transcoding', function () { | |||
205 | 206 | ||
206 | const video = data.find(v => v.name === attributes.name) | 207 | const video = data.find(v => v.name === attributes.name) |
207 | const videoDetails = await server.videos.get({ id: video.id }) | 208 | const videoDetails = await server.videos.get({ id: video.id }) |
208 | expect(videoDetails.files).to.have.lengthOf(4) | 209 | expect(videoDetails.files).to.have.lengthOf(5) |
209 | 210 | ||
210 | const magnetUri = videoDetails.files[0].magnetUri | 211 | const magnetUri = videoDetails.files[0].magnetUri |
211 | expect(magnetUri).to.contain('.mp4') | 212 | expect(magnetUri).to.contain('.mp4') |
@@ -226,7 +227,7 @@ describe('Test video transcoding', function () { | |||
226 | 227 | ||
227 | await waitJobs(servers) | 228 | await waitJobs(servers) |
228 | 229 | ||
229 | const resolutions = [ 240, 360, 480, 720, 1080, 1440, 2160 ] | 230 | const resolutions = [ 144, 240, 360, 480, 720, 1080, 1440, 2160 ] |
230 | 231 | ||
231 | for (const server of servers) { | 232 | for (const server of servers) { |
232 | const videoDetails = await server.videos.get({ id: video4k }) | 233 | const videoDetails = await server.videos.get({ id: video4k }) |
@@ -259,7 +260,7 @@ describe('Test video transcoding', function () { | |||
259 | const video = data.find(v => v.name === attributes.name) | 260 | const video = data.find(v => v.name === attributes.name) |
260 | const videoDetails = await server.videos.get({ id: video.id }) | 261 | const videoDetails = await server.videos.get({ id: video.id }) |
261 | 262 | ||
262 | expect(videoDetails.files).to.have.lengthOf(4) | 263 | expect(videoDetails.files).to.have.lengthOf(5) |
263 | 264 | ||
264 | const file = videoDetails.files.find(f => f.resolution.id === 240) | 265 | const file = videoDetails.files.find(f => f.resolution.id === 240) |
265 | const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) | 266 | const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) |
@@ -316,7 +317,7 @@ describe('Test video transcoding', function () { | |||
316 | const video = data.find(v => v.name === attributes.name) | 317 | const video = data.find(v => v.name === attributes.name) |
317 | const videoDetails = await server.videos.get({ id: video.id }) | 318 | const videoDetails = await server.videos.get({ id: video.id }) |
318 | 319 | ||
319 | expect(videoDetails.files).to.have.lengthOf(4) | 320 | expect(videoDetails.files).to.have.lengthOf(5) |
320 | 321 | ||
321 | const fixturePath = buildAbsoluteFixturePath(attributes.fixture) | 322 | const fixturePath = buildAbsoluteFixturePath(attributes.fixture) |
322 | const fixtureVideoProbe = await getAudioStream(fixturePath) | 323 | const fixtureVideoProbe = await getAudioStream(fixturePath) |
@@ -348,6 +349,7 @@ describe('Test video transcoding', function () { | |||
348 | webtorrent: { enabled: true }, | 349 | webtorrent: { enabled: true }, |
349 | resolutions: { | 350 | resolutions: { |
350 | '0p': false, | 351 | '0p': false, |
352 | '144p': false, | ||
351 | '240p': false, | 353 | '240p': false, |
352 | '360p': false, | 354 | '360p': false, |
353 | '480p': false, | 355 | '480p': false, |
@@ -419,6 +421,7 @@ describe('Test video transcoding', function () { | |||
419 | webtorrent: { enabled: true }, | 421 | webtorrent: { enabled: true }, |
420 | resolutions: { | 422 | resolutions: { |
421 | '0p': true, | 423 | '0p': true, |
424 | '144p': false, | ||
422 | '240p': false, | 425 | '240p': false, |
423 | '360p': false | 426 | '360p': false |
424 | } | 427 | } |
@@ -473,13 +476,14 @@ describe('Test video transcoding', function () { | |||
473 | const video = data.find(v => v.name === attributes.name) | 476 | const video = data.find(v => v.name === attributes.name) |
474 | const videoDetails = await server.videos.get({ id: video.id }) | 477 | const videoDetails = await server.videos.get({ id: video.id }) |
475 | 478 | ||
476 | expect(videoDetails.files).to.have.lengthOf(4) | 479 | expect(videoDetails.files).to.have.lengthOf(5) |
477 | expect(videoDetails.files[0].fps).to.be.above(58).and.below(62) | 480 | expect(videoDetails.files[0].fps).to.be.above(58).and.below(62) |
478 | expect(videoDetails.files[1].fps).to.be.below(31) | 481 | expect(videoDetails.files[1].fps).to.be.below(31) |
479 | expect(videoDetails.files[2].fps).to.be.below(31) | 482 | expect(videoDetails.files[2].fps).to.be.below(31) |
480 | expect(videoDetails.files[3].fps).to.be.below(31) | 483 | expect(videoDetails.files[3].fps).to.be.below(31) |
484 | expect(videoDetails.files[4].fps).to.be.below(31) | ||
481 | 485 | ||
482 | for (const resolution of [ 240, 360, 480 ]) { | 486 | for (const resolution of [ 144, 240, 360, 480 ]) { |
483 | const file = videoDetails.files.find(f => f.resolution.id === resolution) | 487 | const file = videoDetails.files.find(f => f.resolution.id === resolution) |
484 | const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) | 488 | const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) |
485 | const fps = await getVideoFileFPS(path) | 489 | const fps = await getVideoFileFPS(path) |
@@ -586,6 +590,7 @@ describe('Test video transcoding', function () { | |||
586 | transcoding: { | 590 | transcoding: { |
587 | enabled: true, | 591 | enabled: true, |
588 | resolutions: { | 592 | resolutions: { |
593 | '144p': true, | ||
589 | '240p': true, | 594 | '240p': true, |
590 | '360p': true, | 595 | '360p': true, |
591 | '480p': true, | 596 | '480p': true, |
@@ -667,7 +672,7 @@ describe('Test video transcoding', function () { | |||
667 | 672 | ||
668 | const videoFiles = videoDetails.files | 673 | const videoFiles = videoDetails.files |
669 | .concat(videoDetails.streamingPlaylists[0].files) | 674 | .concat(videoDetails.streamingPlaylists[0].files) |
670 | expect(videoFiles).to.have.lengthOf(8) | 675 | expect(videoFiles).to.have.lengthOf(10) |
671 | 676 | ||
672 | for (const file of videoFiles) { | 677 | for (const file of videoFiles) { |
673 | expect(file.metadata).to.be.undefined | 678 | expect(file.metadata).to.be.undefined |
@@ -695,21 +700,21 @@ describe('Test video transcoding', function () { | |||
695 | const body = await servers[1].jobs.list({ | 700 | const body = await servers[1].jobs.list({ |
696 | start: 0, | 701 | start: 0, |
697 | count: 100, | 702 | count: 100, |
698 | sort: '-createdAt', | 703 | sort: 'createdAt', |
699 | jobType: 'video-transcoding' | 704 | jobType: 'video-transcoding' |
700 | }) | 705 | }) |
701 | 706 | ||
702 | const jobs = body.data | 707 | const jobs = body.data |
703 | const transcodingJobs = jobs.filter(j => j.data.videoUUID === video4k) | 708 | const transcodingJobs = jobs.filter(j => j.data.videoUUID === video4k) |
704 | 709 | ||
705 | expect(transcodingJobs).to.have.lengthOf(14) | 710 | expect(transcodingJobs).to.have.lengthOf(16) |
706 | 711 | ||
707 | const hlsJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-hls') | 712 | const hlsJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-hls') |
708 | const webtorrentJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-webtorrent') | 713 | const webtorrentJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-webtorrent') |
709 | const optimizeJobs = transcodingJobs.filter(j => j.data.type === 'optimize-to-webtorrent') | 714 | const optimizeJobs = transcodingJobs.filter(j => j.data.type === 'optimize-to-webtorrent') |
710 | 715 | ||
711 | expect(hlsJobs).to.have.lengthOf(7) | 716 | expect(hlsJobs).to.have.lengthOf(8) |
712 | expect(webtorrentJobs).to.have.lengthOf(6) | 717 | expect(webtorrentJobs).to.have.lengthOf(7) |
713 | expect(optimizeJobs).to.have.lengthOf(1) | 718 | expect(optimizeJobs).to.have.lengthOf(1) |
714 | 719 | ||
715 | for (const j of optimizeJobs.concat(hlsJobs.concat(webtorrentJobs))) { | 720 | for (const j of optimizeJobs.concat(hlsJobs.concat(webtorrentJobs))) { |