diff options
author | Felix Ableitner <me@nutomic.com> | 2018-10-09 18:22:35 -0500 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-17 10:05:17 +0200 |
commit | e243c38c356b5cfd8ba1783f19389a99dc5cf527 (patch) | |
tree | ba7af3be71b1a13b8f5de5273776cac32c666dc4 /shared/models | |
parent | 7f196c9320ab010fcf659dbf819d83dded5eeb7f (diff) | |
download | PeerTube-e243c38c356b5cfd8ba1783f19389a99dc5cf527.tar.gz PeerTube-e243c38c356b5cfd8ba1783f19389a99dc5cf527.tar.zst PeerTube-e243c38c356b5cfd8ba1783f19389a99dc5cf527.zip |
better documentation
Diffstat (limited to 'shared/models')
-rw-r--r-- | shared/models/videos/video-resolution.enum.ts | 8 |
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 | ||