import { buildAbsoluteFixturePath, CLICommand } from '@shared/extra-utils'
import { VideoResolution } from '../../../shared/models/videos'
const expect = chai.expect
import { buildAbsoluteFixturePath, CLICommand } from '@shared/extra-utils'
import { VideoResolution } from '../../../shared/models/videos'
const expect = chai.expect
it('Should print the correct command for each resolution', async function () {
const fixturePath = buildAbsoluteFixturePath('video_short.webm')
it('Should print the correct command for each resolution', async function () {
const fixturePath = buildAbsoluteFixturePath('video_short.webm')
for (const resolution of [
VideoResolution.H_720P,
VideoResolution.H_1080P
]) {
const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`)
for (const resolution of [
VideoResolution.H_720P,
VideoResolution.H_1080P
]) {
const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`)
expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`)
expect(command).to.includes(`-y -acodec aac -vcodec libx264`)
expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`)
expect(command).to.includes(`-y -acodec aac -vcodec libx264`)
expect(command).to.includes('-r 25')
expect(command).to.includes('-level:v 3.1')
expect(command).to.includes('-g:v 50')
expect(command).to.includes('-r 25')
expect(command).to.includes('-level:v 3.1')
expect(command).to.includes('-g:v 50')
- expect(command).to.includes(`-maxrate ${targetBitrate}`)
- expect(command).to.includes(`-bufsize ${targetBitrate * 2}`)
+ expect(command).to.includes(`-maxrate `)
+ expect(command).to.includes(`-bufsize `)