import { FfprobeData } from 'fluent-ffmpeg'
import { omit } from 'lodash'
import { join } from 'path'
-import { Job } from '@shared/models'
import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
import {
flushAndRunMultipleServers,
generateHighBitrateVideo,
generateVideoWithFramerate,
- getJobsListPaginationAndSort,
getMyVideos,
getServerFileSize,
getVideo,
makeGetRequest,
ServerInfo,
setAccessTokensToServers,
- updateCustomSubConfig,
uploadVideo,
uploadVideoAndGetId,
waitJobs,
const expect = chai.expect
function updateConfigForTranscoding (server: ServerInfo) {
- return updateCustomSubConfig(server.url, server.accessToken, {
- transcoding: {
- enabled: true,
- allowAdditionalExtensions: true,
- allowAudioFiles: true,
- hls: { enabled: true },
- webtorrent: { enabled: true },
- resolutions: {
- '0p': false,
- '240p': true,
- '360p': true,
- '480p': true,
- '720p': true,
- '1080p': true,
- '1440p': true,
- '2160p': true
+ return server.configCommand.updateCustomSubConfig({
+ newConfig: {
+ transcoding: {
+ enabled: true,
+ allowAdditionalExtensions: true,
+ allowAudioFiles: true,
+ hls: { enabled: true },
+ webtorrent: { enabled: true },
+ resolutions: {
+ '0p': false,
+ '240p': true,
+ '360p': true,
+ '480p': true,
+ '720p': true,
+ '1080p': true,
+ '1440p': true,
+ '2160p': true
+ }
}
}
})
function runSuite (mode: 'legacy' | 'resumable') {
before(async function () {
- await updateCustomSubConfig(servers[1].url, servers[1].accessToken, {
- transcoding: {
- hls: { enabled: true },
- webtorrent: { enabled: true },
- resolutions: {
- '0p': false,
- '240p': false,
- '360p': false,
- '480p': false,
- '720p': false,
- '1080p': false,
- '1440p': false,
- '2160p': false
+ await servers[1].configCommand.updateCustomSubConfig({
+ newConfig: {
+ transcoding: {
+ hls: { enabled: true },
+ webtorrent: { enabled: true },
+ resolutions: {
+ '0p': false,
+ '240p': false,
+ '360p': false,
+ '480p': false,
+ '720p': false,
+ '1080p': false,
+ '1440p': false,
+ '2160p': false
+ }
}
}
})
it('Should upload an audio file and create an audio version only', async function () {
this.timeout(60_000)
- await updateCustomSubConfig(servers[1].url, servers[1].accessToken, {
- transcoding: {
- hls: { enabled: true },
- webtorrent: { enabled: true },
- resolutions: {
- '0p': true,
- '240p': false,
- '360p': false
+ await servers[1].configCommand.updateCustomSubConfig({
+ newConfig: {
+ transcoding: {
+ hls: { enabled: true },
+ webtorrent: { enabled: true },
+ resolutions: {
+ '0p': true,
+ '240p': false,
+ '360p': false
+ }
}
}
})
it('Should not transcode to an higher bitrate than the original file', async function () {
this.timeout(160_000)
- const config = {
+ const newConfig = {
transcoding: {
enabled: true,
resolutions: {
hls: { enabled: true }
}
}
- await updateCustomSubConfig(servers[1].url, servers[1].accessToken, config)
+ await servers[1].configCommand.updateCustomSubConfig({ newConfig })
const videoAttributes = {
name: 'low bitrate',
describe('Transcoding job queue', function () {
it('Should have the appropriate priorities for transcoding jobs', async function () {
- const res = await getJobsListPaginationAndSort({
- url: servers[1].url,
- accessToken: servers[1].accessToken,
+ const body = await servers[1].jobsCommand.getJobsList({
start: 0,
count: 100,
sort: '-createdAt',
jobType: 'video-transcoding'
})
- const jobs = res.body.data as Job[]
-
+ const jobs = body.data
const transcodingJobs = jobs.filter(j => j.data.videoUUID === video4k)
expect(transcodingJobs).to.have.lengthOf(14)