diff options
author | Chocobozzz <me@florianbigard.com> | 2022-11-14 11:39:01 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-11-14 11:39:01 +0100 |
commit | 44e702ded455c118f9908b70d25e7c7e5512abe9 (patch) | |
tree | 5e317cc235f8dd488dd0a5800ba531940c10269a /shared | |
parent | 4efa5535ccc947597b7a8e343d6665229ab9cfce (diff) | |
download | PeerTube-44e702ded455c118f9908b70d25e7c7e5512abe9.tar.gz PeerTube-44e702ded455c118f9908b70d25e7c7e5512abe9.tar.zst PeerTube-44e702ded455c118f9908b70d25e7c7e5512abe9.zip |
Prevent broken transcoding with audio only input
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/ffprobe.ts | 12 |
1 files changed, 10 insertions, 2 deletions
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 @@ | |||
1 | import { ffprobe, FfprobeData } from 'fluent-ffmpeg' | 1 | import { ffprobe, FfprobeData } from 'fluent-ffmpeg' |
2 | import { VideoFileMetadata } from '@shared/models/videos' | 2 | import { VideoFileMetadata, VideoResolution } from '@shared/models/videos' |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * | 5 | * |
@@ -103,7 +103,15 @@ function getMaxAudioBitrate (type: 'aac' | 'mp3' | string, bitrate: number) { | |||
103 | 103 | ||
104 | async function getVideoStreamDimensionsInfo (path: string, existingProbe?: FfprobeData) { | 104 | async function getVideoStreamDimensionsInfo (path: string, existingProbe?: FfprobeData) { |
105 | const videoStream = await getVideoStream(path, existingProbe) | 105 | const videoStream = await getVideoStream(path, existingProbe) |
106 | if (!videoStream) return undefined | 106 | if (!videoStream) { |
107 | return { | ||
108 | width: 0, | ||
109 | height: 0, | ||
110 | ratio: 0, | ||
111 | resolution: VideoResolution.H_NOVIDEO, | ||
112 | isPortraitMode: false | ||
113 | } | ||
114 | } | ||
107 | 115 | ||
108 | return { | 116 | return { |
109 | width: videoStream.width, | 117 | width: videoStream.width, |