]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Prevent broken transcoding with audio only input
authorChocobozzz <me@florianbigard.com>
Mon, 14 Nov 2022 10:39:01 +0000 (11:39 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 14 Nov 2022 10:39:01 +0000 (11:39 +0100)
server/controllers/api/videos/transcoding.ts
shared/extra-utils/ffprobe.ts

index a39e47dfe4cbbb178a779bff95363757860cb97e..8c9a5322b78a29b7f15efd3aa6cba59eec5950fc 100644 (file)
@@ -49,6 +49,8 @@ async function createTranscoding (req: express.Request, res: express.Response) {
 
   const childrenResolutions = resolutions.filter(r => r !== maxResolution)
 
+  logger.info('Manually creating transcoding jobs for %s.', body.transcodingType, { childrenResolutions, maxResolution })
+
   const children = await Bluebird.mapSeries(childrenResolutions, resolution => {
     if (body.transcodingType === 'hls') {
       return buildHLSJobOption({
index b95202464f105c7af4236a17364ad894d0cdf901..b8e9f4c1805a11c149ceb8046bad9ff579301ade 100644 (file)
@@ -1,5 +1,5 @@
 import { ffprobe, FfprobeData } from 'fluent-ffmpeg'
-import { VideoFileMetadata } from '@shared/models/videos'
+import { VideoFileMetadata, VideoResolution } from '@shared/models/videos'
 
 /**
  *
@@ -103,7 +103,15 @@ function getMaxAudioBitrate (type: 'aac' | 'mp3' | string, bitrate: number) {
 
 async function getVideoStreamDimensionsInfo (path: string, existingProbe?: FfprobeData) {
   const videoStream = await getVideoStream(path, existingProbe)
-  if (!videoStream) return undefined
+  if (!videoStream) {
+    return {
+      width: 0,
+      height: 0,
+      ratio: 0,
+      resolution: VideoResolution.H_NOVIDEO,
+      isPortraitMode: false
+    }
+  }
 
   return {
     width: videoStream.width,