print-transcode-command.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
  2. import 'mocha'
  3. import * as chai from 'chai'
  4. import { buildAbsoluteFixturePath } from '@shared/core-utils'
  5. import { CLICommand } from '@shared/server-commands'
  6. import { VideoResolution } from '../../../shared/models/videos'
  7. const expect = chai.expect
  8. describe('Test print transcode jobs', function () {
  9. it('Should print the correct command for each resolution', async function () {
  10. const fixturePath = buildAbsoluteFixturePath('video_short.webm')
  11. for (const resolution of [
  12. VideoResolution.H_720P,
  13. VideoResolution.H_1080P
  14. ]) {
  15. const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`)
  16. expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`)
  17. expect(command).to.includes(`-y -acodec aac -vcodec libx264`)
  18. expect(command).to.includes('-f mp4')
  19. expect(command).to.includes('-movflags faststart')
  20. expect(command).to.includes('-b:a 256k')
  21. expect(command).to.includes('-r 25')
  22. expect(command).to.includes('-level:v 3.1')
  23. expect(command).to.includes('-g:v 50')
  24. expect(command).to.includes(`-maxrate `)
  25. expect(command).to.includes(`-bufsize `)
  26. }
  27. })
  28. })