+ const attributes = {
+ name: 'high bitrate video',
+ description: 'high bitrate video',
+ fixture: tempFixturePath
+ }
+
+ await servers[1].videos.upload({ attributes })
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const { data } = await server.videos.list()
+
+ const video = data.find(v => v.name === attributes.name)
+
+ for (const resolution of [ '240', '360', '480', '720', '1080' ]) {
+ const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4'))
+
+ const bitrate = await getVideoFileBitrate(path)
+ const fps = await getVideoFileFPS(path)
+ const resolution2 = await getVideoFileResolution(path)
+
+ expect(resolution2.videoFileResolution.toString()).to.equal(resolution)
+ expect(bitrate).to.be.below(getMaxBitrate(resolution2.videoFileResolution, fps, VIDEO_TRANSCODING_FPS))
+ }
+ }
+ })
+
+ it('Should not transcode to an higher bitrate than the original file', async function () {
+ this.timeout(160_000)
+
+ const newConfig = {
+ transcoding: {
+ enabled: true,
+ resolutions: {
+ '240p': true,
+ '360p': true,
+ '480p': true,
+ '720p': true,
+ '1080p': true,
+ '1440p': true,
+ '2160p': true
+ },
+ webtorrent: { enabled: true },
+ hls: { enabled: true }
+ }
+ }
+ await servers[1].config.updateCustomSubConfig({ newConfig })
+
+ const attributes = {
+ name: 'low bitrate',
+ fixture: 'low-bitrate.mp4'
+ }
+
+ const { uuid } = await servers[1].videos.upload({ attributes })
+
+ await waitJobs(servers)
+
+ const resolutions = [ 240, 360, 480, 720, 1080 ]
+ for (const r of resolutions) {
+ const path = `videos/${uuid}-${r}.mp4`
+ const size = await servers[1].servers.getServerFileSize(path)
+ expect(size, `${path} not below ${60_000}`).to.be.below(60_000)
+ }
+ })
+ })
+
+ describe('FFprobe', function () {
+
+ it('Should provide valid ffprobe data', async function () {
+ this.timeout(160_000)
+
+ const videoUUID = (await servers[1].videos.quickUpload({ name: 'ffprobe data' })).uuid
+ await waitJobs(servers)
+
+ {
+ const path = servers[1].servers.buildDirectory(join('videos', videoUUID + '-240.mp4'))
+ const metadata = await getMetadataFromFile(path)