aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli/print-transcode-command.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-06 13:35:25 +0200
committerChocobozzz <me@florianbigard.com>2021-08-06 14:13:26 +0200
commit679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3 (patch)
tree03abf589275db05e5b1fa1c89f57049cd807324a /server/tests/cli/print-transcode-command.ts
parentc826f34a45757b324a20f71665b44ed10e6953b5 (diff)
downloadPeerTube-679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3.tar.gz
PeerTube-679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3.tar.zst
PeerTube-679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3.zip
Improve target bitrate calculation
Diffstat (limited to 'server/tests/cli/print-transcode-command.ts')
-rw-r--r--server/tests/cli/print-transcode-command.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/tests/cli/print-transcode-command.ts b/server/tests/cli/print-transcode-command.ts
index 3a7969e68..e328a6072 100644
--- a/server/tests/cli/print-transcode-command.ts
+++ b/server/tests/cli/print-transcode-command.ts
@@ -3,16 +3,16 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { getVideoFileBitrate, getVideoFileFPS } from '@server/helpers/ffprobe-utils' 5import { getVideoFileBitrate, getVideoFileFPS } from '@server/helpers/ffprobe-utils'
6import { CLICommand } from '@shared/extra-utils' 6import { getMaxBitrate } from '@shared/core-utils'
7import { getTargetBitrate, VideoResolution } from '../../../shared/models/videos' 7import { buildAbsoluteFixturePath, CLICommand } from '@shared/extra-utils'
8import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants' 8import { VideoResolution } from '../../../shared/models/videos'
9 9
10const expect = chai.expect 10const expect = chai.expect
11 11
12describe('Test create transcoding jobs', function () { 12describe('Test create transcoding jobs', function () {
13 13
14 it('Should print the correct command for each resolution', async function () { 14 it('Should print the correct command for each resolution', async function () {
15 const fixturePath = 'server/tests/fixtures/video_short.webm' 15 const fixturePath = buildAbsoluteFixturePath('video_short.webm')
16 const fps = await getVideoFileFPS(fixturePath) 16 const fps = await getVideoFileFPS(fixturePath)
17 const bitrate = await getVideoFileBitrate(fixturePath) 17 const bitrate = await getVideoFileBitrate(fixturePath)
18 18
@@ -21,7 +21,7 @@ describe('Test create transcoding jobs', function () {
21 VideoResolution.H_1080P 21 VideoResolution.H_1080P
22 ]) { 22 ]) {
23 const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`) 23 const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`)
24 const targetBitrate = Math.min(getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS), bitrate) 24 const targetBitrate = Math.min(getMaxBitrate({ resolution, fps, ratio: 16 / 9 }), bitrate)
25 25
26 expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`) 26 expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`)
27 expect(command).to.includes(`-y -acodec aac -vcodec libx264`) 27 expect(command).to.includes(`-y -acodec aac -vcodec libx264`)