aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/ffprobe.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-11-14 11:39:01 +0100
committerChocobozzz <me@florianbigard.com>2022-11-14 11:39:01 +0100
commit44e702ded455c118f9908b70d25e7c7e5512abe9 (patch)
tree5e317cc235f8dd488dd0a5800ba531940c10269a /shared/extra-utils/ffprobe.ts
parent4efa5535ccc947597b7a8e343d6665229ab9cfce (diff)
downloadPeerTube-44e702ded455c118f9908b70d25e7c7e5512abe9.tar.gz
PeerTube-44e702ded455c118f9908b70d25e7c7e5512abe9.tar.zst
PeerTube-44e702ded455c118f9908b70d25e7c7e5512abe9.zip
Prevent broken transcoding with audio only input
Diffstat (limited to 'shared/extra-utils/ffprobe.ts')
-rw-r--r--shared/extra-utils/ffprobe.ts12
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 @@
1import { ffprobe, FfprobeData } from 'fluent-ffmpeg' 1import { ffprobe, FfprobeData } from 'fluent-ffmpeg'
2import { VideoFileMetadata } from '@shared/models/videos' 2import { 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
104async function getVideoStreamDimensionsInfo (path: string, existingProbe?: FfprobeData) { 104async 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,