- 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)
+ const file = video.files.find(f => f.resolution.id === r)
+
+ const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl)
+ const bitrate = await getVideoFileBitrate(path)
+
+ const inputBitrate = 60_000
+ const limit = getMinLimitBitrate({ fps: 10, ratio: 1, resolution: r })
+ let belowValue = Math.max(inputBitrate, limit)
+ belowValue += belowValue * 0.20 // Apply 20% margin because bitrate control is not very precise
+
+ expect(bitrate, `${path} not below ${limit}`).to.be.below(belowValue)