From 44e702ded455c118f9908b70d25e7c7e5512abe9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Nov 2022 11:39:01 +0100 Subject: Prevent broken transcoding with audio only input --- shared/extra-utils/ffprobe.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'shared') diff --git a/shared/extra-utils/ffprobe.ts b/shared/extra-utils/ffprobe.ts index b95202464..b8e9f4c18 100644 --- a/shared/extra-utils/ffprobe.ts +++ b/shared/extra-utils/ffprobe.ts @@ -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, -- cgit v1.2.3