]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/plugins/plugin-transcoding.ts
Merge branch 'release/4.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / plugins / plugin-transcoding.ts
index c14c34c7ec774dd22714d8ec805f8c1cb7e7da4f..ce1047388383176290e3133bfeaee3ebb898f418 100644 (file)
@@ -1,9 +1,8 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import 'mocha'
 import { expect } from 'chai'
-import { join } from 'path'
-import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils'
+import { getAudioStream, getVideoStreamFPS, getVideoStream } from '@server/helpers/ffmpeg'
+import { VideoPrivacy } from '@shared/models'
 import {
   cleanupTests,
   createSingleServer,
@@ -13,8 +12,7 @@ import {
   setDefaultVideoChannel,
   testFfmpegStreamError,
   waitJobs
-} from '@shared/extra-utils'
-import { VideoPrivacy } from '@shared/models'
+} from '@shared/server-commands'
 
 async function createLiveWrapper (server: PeerTubeServer) {
   const liveAttributes = {
@@ -93,7 +91,7 @@ describe('Test transcoding plugins', function () {
 
     async function checkLiveFPS (uuid: string, type: 'above' | 'below', fps: number) {
       const playlistUrl = `${server.url}/static/streaming-playlists/hls/${uuid}/0.m3u8`
-      const videoFPS = await getVideoFileFPS(playlistUrl)
+      const videoFPS = await getVideoStreamFPS(playlistUrl)
 
       if (type === 'above') {
         expect(videoFPS).to.be.above(fps)
@@ -247,11 +245,13 @@ describe('Test transcoding plugins', function () {
       const videoUUID = (await server.videos.quickUpload({ name: 'video', fixture: 'video_very_short_240p.mp4' })).uuid
       await waitJobs([ server ])
 
-      const path = server.servers.buildDirectory(join('videos', videoUUID + '-240.mp4'))
+      const video = await server.videos.get({ id: videoUUID })
+
+      const path = server.servers.buildWebTorrentFilePath(video.files[0].fileUrl)
       const audioProbe = await getAudioStream(path)
       expect(audioProbe.audioStream.codec_name).to.equal('opus')
 
-      const videoProbe = await getVideoStreamFromFile(path)
+      const videoProbe = await getVideoStream(path)
       expect(videoProbe.codec_name).to.equal('vp9')
     })
 
@@ -268,7 +268,7 @@ describe('Test transcoding plugins', function () {
       const audioProbe = await getAudioStream(playlistUrl)
       expect(audioProbe.audioStream.codec_name).to.equal('opus')
 
-      const videoProbe = await getVideoStreamFromFile(playlistUrl)
+      const videoProbe = await getVideoStream(playlistUrl)
       expect(videoProbe.codec_name).to.equal('h264')
     })
   })