import 'mocha'
import * as chai from 'chai'
import { omit } from 'lodash'
+import { getMaxBitrate } from '@shared/core-utils'
import {
buildAbsoluteFixturePath,
cleanupTests,
doubleFollow,
generateHighBitrateVideo,
generateVideoWithFramerate,
- getFileSize,
makeGetRequest,
PeerTubeServer,
setAccessTokensToServers,
waitJobs,
webtorrentAdd
} from '@shared/extra-utils'
-import { getMaxBitrate, HttpStatusCode, VideoResolution, VideoState } from '@shared/models'
-import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
+import { HttpStatusCode, VideoState } from '@shared/models'
import {
canDoQuickTranscode,
getAudioStream,
it('Should accept and transcode additional extensions', async function () {
this.timeout(300_000)
- let tempFixturePath: string
-
- {
- tempFixturePath = await generateHighBitrateVideo()
-
- const bitrate = await getVideoFileBitrate(tempFixturePath)
- expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 25, VIDEO_TRANSCODING_FPS))
- }
-
for (const fixture of [ 'video_short.mkv', 'video_short.avi' ]) {
const attributes = {
name: fixture,
it('Should respect maximum bitrate values', async function () {
this.timeout(160_000)
- let tempFixturePath: string
-
- {
- tempFixturePath = await generateHighBitrateVideo()
-
- const bitrate = await getVideoFileBitrate(tempFixturePath)
- expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 25, VIDEO_TRANSCODING_FPS))
- }
+ const tempFixturePath = await generateHighBitrateVideo()
const attributes = {
name: 'high bitrate video',
const bitrate = await getVideoFileBitrate(path)
const fps = await getVideoFileFPS(path)
- const { videoFileResolution } = await getVideoFileResolution(path)
+ const dataResolution = await getVideoFileResolution(path)
+
+ expect(resolution).to.equal(resolution)
- expect(videoFileResolution).to.equal(resolution)
- expect(bitrate).to.be.below(getMaxBitrate(videoFileResolution, fps, VIDEO_TRANSCODING_FPS))
+ const maxBitrate = getMaxBitrate({ ...dataResolution, fps })
+ expect(bitrate).to.be.below(maxBitrate)
}
}
})
const file = video.files.find(f => f.resolution.id === r)
const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl)
- const size = await getFileSize(path)
- expect(size, `${path} not below ${60_000}`).to.be.below(60_000)
+ const bitrate = await getVideoFileBitrate(path)
+ expect(bitrate, `${path} not below ${60_000}`).to.be.below(60_000)
}
})
})
describe('Transcoding job queue', function () {
it('Should have the appropriate priorities for transcoding jobs', async function () {
- const body = await servers[1].jobs.getJobsList({
+ const body = await servers[1].jobs.list({
start: 0,
count: 100,
sort: '-createdAt',