diff options
Diffstat (limited to 'server/tests/api/transcoding/audio-only.ts')
-rw-r--r-- | server/tests/api/transcoding/audio-only.ts | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/server/tests/api/transcoding/audio-only.ts b/server/tests/api/transcoding/audio-only.ts deleted file mode 100644 index f4cc012ef..000000000 --- a/server/tests/api/transcoding/audio-only.ts +++ /dev/null | |||
@@ -1,104 +0,0 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import { expect } from 'chai' | ||
4 | import { getAudioStream, getVideoStreamDimensionsInfo } from '@shared/ffmpeg' | ||
5 | import { | ||
6 | cleanupTests, | ||
7 | createMultipleServers, | ||
8 | doubleFollow, | ||
9 | PeerTubeServer, | ||
10 | setAccessTokensToServers, | ||
11 | waitJobs | ||
12 | } from '@shared/server-commands' | ||
13 | |||
14 | describe('Test audio only video transcoding', function () { | ||
15 | let servers: PeerTubeServer[] = [] | ||
16 | let videoUUID: string | ||
17 | let webVideoAudioFileUrl: string | ||
18 | let fragmentedAudioFileUrl: string | ||
19 | |||
20 | before(async function () { | ||
21 | this.timeout(120000) | ||
22 | |||
23 | const configOverride = { | ||
24 | transcoding: { | ||
25 | enabled: true, | ||
26 | resolutions: { | ||
27 | '0p': true, | ||
28 | '144p': false, | ||
29 | '240p': true, | ||
30 | '360p': false, | ||
31 | '480p': false, | ||
32 | '720p': false, | ||
33 | '1080p': false, | ||
34 | '1440p': false, | ||
35 | '2160p': false | ||
36 | }, | ||
37 | hls: { | ||
38 | enabled: true | ||
39 | }, | ||
40 | web_videos: { | ||
41 | enabled: true | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | servers = await createMultipleServers(2, configOverride) | ||
46 | |||
47 | // Get the access tokens | ||
48 | await setAccessTokensToServers(servers) | ||
49 | |||
50 | // Server 1 and server 2 follow each other | ||
51 | await doubleFollow(servers[0], servers[1]) | ||
52 | }) | ||
53 | |||
54 | it('Should upload a video and transcode it', async function () { | ||
55 | this.timeout(120000) | ||
56 | |||
57 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'audio only' } }) | ||
58 | videoUUID = uuid | ||
59 | |||
60 | await waitJobs(servers) | ||
61 | |||
62 | for (const server of servers) { | ||
63 | const video = await server.videos.get({ id: videoUUID }) | ||
64 | expect(video.streamingPlaylists).to.have.lengthOf(1) | ||
65 | |||
66 | for (const files of [ video.files, video.streamingPlaylists[0].files ]) { | ||
67 | expect(files).to.have.lengthOf(3) | ||
68 | expect(files[0].resolution.id).to.equal(720) | ||
69 | expect(files[1].resolution.id).to.equal(240) | ||
70 | expect(files[2].resolution.id).to.equal(0) | ||
71 | } | ||
72 | |||
73 | if (server.serverNumber === 1) { | ||
74 | webVideoAudioFileUrl = video.files[2].fileUrl | ||
75 | fragmentedAudioFileUrl = video.streamingPlaylists[0].files[2].fileUrl | ||
76 | } | ||
77 | } | ||
78 | }) | ||
79 | |||
80 | it('0p transcoded video should not have video', async function () { | ||
81 | const paths = [ | ||
82 | servers[0].servers.buildWebVideoFilePath(webVideoAudioFileUrl), | ||
83 | servers[0].servers.buildFragmentedFilePath(videoUUID, fragmentedAudioFileUrl) | ||
84 | ] | ||
85 | |||
86 | for (const path of paths) { | ||
87 | const { audioStream } = await getAudioStream(path) | ||
88 | expect(audioStream['codec_name']).to.be.equal('aac') | ||
89 | expect(audioStream['bit_rate']).to.be.at.most(384 * 8000) | ||
90 | |||
91 | const size = await getVideoStreamDimensionsInfo(path) | ||
92 | |||
93 | expect(size.height).to.equal(0) | ||
94 | expect(size.width).to.equal(0) | ||
95 | expect(size.isPortraitMode).to.be.false | ||
96 | expect(size.ratio).to.equal(0) | ||
97 | expect(size.resolution).to.equal(0) | ||
98 | } | ||
99 | }) | ||
100 | |||
101 | after(async function () { | ||
102 | await cleanupTests(servers) | ||
103 | }) | ||
104 | }) | ||