2021-01-09 16:07:22 -05:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
|
|
|
|
|
2022-08-17 09:44:32 -04:00
|
|
|
import { expect } from 'chai'
|
2021-12-17 05:58:15 -05:00
|
|
|
import { buildAbsoluteFixturePath } from '@shared/core-utils'
|
|
|
|
import { CLICommand } from '@shared/server-commands'
|
2021-08-06 07:35:25 -04:00
|
|
|
import { VideoResolution } from '../../../shared/models/videos'
|
2021-01-09 16:07:22 -05:00
|
|
|
|
2021-10-12 03:18:54 -04:00
|
|
|
describe('Test print transcode jobs', function () {
|
2021-07-05 10:37:50 -04:00
|
|
|
|
2021-01-09 16:07:22 -05:00
|
|
|
it('Should print the correct command for each resolution', async function () {
|
2021-08-06 07:35:25 -04:00
|
|
|
const fixturePath = buildAbsoluteFixturePath('video_short.webm')
|
2021-01-09 16:07:22 -05:00
|
|
|
|
|
|
|
for (const resolution of [
|
|
|
|
VideoResolution.H_720P,
|
|
|
|
VideoResolution.H_1080P
|
|
|
|
]) {
|
2021-07-05 10:37:50 -04:00
|
|
|
const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`)
|
2021-01-09 16:07:22 -05:00
|
|
|
|
2021-04-09 09:51:15 -04:00
|
|
|
expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`)
|
|
|
|
expect(command).to.includes(`-y -acodec aac -vcodec libx264`)
|
2021-01-09 16:07:22 -05:00
|
|
|
expect(command).to.includes('-f mp4')
|
|
|
|
expect(command).to.includes('-movflags faststart')
|
|
|
|
expect(command).to.includes('-b:a 256k')
|
|
|
|
expect(command).to.includes('-r 25')
|
|
|
|
expect(command).to.includes('-level:v 3.1')
|
|
|
|
expect(command).to.includes('-g:v 50')
|
2022-08-09 08:46:49 -04:00
|
|
|
expect(command).to.includes(`-maxrate:v `)
|
|
|
|
expect(command).to.includes(`-bufsize:v `)
|
2021-01-09 16:07:22 -05:00
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|