aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/transcoding/transcoder.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/transcoding/transcoder.ts')
-rw-r--r--server/tests/api/transcoding/transcoder.ts27
1 files changed, 11 insertions, 16 deletions
diff --git a/server/tests/api/transcoding/transcoder.ts b/server/tests/api/transcoding/transcoder.ts
index c591f5f6f..fa78b58bb 100644
--- a/server/tests/api/transcoding/transcoder.ts
+++ b/server/tests/api/transcoding/transcoder.ts
@@ -1,18 +1,18 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { canDoQuickTranscode } from '@server/helpers/ffmpeg' 4import { canDoQuickTranscode } from '@server/lib/transcoding/transcoding-quick-transcode'
5import { generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared' 5import { checkWebTorrentWorks, generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared'
6import { buildAbsoluteFixturePath, getAllFiles, getMaxBitrate, getMinLimitBitrate, omit } from '@shared/core-utils' 6import { buildAbsoluteFixturePath, getAllFiles, getMaxBitrate, getMinLimitBitrate, omit } from '@shared/core-utils'
7import { 7import {
8 buildFileMetadata, 8 ffprobePromise,
9 getAudioStream, 9 getAudioStream,
10 getVideoStreamBitrate, 10 getVideoStreamBitrate,
11 getVideoStreamDimensionsInfo, 11 getVideoStreamDimensionsInfo,
12 getVideoStreamFPS, 12 getVideoStreamFPS,
13 hasAudioStream 13 hasAudioStream
14} from '@shared/extra-utils' 14} from '@shared/ffmpeg'
15import { HttpStatusCode, VideoState } from '@shared/models' 15import { HttpStatusCode, VideoFileMetadata, VideoState } from '@shared/models'
16import { 16import {
17 cleanupTests, 17 cleanupTests,
18 createMultipleServers, 18 createMultipleServers,
@@ -20,8 +20,7 @@ import {
20 makeGetRequest, 20 makeGetRequest,
21 PeerTubeServer, 21 PeerTubeServer,
22 setAccessTokensToServers, 22 setAccessTokensToServers,
23 waitJobs, 23 waitJobs
24 webtorrentAdd
25} from '@shared/server-commands' 24} from '@shared/server-commands'
26 25
27function updateConfigForTranscoding (server: PeerTubeServer) { 26function updateConfigForTranscoding (server: PeerTubeServer) {
@@ -90,10 +89,7 @@ describe('Test video transcoding', function () {
90 const magnetUri = videoDetails.files[0].magnetUri 89 const magnetUri = videoDetails.files[0].magnetUri
91 expect(magnetUri).to.match(/\.webm/) 90 expect(magnetUri).to.match(/\.webm/)
92 91
93 const torrent = await webtorrentAdd(magnetUri, true) 92 await checkWebTorrentWorks(magnetUri, /\.webm$/)
94 expect(torrent.files).to.be.an('array')
95 expect(torrent.files.length).to.equal(1)
96 expect(torrent.files[0].path).match(/\.webm$/)
97 } 93 }
98 }) 94 })
99 95
@@ -120,10 +116,7 @@ describe('Test video transcoding', function () {
120 const magnetUri = videoDetails.files[0].magnetUri 116 const magnetUri = videoDetails.files[0].magnetUri
121 expect(magnetUri).to.match(/\.mp4/) 117 expect(magnetUri).to.match(/\.mp4/)
122 118
123 const torrent = await webtorrentAdd(magnetUri, true) 119 await checkWebTorrentWorks(magnetUri, /\.mp4$/)
124 expect(torrent.files).to.be.an('array')
125 expect(torrent.files.length).to.equal(1)
126 expect(torrent.files[0].path).match(/\.mp4$/)
127 } 120 }
128 }) 121 })
129 122
@@ -639,7 +632,9 @@ describe('Test video transcoding', function () {
639 const video = await servers[1].videos.get({ id: videoUUID }) 632 const video = await servers[1].videos.get({ id: videoUUID })
640 const file = video.files.find(f => f.resolution.id === 240) 633 const file = video.files.find(f => f.resolution.id === 240)
641 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 634 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl)
642 const metadata = await buildFileMetadata(path) 635
636 const probe = await ffprobePromise(path)
637 const metadata = new VideoFileMetadata(probe)
643 638
644 // expected format properties 639 // expected format properties
645 for (const p of [ 640 for (const p of [