aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/models/activitypub/actor.ts15
-rw-r--r--shared/models/videos/video-resolution.enum.ts22
2 files changed, 25 insertions, 12 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index 42a24b583..66a13b857 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -48,6 +48,7 @@ import {
48 MActorWithInboxes 48 MActorWithInboxes
49} from '../../typings/models' 49} from '../../typings/models'
50import * as Bluebird from 'bluebird' 50import * as Bluebird from 'bluebird'
51import { Op } from 'sequelize'
51 52
52enum ScopeNames { 53enum ScopeNames {
53 FULL = 'FULL' 54 FULL = 'FULL'
@@ -115,7 +116,19 @@ export const unusedActorAttributesForAPI = [
115 }, 116 },
116 { 117 {
117 fields: [ 'preferredUsername', 'serverId' ], 118 fields: [ 'preferredUsername', 'serverId' ],
118 unique: true 119 unique: true,
120 where: {
121 serverId: {
122 [Op.ne]: null
123 }
124 }
125 },
126 {
127 fields: [ 'preferredUsername' ],
128 unique: true,
129 where: {
130 serverId: null
131 }
119 }, 132 },
120 { 133 {
121 fields: [ 'inboxUrl', 'sharedInboxUrl' ] 134 fields: [ 'inboxUrl', 'sharedInboxUrl' ]
diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts
index dc53294f6..98ab3eed2 100644
--- a/shared/models/videos/video-resolution.enum.ts
+++ b/shared/models/videos/video-resolution.enum.ts
@@ -15,7 +15,7 @@ export enum VideoResolution {
15 * 15 *
16 * Sources for individual quality levels: 16 * Sources for individual quality levels:
17 * Google Live Encoder: https://support.google.com/youtube/answer/2853702?hl=en 17 * Google Live Encoder: https://support.google.com/youtube/answer/2853702?hl=en
18 * YouTube Video Info (tested with random music video): https://www.h3xed.com/blogmedia/youtube-info.php 18 * YouTube Video Info: youtube-dl --list-formats, with sample videos
19 */ 19 */
20function getBaseBitrate (resolution: VideoResolution) { 20function getBaseBitrate (resolution: VideoResolution) {
21 switch (resolution) { 21 switch (resolution) {
@@ -25,28 +25,28 @@ function getBaseBitrate (resolution: VideoResolution) {
25 25
26 case VideoResolution.H_240P: 26 case VideoResolution.H_240P:
27 // quality according to Google Live Encoder: 300 - 700 Kbps 27 // quality according to Google Live Encoder: 300 - 700 Kbps
28 // Quality according to YouTube Video Info: 186 Kbps 28 // Quality according to YouTube Video Info: 285 Kbps
29 return 250 * 1000 29 return 320 * 1000
30 30
31 case VideoResolution.H_360P: 31 case VideoResolution.H_360P:
32 // quality according to Google Live Encoder: 400 - 1,000 Kbps 32 // quality according to Google Live Encoder: 400 - 1,000 Kbps
33 // Quality according to YouTube Video Info: 480 Kbps 33 // Quality according to YouTube Video Info: 700 Kbps
34 return 500 * 1000 34 return 780 * 1000
35 35
36 case VideoResolution.H_480P: 36 case VideoResolution.H_480P:
37 // quality according to Google Live Encoder: 500 - 2,000 Kbps 37 // quality according to Google Live Encoder: 500 - 2,000 Kbps
38 // Quality according to YouTube Video Info: 879 Kbps 38 // Quality according to YouTube Video Info: 1300 Kbps
39 return 900 * 1000 39 return 1500 * 1000
40 40
41 case VideoResolution.H_720P: 41 case VideoResolution.H_720P:
42 // quality according to Google Live Encoder: 1,500 - 4,000 Kbps 42 // quality according to Google Live Encoder: 1,500 - 4,000 Kbps
43 // Quality according to YouTube Video Info: 1752 Kbps 43 // Quality according to YouTube Video Info: 2680 Kbps
44 return 1750 * 1000 44 return 2800 * 1000
45 45
46 case VideoResolution.H_1080P: 46 case VideoResolution.H_1080P:
47 // quality according to Google Live Encoder: 3000 - 6000 Kbps 47 // quality according to Google Live Encoder: 3000 - 6000 Kbps
48 // Quality according to YouTube Video Info: 3277 Kbps 48 // Quality according to YouTube Video Info: 5081 Kbps
49 return 3300 * 1000 49 return 5800 * 1000
50 50
51 case VideoResolution.H_4K: // fallthrough 51 case VideoResolution.H_4K: // fallthrough
52 default: 52 default: