X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fcli%2Fprint-transcode-command.ts;h=e2cca17f9365acaa35fe77f6c3a68a07ad380736;hb=dd6d2a7ce50e7ff02e00995ccc87f8f929ad9709;hp=3a7969e681884e4ef8cd7ae018b16495797c48c1;hpb=c4fa01f7c45b66b112ebd08abce744b7c4041feb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/cli/print-transcode-command.ts b/server/tests/cli/print-transcode-command.ts index 3a7969e68..e2cca17f9 100644 --- a/server/tests/cli/print-transcode-command.ts +++ b/server/tests/cli/print-transcode-command.ts @@ -3,16 +3,16 @@ import 'mocha' import * as chai from 'chai' 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 { getMaxBitrate } from '@shared/core-utils' +import { buildAbsoluteFixturePath, CLICommand } from '@shared/extra-utils' +import { VideoResolution } from '../../../shared/models/videos' const expect = chai.expect -describe('Test create transcoding jobs', function () { +describe('Test print transcode jobs', function () { it('Should print the correct command for each resolution', async function () { - const fixturePath = 'server/tests/fixtures/video_short.webm' + const fixturePath = buildAbsoluteFixturePath('video_short.webm') const fps = await getVideoFileFPS(fixturePath) const bitrate = await getVideoFileBitrate(fixturePath) @@ -21,7 +21,7 @@ describe('Test create transcoding jobs', function () { VideoResolution.H_1080P ]) { const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`) - const targetBitrate = Math.min(getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS), bitrate) + const targetBitrate = Math.min(getMaxBitrate({ resolution, fps, ratio: 16 / 9 }), bitrate + (bitrate * 0.3)) expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`) expect(command).to.includes(`-y -acodec aac -vcodec libx264`)