]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
add tests for inputOptions and videoFilters in trancode plugins
authorThéo Le Calvar <tlc@kher.nl>
Tue, 6 Apr 2021 13:12:38 +0000 (15:12 +0200)
committerChocobozzz <chocobozzz@cpy.re>
Fri, 9 Apr 2021 13:53:18 +0000 (15:53 +0200)
server/tests/fixtures/peertube-plugin-test-transcoding-one/main.js
server/tests/plugins/plugin-transcoding.ts

index 5990ce1cee2e42b7dd41cdb62f8b05303c82066b..366b827a94d04af0dcda39c8986a08d37d6c9ce4 100644 (file)
@@ -12,6 +12,30 @@ async function register ({ transcodingManager }) {
     transcodingManager.addVODProfile('libx264', 'low-vod', builder)
   }
 
+  {
+    const builder = () => {
+      return {
+        videoFilters: [
+          'fps=10'
+        ]
+      }
+    }
+
+    transcodingManager.addVODProfile('libx264', 'video-filters-vod', builder)
+  }
+
+  {
+    const builder = () => {
+      return {
+        inputOptions: [
+          '-r 5'
+        ]
+      }
+    }
+
+    transcodingManager.addVODProfile('libx264', 'input-options-vod', builder)
+  }
+
   {
     const builder = (options) => {
       return {
@@ -23,8 +47,21 @@ async function register ({ transcodingManager }) {
 
     transcodingManager.addLiveProfile('libx264', 'low-live', builder)
   }
+
+  {
+    const builder = () => {
+      return {
+        inputOptions: [
+          '-r 5'
+        ]
+      }
+    }
+
+    transcodingManager.addLiveProfile('libx264', 'input-options-live', builder)
+  }
 }
 
+
 async function unregister () {
   return
 }
index ecea21e694d3f3eab434481c70925df8631ecc08..415705ca1773913c2295f1449998c6e3075aef7e 100644 (file)
@@ -119,8 +119,8 @@ describe('Test transcoding plugins', function () {
       const res = await getConfig(server.url)
       const config = res.body as ServerConfig
 
-      expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod' ])
-      expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live' ])
+      expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'video-filters-vod', 'input-options-vod' ])
+      expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live' ])
     })
 
     it('Should not use the plugin profile if not chosen by the admin', async function () {
@@ -143,6 +143,28 @@ describe('Test transcoding plugins', function () {
       await checkVideoFPS(videoUUID, 'below', 12)
     })
 
+    it('Should apply video filters in vod profile', async function () {
+      this.timeout(120000)
+
+      await updateConf(server, 'video-filters-vod', 'default')
+
+      const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid
+      await waitJobs([ server ])
+
+      await checkVideoFPS(videoUUID, 'below', 12)
+    })
+
+    it('Should apply input options in vod profile', async function () {
+      this.timeout(120000)
+
+      await updateConf(server, 'input-options-vod', 'default')
+
+      const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid
+      await waitJobs([ server ])
+
+      await checkVideoFPS(videoUUID, 'below', 6)
+    })
+
     it('Should not use the plugin profile if not chosen by the admin', async function () {
       this.timeout(120000)
 
@@ -169,6 +191,20 @@ describe('Test transcoding plugins', function () {
       await checkLiveFPS(liveVideoId, 'below', 12)
     })
 
+    it('Should apply the input options on live profile', async function () {
+      this.timeout(120000)
+
+      await updateConf(server, 'low-vod', 'input-options-live')
+
+      const liveVideoId = await createLiveWrapper(server)
+
+      await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm')
+      await waitUntilLivePublished(server.url, server.accessToken, liveVideoId)
+      await waitJobs([ server ])
+
+      await checkLiveFPS(liveVideoId, 'below', 6)
+    })
+
     it('Should default to the default profile if the specified profile does not exist', async function () {
       this.timeout(120000)