Improve 4K video quality after transcoding

pull/1913/head
Chocobozzz 2019-06-06 14:45:57 +02:00
parent a6dbbf0386
commit ad3405d087
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
9 changed files with 22 additions and 10 deletions

View File

@ -7,7 +7,8 @@ import { UserAdminFlag } from '@shared/models/users/user-flag.model'
export abstract class UserEdit extends FormReactive { export abstract class UserEdit extends FormReactive {
videoQuotaOptions: { value: string, label: string }[] = [] videoQuotaOptions: { value: string, label: string }[] = []
videoQuotaDailyOptions: { value: string, label: string }[] = [] videoQuotaDailyOptions: { value: string, label: string }[] = []
roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) roles = Object.keys(USER_ROLE_LABELS)
.map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
username: string username: string
userId: number userId: number
@ -27,7 +28,7 @@ export abstract class UserEdit extends FormReactive {
const transcodingConfig = this.serverService.getConfig().transcoding const transcodingConfig = this.serverService.getConfig().transcoding
const resolutions = transcodingConfig.enabledResolutions const resolutions = transcodingConfig.enabledResolutions
const higherResolution = VideoResolution.H_1080P const higherResolution = VideoResolution.H_4K
let multiplier = 0 let multiplier = 0
for (const resolution of resolutions) { for (const resolution of resolutions) {

View File

@ -189,6 +189,7 @@ transcoding:
480p: false 480p: false
720p: false 720p: false
1080p: false 1080p: false
2160p: false
# /!\ EXPERIMENTAL /!\ # /!\ EXPERIMENTAL /!\
# /!\ Requires ffmpeg >= 4 # /!\ Requires ffmpeg >= 4
# Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent: # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent:

View File

@ -197,6 +197,7 @@ transcoding:
480p: false 480p: false
720p: false 720p: false
1080p: false 1080p: false
2160p: false
# /!\ EXPERIMENTAL /!\ # /!\ EXPERIMENTAL /!\
# /!\ Requires ffmpeg >= 4 # /!\ Requires ffmpeg >= 4
# Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent: # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent:

View File

@ -63,6 +63,7 @@ transcoding:
480p: true 480p: true
720p: true 720p: true
1080p: true 1080p: true
2160p: true
hls: hls:
enabled: true enabled: true

View File

@ -205,11 +205,11 @@ async function addVideo (req: express.Request, res: express.Response) {
} }
const videoFile = new VideoFileModel(videoFileData) const videoFile = new VideoFileModel(videoFileData)
if (!videoFile.isAudio()) { if (videoFile.isAudio()) {
videoFile.resolution = DEFAULT_AUDIO_RESOLUTION
} else {
videoFile.fps = await getVideoFileFPS(videoPhysicalFile.path) videoFile.fps = await getVideoFileFPS(videoPhysicalFile.path)
videoFile.resolution = (await getVideoFileResolution(videoPhysicalFile.path)).videoFileResolution videoFile.resolution = (await getVideoFileResolution(videoPhysicalFile.path)).videoFileResolution
} else {
videoFile.resolution = DEFAULT_AUDIO_RESOLUTION
} }
// Move physical file // Move physical file

View File

@ -18,7 +18,8 @@ function computeResolutionsToTranscode (videoFileHeight: number) {
VideoResolution.H_360P, VideoResolution.H_360P,
VideoResolution.H_720P, VideoResolution.H_720P,
VideoResolution.H_240P, VideoResolution.H_240P,
VideoResolution.H_1080P VideoResolution.H_1080P,
VideoResolution.H_4K
] ]
for (const resolution of resolutions) { for (const resolution of resolutions) {

View File

@ -1,7 +1,7 @@
import * as request from 'supertest' import * as request from 'supertest'
import { ServerInfo } from './servers' import { ServerInfo } from './servers'
import { waitJobs } from './jobs' import { waitJobs } from './jobs'
import { makeGetRequest, makePostBodyRequest } from '..' import { makePostBodyRequest } from '../requests/requests'
function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string, search?: string) { function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string, search?: string) {
const path = '/api/v1/server/followers' const path = '/api/v1/server/followers'

View File

@ -5,7 +5,8 @@ export enum VideoResolution {
H_360P = 360, H_360P = 360,
H_480P = 480, H_480P = 480,
H_720P = 720, H_720P = 720,
H_1080P = 1080 H_1080P = 1080,
H_4K = 2160
} }
/** /**
@ -33,11 +34,14 @@ function getBaseBitrate (resolution: VideoResolution) {
// quality according to Google Live Encoder: 1,500 - 4,000 Kbps // quality according to Google Live Encoder: 1,500 - 4,000 Kbps
// Quality according to YouTube Video Info: 1752 Kbps // Quality according to YouTube Video Info: 1752 Kbps
return 1750 * 1000 return 1750 * 1000
case VideoResolution.H_1080P: // fallthrough case VideoResolution.H_1080P:
default:
// quality according to Google Live Encoder: 3000 - 6000 Kbps // quality according to Google Live Encoder: 3000 - 6000 Kbps
// Quality according to YouTube Video Info: 3277 Kbps // Quality according to YouTube Video Info: 3277 Kbps
return 3300 * 1000 return 3300 * 1000
case VideoResolution.H_4K: // fallthrough
default:
// quality according to Google Live Encoder: 13000 - 34000 Kbps
return 15000 * 1000
} }
} }

View File

@ -106,6 +106,9 @@ transcoding:
1080: 1080:
__name: "PEERTUBE_TRANSCODING_1080P" __name: "PEERTUBE_TRANSCODING_1080P"
__format: "json" __format: "json"
2160:
__name: "PEERTUBE_TRANSCODING_2160P"
__format: "json"
instance: instance:
name: "PEERTUBE_INSTANCE_NAME" name: "PEERTUBE_INSTANCE_NAME"