aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-11-07 10:25:24 +0100
committerChocobozzz <me@florianbigard.com>2022-11-07 10:25:24 +0100
commita32bf8cd20212b903d3fa478e629f051eb77fecc (patch)
tree2a0372477ae2d76c31fc749054e78f1d067807d3 /server/lib
parent11ae7e2917ddf6e3c8e53d0855fd786163112d59 (diff)
downloadPeerTube-a32bf8cd20212b903d3fa478e629f051eb77fecc.tar.gz
PeerTube-a32bf8cd20212b903d3fa478e629f051eb77fecc.tar.zst
PeerTube-a32bf8cd20212b903d3fa478e629f051eb77fecc.zip
Fix running again transcoding on a video only file
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/job-queue/handlers/video-transcoding.ts5
-rw-r--r--server/lib/live/live-manager.ts6
-rw-r--r--server/lib/transcoding/transcoding.ts10
3 files changed, 13 insertions, 8 deletions
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index 48c675678..3e6d23363 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -13,7 +13,6 @@ import {
13 MergeAudioTranscodingPayload, 13 MergeAudioTranscodingPayload,
14 NewWebTorrentResolutionTranscodingPayload, 14 NewWebTorrentResolutionTranscodingPayload,
15 OptimizeTranscodingPayload, 15 OptimizeTranscodingPayload,
16 VideoResolution,
17 VideoTranscodingPayload 16 VideoTranscodingPayload
18} from '@shared/models' 17} from '@shared/models'
19import { retryTransactionWrapper } from '../../../helpers/database-utils' 18import { retryTransactionWrapper } from '../../../helpers/database-utils'
@@ -281,7 +280,7 @@ async function createLowerResolutionsJobs (options: {
281 280
282 // Create transcoding jobs if there are enabled resolutions 281 // Create transcoding jobs if there are enabled resolutions
283 const resolutionsEnabled = await Hooks.wrapObject( 282 const resolutionsEnabled = await Hooks.wrapObject(
284 computeResolutionsToTranscode({ input: videoFileResolution, type: 'vod', includeInput: false, strictLower: true }), 283 computeResolutionsToTranscode({ input: videoFileResolution, type: 'vod', includeInput: false, strictLower: true, hasAudio }),
285 'filter:transcoding.auto.resolutions-to-transcode.result', 284 'filter:transcoding.auto.resolutions-to-transcode.result',
286 options 285 options
287 ) 286 )
@@ -289,8 +288,6 @@ async function createLowerResolutionsJobs (options: {
289 const resolutionCreated: string[] = [] 288 const resolutionCreated: string[] = []
290 289
291 for (const resolution of resolutionsEnabled) { 290 for (const resolution of resolutionsEnabled) {
292 if (resolution === VideoResolution.H_NOVIDEO && hasAudio === false) continue
293
294 let dataInput: VideoTranscodingPayload 291 let dataInput: VideoTranscodingPayload
295 292
296 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED && type === 'webtorrent') { 293 if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED && type === 'webtorrent') {
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts
index 9470b530b..5e459f3c3 100644
--- a/server/lib/live/live-manager.ts
+++ b/server/lib/live/live-manager.ts
@@ -245,7 +245,7 @@ class LiveManager {
245 ) 245 )
246 246
247 const allResolutions = await Hooks.wrapObject( 247 const allResolutions = await Hooks.wrapObject(
248 this.buildAllResolutionsToTranscode(resolution), 248 this.buildAllResolutionsToTranscode(resolution, hasAudio),
249 'filter:transcoding.auto.resolutions-to-transcode.result', 249 'filter:transcoding.auto.resolutions-to-transcode.result',
250 { video } 250 { video }
251 ) 251 )
@@ -460,11 +460,11 @@ class LiveManager {
460 return join(directory, files.sort().reverse()[0]) 460 return join(directory, files.sort().reverse()[0])
461 } 461 }
462 462
463 private buildAllResolutionsToTranscode (originResolution: number) { 463 private buildAllResolutionsToTranscode (originResolution: number, hasAudio: boolean) {
464 const includeInput = CONFIG.LIVE.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION 464 const includeInput = CONFIG.LIVE.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION
465 465
466 const resolutionsEnabled = CONFIG.LIVE.TRANSCODING.ENABLED 466 const resolutionsEnabled = CONFIG.LIVE.TRANSCODING.ENABLED
467 ? computeResolutionsToTranscode({ input: originResolution, type: 'live', includeInput, strictLower: false }) 467 ? computeResolutionsToTranscode({ input: originResolution, type: 'live', includeInput, strictLower: false, hasAudio })
468 : [] 468 : []
469 469
470 if (resolutionsEnabled.length === 0) { 470 if (resolutionsEnabled.length === 0) {
diff --git a/server/lib/transcoding/transcoding.ts b/server/lib/transcoding/transcoding.ts
index d83c5419f..e6914db87 100644
--- a/server/lib/transcoding/transcoding.ts
+++ b/server/lib/transcoding/transcoding.ts
@@ -446,7 +446,15 @@ async function generateHlsPlaylistCommon (options: {
446function buildOriginalFileResolution (inputResolution: number) { 446function buildOriginalFileResolution (inputResolution: number) {
447 if (CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION === true) return toEven(inputResolution) 447 if (CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION === true) return toEven(inputResolution)
448 448
449 const resolutions = computeResolutionsToTranscode({ input: inputResolution, type: 'vod', includeInput: false, strictLower: false }) 449 const resolutions = computeResolutionsToTranscode({
450 input: inputResolution,
451 type: 'vod',
452 includeInput: false,
453 strictLower: false,
454 // We don't really care about the audio resolution in this context
455 hasAudio: true
456 })
457
450 if (resolutions.length === 0) return toEven(inputResolution) 458 if (resolutions.length === 0) return toEven(inputResolution)
451 459
452 return Math.max(...resolutions) 460 return Math.max(...resolutions)