1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Introduce CLI command

This commit is contained in:
Chocobozzz 2021-07-05 16:37:50 +02:00
parent a6a79eae0d
commit 329619b345
No known key found for this signature in database
GPG key ID: 583A612D890159BE
16 changed files with 94 additions and 138 deletions

View file

@ -2,14 +2,15 @@
import 'mocha'
import * as chai from 'chai'
import { execCLI } from '../../../shared/extra-utils'
import { getVideoFileBitrate, getVideoFileFPS } from '@server/helpers/ffprobe-utils'
import { CLICommand } from '@shared/extra-utils'
import { getTargetBitrate, VideoResolution } from '../../../shared/models/videos'
import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants'
import { getVideoFileBitrate, getVideoFileFPS } from '@server/helpers/ffprobe-utils'
const expect = chai.expect
describe('Test create transcoding jobs', function () {
it('Should print the correct command for each resolution', async function () {
const fixturePath = 'server/tests/fixtures/video_short.webm'
const fps = await getVideoFileFPS(fixturePath)
@ -19,7 +20,7 @@ describe('Test create transcoding jobs', function () {
VideoResolution.H_720P,
VideoResolution.H_1080P
]) {
const command = await execCLI(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`)
const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`)
const targetBitrate = Math.min(getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS), bitrate)
expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`)