aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models
diff options
context:
space:
mode:
Diffstat (limited to 'shared/models')
-rw-r--r--shared/models/videos/video-resolution.enum.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts
index 13c0fe9a7..4d2644cc0 100644
--- a/shared/models/videos/video-resolution.enum.ts
+++ b/shared/models/videos/video-resolution.enum.ts
@@ -49,14 +49,16 @@ export function getTargetBitrate (resolution: VideoResolution, fps: number,
49 const baseBitrate = getBaseBitrate(resolution) 49 const baseBitrate = getBaseBitrate(resolution)
50 // The maximum bitrate, used when fps === VideoTranscodingFPS.MAX 50 // The maximum bitrate, used when fps === VideoTranscodingFPS.MAX
51 // Based on numbers from Youtube, 60 fps bitrate divided by 30 fps bitrate: 51 // Based on numbers from Youtube, 60 fps bitrate divided by 30 fps bitrate:
52 // 2600 / 1750 = 1.48571428571 52 // 720p: 2600 / 1750 = 1.48571428571
53 // 4400 / 3300 = 1.33333333333 53 // 1080p: 4400 / 3300 = 1.33333333333
54 const maxBitrate = baseBitrate * 1.4 54 const maxBitrate = baseBitrate * 1.4
55 const maxBitrateDifference = maxBitrate - baseBitrate 55 const maxBitrateDifference = maxBitrate - baseBitrate
56 const maxFpsDifference = fpsTranscodingConstants.MAX - fpsTranscodingConstants.AVERAGE 56 const maxFpsDifference = fpsTranscodingConstants.MAX - fpsTranscodingConstants.AVERAGE
57 // For 1080p video with default settings, this results in the following formula: 57 // For 1080p video with default settings, this results in the following formula:
58 // 3300 + (x - 30) * (1320/30) 58 // 3300 + (x - 30) * (1320/30)
59 // Example outputs: 1080p30: 3300 kbps, 1080p60: 4620 kbps, 720p30: 1750, 720p60: 2450 59 // Example outputs:
60 // 1080p10: 2420 kbps, 1080p30: 3300 kbps, 1080p60: 4620 kbps
61 // 720p10: 1283 kbps, 720p30: 1750 kbps, 720p60: 2450
60 return baseBitrate + (fps - fpsTranscodingConstants.AVERAGE) * (maxBitrateDifference / maxFpsDifference) 62 return baseBitrate + (fps - fpsTranscodingConstants.AVERAGE) * (maxBitrateDifference / maxFpsDifference)
61} 63}
62 64