aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/video-transcoder.ts30
1 files changed, 8 insertions, 22 deletions
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index 2a09e95bf..f67752d69 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -3,6 +3,7 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { getMaxBitrate } from '@shared/core-utils'
6import { 7import {
7 buildAbsoluteFixturePath, 8 buildAbsoluteFixturePath,
8 cleanupTests, 9 cleanupTests,
@@ -17,8 +18,7 @@ import {
17 waitJobs, 18 waitJobs,
18 webtorrentAdd 19 webtorrentAdd
19} from '@shared/extra-utils' 20} from '@shared/extra-utils'
20import { getMaxBitrate, HttpStatusCode, VideoResolution, VideoState } from '@shared/models' 21import { HttpStatusCode, VideoState } from '@shared/models'
21import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
22import { 22import {
23 canDoQuickTranscode, 23 canDoQuickTranscode,
24 getAudioStream, 24 getAudioStream,
@@ -191,15 +191,6 @@ describe('Test video transcoding', function () {
191 it('Should accept and transcode additional extensions', async function () { 191 it('Should accept and transcode additional extensions', async function () {
192 this.timeout(300_000) 192 this.timeout(300_000)
193 193
194 let tempFixturePath: string
195
196 {
197 tempFixturePath = await generateHighBitrateVideo()
198
199 const bitrate = await getVideoFileBitrate(tempFixturePath)
200 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 25, VIDEO_TRANSCODING_FPS))
201 }
202
203 for (const fixture of [ 'video_short.mkv', 'video_short.avi' ]) { 194 for (const fixture of [ 'video_short.mkv', 'video_short.avi' ]) {
204 const attributes = { 195 const attributes = {
205 name: fixture, 196 name: fixture,
@@ -555,14 +546,7 @@ describe('Test video transcoding', function () {
555 it('Should respect maximum bitrate values', async function () { 546 it('Should respect maximum bitrate values', async function () {
556 this.timeout(160_000) 547 this.timeout(160_000)
557 548
558 let tempFixturePath: string 549 const tempFixturePath = await generateHighBitrateVideo()
559
560 {
561 tempFixturePath = await generateHighBitrateVideo()
562
563 const bitrate = await getVideoFileBitrate(tempFixturePath)
564 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 25, VIDEO_TRANSCODING_FPS))
565 }
566 550
567 const attributes = { 551 const attributes = {
568 name: 'high bitrate video', 552 name: 'high bitrate video',
@@ -586,10 +570,12 @@ describe('Test video transcoding', function () {
586 570
587 const bitrate = await getVideoFileBitrate(path) 571 const bitrate = await getVideoFileBitrate(path)
588 const fps = await getVideoFileFPS(path) 572 const fps = await getVideoFileFPS(path)
589 const { videoFileResolution } = await getVideoFileResolution(path) 573 const dataResolution = await getVideoFileResolution(path)
574
575 expect(resolution).to.equal(resolution)
590 576
591 expect(videoFileResolution).to.equal(resolution) 577 const maxBitrate = getMaxBitrate({ ...dataResolution, fps })
592 expect(bitrate).to.be.below(getMaxBitrate(videoFileResolution, fps, VIDEO_TRANSCODING_FPS)) 578 expect(bitrate).to.be.below(maxBitrate)
593 } 579 }
594 } 580 }
595 }) 581 })