1 import { VideoTranscodingFPS } from './video-transcoding-fps.model'
3 export enum VideoResolution {
12 * Bitrate targets for different resolutions and frame rates, in bytes per second.
13 * Sources for individual quality levels:
14 * Google Live Encoder: https://support.google.com/youtube/answer/2853702?hl=en
15 * YouTube Video Info (tested with random music video): https://www.h3xed.com/blogmedia/youtube-info.php
17 export function getTargetBitrate (resolution: VideoResolution, fps: number,
18 fpsTranscodingConstants: VideoTranscodingFPS) {
20 case VideoResolution.H_240P:
21 // quality according to Google Live Encoder: 300 - 700 Kbps
22 // Quality according to YouTube Video Info: 186 Kbps
24 case VideoResolution.H_360P:
25 // quality according to Google Live Encoder: 400 - 1,000 Kbps
26 // Quality according to YouTube Video Info: 480 Kbps
28 case VideoResolution.H_480P:
29 // quality according to Google Live Encoder: 500 - 2,000 Kbps
30 // Quality according to YouTube Video Info: 879 Kbps
32 case VideoResolution.H_720P:
33 if (fps === fpsTranscodingConstants.MAX) {
34 // quality according to Google Live Encoder: 2,250 - 6,000 Kbps
35 // Quality according to YouTube Video Info: 2634 Kbps
39 // quality according to Google Live Encoder: 1,500 - 4,000 Kbps
40 // Quality according to YouTube Video Info: 1752 Kbps
42 case VideoResolution.H_1080P: // fallthrough
44 if (fps === fpsTranscodingConstants.MAX) {
45 // quality according to Google Live Encoder: 3000 - 6000 Kbps
46 // Quality according to YouTube Video Info: 4387 Kbps
50 // quality according to Google Live Encoder: 3000 - 6000 Kbps
51 // Quality according to YouTube Video Info: 3277 Kbps
57 * The maximum bitrate we expect to see on a transcoded video in bytes per second.
59 export function getMaxBitrate (resolution: VideoResolution, fps: number,
60 fpsTranscodingConstants: VideoTranscodingFPS) {
61 return getTargetBitrate(resolution, fps, fpsTranscodingConstants) * 2