aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-06-06 14:45:57 +0200
committerChocobozzz <me@florianbigard.com>2019-06-06 14:45:57 +0200
commitad3405d087b306efa5eb62a69c9b797b04eab4ce (patch)
treefd81a190cc0c5fe80a2d70465dcb4a4789b62a5f
parenta6dbbf03865a955caaedc3b12f3de3e386fe850f (diff)
downloadPeerTube-ad3405d087b306efa5eb62a69c9b797b04eab4ce.tar.gz
PeerTube-ad3405d087b306efa5eb62a69c9b797b04eab4ce.tar.zst
PeerTube-ad3405d087b306efa5eb62a69c9b797b04eab4ce.zip
Improve 4K video quality after transcoding
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts5
-rw-r--r--config/default.yaml1
-rw-r--r--config/production.yaml.example1
-rw-r--r--config/test.yaml1
-rw-r--r--server/controllers/api/videos/index.ts6
-rw-r--r--server/helpers/ffmpeg-utils.ts3
-rw-r--r--shared/extra-utils/server/follows.ts2
-rw-r--r--shared/models/videos/video-resolution.enum.ts10
-rw-r--r--support/docker/production/config/custom-environment-variables.yaml3
9 files changed, 22 insertions, 10 deletions
diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts
index adce1b2d4..ee6d2c489 100644
--- a/client/src/app/+admin/users/user-edit/user-edit.ts
+++ b/client/src/app/+admin/users/user-edit/user-edit.ts
@@ -7,7 +7,8 @@ import { UserAdminFlag } from '@shared/models/users/user-flag.model'
7export abstract class UserEdit extends FormReactive { 7export abstract class UserEdit extends FormReactive {
8 videoQuotaOptions: { value: string, label: string }[] = [] 8 videoQuotaOptions: { value: string, label: string }[] = []
9 videoQuotaDailyOptions: { value: string, label: string }[] = [] 9 videoQuotaDailyOptions: { value: string, label: string }[] = []
10 roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) 10 roles = Object.keys(USER_ROLE_LABELS)
11 .map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
11 username: string 12 username: string
12 userId: number 13 userId: number
13 14
@@ -27,7 +28,7 @@ export abstract class UserEdit extends FormReactive {
27 const transcodingConfig = this.serverService.getConfig().transcoding 28 const transcodingConfig = this.serverService.getConfig().transcoding
28 29
29 const resolutions = transcodingConfig.enabledResolutions 30 const resolutions = transcodingConfig.enabledResolutions
30 const higherResolution = VideoResolution.H_1080P 31 const higherResolution = VideoResolution.H_4K
31 let multiplier = 0 32 let multiplier = 0
32 33
33 for (const resolution of resolutions) { 34 for (const resolution of resolutions) {
diff --git a/config/default.yaml b/config/default.yaml
index fcbbf17e8..e4e2d2273 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -189,6 +189,7 @@ transcoding:
189 480p: false 189 480p: false
190 720p: false 190 720p: false
191 1080p: false 191 1080p: false
192 2160p: false
192 # /!\ EXPERIMENTAL /!\ 193 # /!\ EXPERIMENTAL /!\
193 # /!\ Requires ffmpeg >= 4 194 # /!\ Requires ffmpeg >= 4
194 # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent: 195 # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent:
diff --git a/config/production.yaml.example b/config/production.yaml.example
index 0ab99ac45..c025426bb 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -197,6 +197,7 @@ transcoding:
197 480p: false 197 480p: false
198 720p: false 198 720p: false
199 1080p: false 199 1080p: false
200 2160p: false
200 # /!\ EXPERIMENTAL /!\ 201 # /!\ EXPERIMENTAL /!\
201 # /!\ Requires ffmpeg >= 4 202 # /!\ Requires ffmpeg >= 4
202 # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent: 203 # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent:
diff --git a/config/test.yaml b/config/test.yaml
index 7dabe433c..8d3921614 100644
--- a/config/test.yaml
+++ b/config/test.yaml
@@ -63,6 +63,7 @@ transcoding:
63 480p: true 63 480p: true
64 720p: true 64 720p: true
65 1080p: true 65 1080p: true
66 2160p: true
66 hls: 67 hls:
67 enabled: true 68 enabled: true
68 69
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 40a2c972b..99900ca4a 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -205,11 +205,11 @@ async function addVideo (req: express.Request, res: express.Response) {
205 } 205 }
206 const videoFile = new VideoFileModel(videoFileData) 206 const videoFile = new VideoFileModel(videoFileData)
207 207
208 if (!videoFile.isAudio()) { 208 if (videoFile.isAudio()) {
209 videoFile.resolution = DEFAULT_AUDIO_RESOLUTION
210 } else {
209 videoFile.fps = await getVideoFileFPS(videoPhysicalFile.path) 211 videoFile.fps = await getVideoFileFPS(videoPhysicalFile.path)
210 videoFile.resolution = (await getVideoFileResolution(videoPhysicalFile.path)).videoFileResolution 212 videoFile.resolution = (await getVideoFileResolution(videoPhysicalFile.path)).videoFileResolution
211 } else {
212 videoFile.resolution = DEFAULT_AUDIO_RESOLUTION
213 } 213 }
214 214
215 // Move physical file 215 // Move physical file
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index c180da832..8041e7b3b 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -18,7 +18,8 @@ function computeResolutionsToTranscode (videoFileHeight: number) {
18 VideoResolution.H_360P, 18 VideoResolution.H_360P,
19 VideoResolution.H_720P, 19 VideoResolution.H_720P,
20 VideoResolution.H_240P, 20 VideoResolution.H_240P,
21 VideoResolution.H_1080P 21 VideoResolution.H_1080P,
22 VideoResolution.H_4K
22 ] 23 ]
23 24
24 for (const resolution of resolutions) { 25 for (const resolution of resolutions) {
diff --git a/shared/extra-utils/server/follows.ts b/shared/extra-utils/server/follows.ts
index 1505804de..68c5a2e2b 100644
--- a/shared/extra-utils/server/follows.ts
+++ b/shared/extra-utils/server/follows.ts
@@ -1,7 +1,7 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { ServerInfo } from './servers' 2import { ServerInfo } from './servers'
3import { waitJobs } from './jobs' 3import { waitJobs } from './jobs'
4import { makeGetRequest, makePostBodyRequest } from '..' 4import { makePostBodyRequest } from '../requests/requests'
5 5
6function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string, search?: string) { 6function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string, search?: string) {
7 const path = '/api/v1/server/followers' 7 const path = '/api/v1/server/followers'
diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts
index 7da5e7100..51efa2e8b 100644
--- a/shared/models/videos/video-resolution.enum.ts
+++ b/shared/models/videos/video-resolution.enum.ts
@@ -5,7 +5,8 @@ export enum VideoResolution {
5 H_360P = 360, 5 H_360P = 360,
6 H_480P = 480, 6 H_480P = 480,
7 H_720P = 720, 7 H_720P = 720,
8 H_1080P = 1080 8 H_1080P = 1080,
9 H_4K = 2160
9} 10}
10 11
11/** 12/**
@@ -33,11 +34,14 @@ function getBaseBitrate (resolution: VideoResolution) {
33 // quality according to Google Live Encoder: 1,500 - 4,000 Kbps 34 // quality according to Google Live Encoder: 1,500 - 4,000 Kbps
34 // Quality according to YouTube Video Info: 1752 Kbps 35 // Quality according to YouTube Video Info: 1752 Kbps
35 return 1750 * 1000 36 return 1750 * 1000
36 case VideoResolution.H_1080P: // fallthrough 37 case VideoResolution.H_1080P:
37 default:
38 // quality according to Google Live Encoder: 3000 - 6000 Kbps 38 // quality according to Google Live Encoder: 3000 - 6000 Kbps
39 // Quality according to YouTube Video Info: 3277 Kbps 39 // Quality according to YouTube Video Info: 3277 Kbps
40 return 3300 * 1000 40 return 3300 * 1000
41 case VideoResolution.H_4K: // fallthrough
42 default:
43 // quality according to Google Live Encoder: 13000 - 34000 Kbps
44 return 15000 * 1000
41 } 45 }
42} 46}
43 47
diff --git a/support/docker/production/config/custom-environment-variables.yaml b/support/docker/production/config/custom-environment-variables.yaml
index bd4ac1215..d5b878830 100644
--- a/support/docker/production/config/custom-environment-variables.yaml
+++ b/support/docker/production/config/custom-environment-variables.yaml
@@ -106,6 +106,9 @@ transcoding:
106 1080: 106 1080:
107 __name: "PEERTUBE_TRANSCODING_1080P" 107 __name: "PEERTUBE_TRANSCODING_1080P"
108 __format: "json" 108 __format: "json"
109 2160:
110 __name: "PEERTUBE_TRANSCODING_2160P"
111 __format: "json"
109 112
110instance: 113instance:
111 name: "PEERTUBE_INSTANCE_NAME" 114 name: "PEERTUBE_INSTANCE_NAME"