aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-23 10:57:55 +0100
committerChocobozzz <me@florianbigard.com>2021-12-23 10:57:55 +0100
commit482b26231b4e39234f107b8400ef606c5f003c55 (patch)
tree1a50f292b77b9b297f0885867da9f20c02582706 /server/lib/job-queue
parentc7c6afc66d7611d4c02572d63801beca26c45204 (diff)
downloadPeerTube-482b26231b4e39234f107b8400ef606c5f003c55.tar.gz
PeerTube-482b26231b4e39234f107b8400ef606c5f003c55.tar.zst
PeerTube-482b26231b4e39234f107b8400ef606c5f003c55.zip
Fix audio only transcoding
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r--server/lib/job-queue/handlers/video-import.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts
index e5730e746..11ccd47ed 100644
--- a/server/lib/job-queue/handlers/video-import.ts
+++ b/server/lib/job-queue/handlers/video-import.ts
@@ -21,9 +21,9 @@ import {
21 VideoImportYoutubeDLPayloadType, 21 VideoImportYoutubeDLPayloadType,
22 VideoState 22 VideoState
23} from '../../../../shared' 23} from '../../../../shared'
24import { VideoImportState } from '../../../../shared/models/videos' 24import { VideoImportState, VideoResolution } from '../../../../shared/models/videos'
25import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' 25import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
26import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils' 26import { ffprobePromise, getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils'
27import { logger } from '../../../helpers/logger' 27import { logger } from '../../../helpers/logger'
28import { getSecureTorrentName } from '../../../helpers/utils' 28import { getSecureTorrentName } from '../../../helpers/utils'
29import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' 29import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent'
@@ -36,6 +36,7 @@ import { MThumbnail } from '../../../types/models/video/thumbnail'
36import { federateVideoIfNeeded } from '../../activitypub/videos' 36import { federateVideoIfNeeded } from '../../activitypub/videos'
37import { Notifier } from '../../notifier' 37import { Notifier } from '../../notifier'
38import { generateVideoMiniature } from '../../thumbnail' 38import { generateVideoMiniature } from '../../thumbnail'
39import { isAudioFile } from '@shared/extra-utils'
39 40
40async function processVideoImport (job: Job) { 41async function processVideoImport (job: Job) {
41 const payload = job.data as VideoImportPayload 42 const payload = job.data as VideoImportPayload
@@ -114,9 +115,14 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVid
114 throw new Error('The user video quota is exceeded with this video to import.') 115 throw new Error('The user video quota is exceeded with this video to import.')
115 } 116 }
116 117
117 const { resolution } = await getVideoFileResolution(tempVideoPath) 118 const probe = await ffprobePromise(tempVideoPath)
118 const fps = await getVideoFileFPS(tempVideoPath) 119
119 const duration = await getDurationFromVideoFile(tempVideoPath) 120 const { resolution } = await isAudioFile(tempVideoPath, probe)
121 ? await getVideoFileResolution(tempVideoPath)
122 : { resolution: VideoResolution.H_NOVIDEO }
123
124 const fps = await getVideoFileFPS(tempVideoPath, probe)
125 const duration = await getDurationFromVideoFile(tempVideoPath, probe)
120 126
121 // Prepare video file object for creation in database 127 // Prepare video file object for creation in database
122 const fileExt = getLowercaseExtension(tempVideoPath) 128 const fileExt = getLowercaseExtension(tempVideoPath)