1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Fix resolution for portrait videos

This commit is contained in:
Chocobozzz 2018-02-27 15:57:28 +01:00
parent 6fdc553adb
commit 056aa7f2b4
No known key found for this signature in database
GPG key ID: 583A612D890159BE
5 changed files with 27 additions and 19 deletions

View file

@ -11,7 +11,8 @@ import { JobQueue } from '../job-queue'
export type VideoFilePayload = {
videoUUID: string
resolution?: VideoResolution
resolution?: VideoResolution,
isPortraitMode?: boolean
}
async function processVideoFile (job: kue.Job) {
@ -27,7 +28,7 @@ async function processVideoFile (job: kue.Job) {
// Transcoding in other resolution
if (payload.resolution) {
await video.transcodeOriginalVideofile(payload.resolution)
await video.transcodeOriginalVideofile(payload.resolution, payload.isPortraitMode)
await onVideoFileTranscoderSuccess(video)
} else {
await video.optimizeOriginalVideofile()
@ -66,12 +67,12 @@ async function onVideoFileOptimizerSuccess (video: VideoModel) {
await shareVideoByServerAndChannel(video, undefined)
}
const originalFileHeight = await videoDatabase.getOriginalFileHeight()
const { videoFileResolution } = await videoDatabase.getOriginalFileResolution()
// Create transcoding jobs if there are enabled resolutions
const resolutionsEnabled = computeResolutionsToTranscode(originalFileHeight)
const resolutionsEnabled = computeResolutionsToTranscode(videoFileResolution)
logger.info(
'Resolutions computed for video %s and origin file height of %d.', videoDatabase.uuid, originalFileHeight,
'Resolutions computed for video %s and origin file height of %d.', videoDatabase.uuid, videoFileResolution,
{ resolutions: resolutionsEnabled }
)