aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-03 16:03:52 +0200
committerChocobozzz <me@florianbigard.com>2020-08-03 16:03:52 +0200
commitdca0fe12ec2e47be51884c4eb05ebe6f358cb9de (patch)
tree19a9b5d905a6eaccda680b14e1b86b43577ca29d /server
parent2045b572233d1ee81fb1c14e33fc22b805cd7230 (diff)
downloadPeerTube-dca0fe12ec2e47be51884c4eb05ebe6f358cb9de.tar.gz
PeerTube-dca0fe12ec2e47be51884c4eb05ebe6f358cb9de.tar.zst
PeerTube-dca0fe12ec2e47be51884c4eb05ebe6f358cb9de.zip
Fix resolution for portrait videos
Diffstat (limited to 'server')
-rw-r--r--server/helpers/ffmpeg-utils.ts4
-rw-r--r--server/lib/job-queue/handlers/video-transcoding.ts9
2 files changed, 7 insertions, 6 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index 0cfc51775..7bfd5d44a 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -74,7 +74,7 @@ namespace audio {
74 } 74 }
75} 75}
76 76
77function computeResolutionsToTranscode (videoFileHeight: number) { 77function computeResolutionsToTranscode (videoFileResolution: number) {
78 const resolutionsEnabled: number[] = [] 78 const resolutionsEnabled: number[] = []
79 const configResolutions = CONFIG.TRANSCODING.RESOLUTIONS 79 const configResolutions = CONFIG.TRANSCODING.RESOLUTIONS
80 80
@@ -90,7 +90,7 @@ function computeResolutionsToTranscode (videoFileHeight: number) {
90 ] 90 ]
91 91
92 for (const resolution of resolutions) { 92 for (const resolution of resolutions) {
93 if (configResolutions[resolution + 'p'] === true && videoFileHeight > resolution) { 93 if (configResolutions[resolution + 'p'] === true && videoFileResolution > resolution) {
94 resolutionsEnabled.push(resolution) 94 resolutionsEnabled.push(resolution)
95 } 95 }
96 } 96 }
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index ce1c419e7..7ebef46b4 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -75,7 +75,7 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: O
75 if (videoArg === undefined) return undefined 75 if (videoArg === undefined) return undefined
76 76
77 // Outside the transaction (IO on disk) 77 // Outside the transaction (IO on disk)
78 const { videoFileResolution } = await videoArg.getMaxQualityResolution() 78 const { videoFileResolution, isPortraitMode } = await videoArg.getMaxQualityResolution()
79 79
80 const { videoDatabase, videoPublished } = await sequelizeTypescript.transaction(async t => { 80 const { videoDatabase, videoPublished } = await sequelizeTypescript.transaction(async t => {
81 // Maybe the video changed in database, refresh it 81 // Maybe the video changed in database, refresh it
@@ -86,7 +86,7 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: O
86 // Create transcoding jobs if there are enabled resolutions 86 // Create transcoding jobs if there are enabled resolutions
87 const resolutionsEnabled = computeResolutionsToTranscode(videoFileResolution) 87 const resolutionsEnabled = computeResolutionsToTranscode(videoFileResolution)
88 logger.info( 88 logger.info(
89 'Resolutions computed for video %s and origin file height of %d.', videoDatabase.uuid, videoFileResolution, 89 'Resolutions computed for video %s and origin file resolution of %d.', videoDatabase.uuid, videoFileResolution,
90 { resolutions: resolutionsEnabled } 90 { resolutions: resolutionsEnabled }
91 ) 91 )
92 92
@@ -104,14 +104,15 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: O
104 dataInput = { 104 dataInput = {
105 type: 'new-resolution' as 'new-resolution', 105 type: 'new-resolution' as 'new-resolution',
106 videoUUID: videoDatabase.uuid, 106 videoUUID: videoDatabase.uuid,
107 resolution 107 resolution,
108 isPortraitMode
108 } 109 }
109 } else if (CONFIG.TRANSCODING.HLS.ENABLED) { 110 } else if (CONFIG.TRANSCODING.HLS.ENABLED) {
110 dataInput = { 111 dataInput = {
111 type: 'hls', 112 type: 'hls',
112 videoUUID: videoDatabase.uuid, 113 videoUUID: videoDatabase.uuid,
113 resolution, 114 resolution,
114 isPortraitMode: false, 115 isPortraitMode,
115 copyCodecs: false 116 copyCodecs: false
116 } 117 }
117 } 118 }