X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fplugins%2Fplugin-transcoding.ts;h=c834b6985bf306c340e5f4fb8823f27449d2fb19;hb=a60696ab185406700a5277edae54016b0add7b89;hp=90ef01b92c52e7e8690de2b6fa476bceb7f01dae;hpb=b3eafc5fc5ffbb12089845ffe5da0329adb70093;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index 90ef01b92..c834b6985 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts @@ -15,6 +15,7 @@ import { sendRTMPStreamInVideo, setAccessTokensToServers, setDefaultVideoChannel, + testFfmpegStreamError, uninstallPlugin, updateCustomSubConfig, uploadVideoAndGetId, @@ -119,8 +120,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', 'input-options-vod', 'bad-scale-vod' ]) + expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live', 'bad-scale-live' ]) }) it('Should not use the plugin profile if not chosen by the admin', async function () { @@ -143,6 +144,33 @@ describe('Test transcoding plugins', function () { 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 apply the scale filter in vod profile', async function () { + this.timeout(120000) + + await updateConf(server, 'bad-scale-vod', 'default') + + const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid + await waitJobs([ server ]) + + // Transcoding failed + const res = await getVideo(server.url, videoUUID) + const video: VideoDetails = res.body + + expect(video.files).to.have.lengthOf(1) + expect(video.streamingPlaylists).to.have.lengthOf(0) + }) + it('Should not use the plugin profile if not chosen by the admin', async function () { this.timeout(120000) @@ -169,6 +197,31 @@ 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 apply the scale filter name on live profile', async function () { + this.timeout(120000) + + await updateConf(server, 'low-vod', 'bad-scale-live') + + const liveVideoId = await createLiveWrapper(server) + + const command = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') + await testFfmpegStreamError(command, true) + }) + it('Should default to the default profile if the specified profile does not exist', async function () { this.timeout(120000) @@ -203,10 +256,10 @@ describe('Test transcoding plugins', function () { it('Should use the new vod encoders', async function () { this.timeout(240000) - const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid + const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video', fixture: 'video_short_240p.mp4' })).uuid await waitJobs([ server ]) - const path = buildServerDirectory(server, join('videos', videoUUID + '-720.mp4')) + const path = buildServerDirectory(server, join('videos', videoUUID + '-240.mp4')) const audioProbe = await getAudioStream(path) expect(audioProbe.audioStream.codec_name).to.equal('opus')