-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpresets.js
126 lines (118 loc) · 2.87 KB
/
presets.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
"use strict";
/**
* Video and Audio output presets
*/
module.exports = {
/**
* Preset for video scaling to a different resolution
*/
SCALE_PRESETS: {
/**
* 1080p video, Full HD
*
* fixed bitrate of 1500k, audio 2 channels 256k at 48KHz
*/
V1080: {
name: "1080",
videoBitrate: "3000k",
videoMaximumBitrate: "5000k",
videoBufferSize: "3000k",
videoScale: "-2:1080",
audioFrequency: 96000,
audioCodec: "aac",
audioChannels: 2,
audioBitrate: "384k"
},
/**
* 720p video, HD Ready
*
* fixed bitrate of 1500k, audio 2 channels 256k at 48KHz
*/
V720: {
name: "720",
videoBitrate: "1500k",
videoMaximumBitrate: "1500k",
videoBufferSize: "1000k",
videoScale: "-2:720",
audioFrequency: 48000,
audioCodec: "aac",
audioChannels: 2,
audioBitrate: "256k"
},
/**
* 540p video, Mobile Medium+ Bandwith
*
* fixed bitrate of 800k, audio 2 channels 128k at 44.1KHz
*/
V540: {
name: "540",
videoBitrate: "800k",
videoMaximumBitrate: "800k",
videoBufferSize: "500k",
videoScale: "-2:540",
audioFrequency: 44100,
audioCodec: "aac",
audioChannels: 2,
audioBitrate: "128k"
},
/**
* 480p video, Mobile Medium- Bandwith
*
* fixed bitrate of 600k, audio 2 channels 128k at 44.1KHz
*/
V480: {
name: "480",
videoBitrate: "600k",
videoMaximumBitrate: "800k",
videoBufferSize: "500k",
videoScale: "-2:480",
audioFrequency: 44100,
audioCodec: "aac",
audioChannels: 2,
audioBitrate: "128k"
},
/**
* 360p video, Mobile Low Bandwith
*
* fixed bitrate of 400k, audio 2 channels 128k at 22.05KHz
* */
V360: {
name: "360",
videoBitrate: "400k",
videoMaximumBitrate: "400k",
videoBufferSize: "400k",
videoScale: "-2:360",
audioFrequency: 22050,
audioCodec: "aac",
audioChannels: 2,
audioBitrate: "128k"
},
/**
* Select the preset to use according to
* - video vertical resolution
* - medium resolution
* In case the video height is less or equal to 360px, the V360 preset is returned
*/
auto: function(videoHeight) {
if (videoHeight >= 720) {
return this.V540;
} else if (videoHeight >= 540) {
return this.V480;
}
return this.V360;
},
exists: function(key) {
return this[key] !== undefined;
}
},
/**
* Default DASH streaming configuration
*
* uses a 3 seconds window
*/
DASH_DEFAULT: {
minBufferTime: 3, // seconds
segmentDuration: 3, // seconds
noAudio: false
}
};