aboutsummaryrefslogtreecommitdiffhomepage
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
parent4efa5535ccc947597b7a8e343d6665229ab9cfce (diff)
downloadPeerTube-44e702ded455c118f9908b70d25e7c7e5512abe9.tar.gz
PeerTube-44e702ded455c118f9908b70d25e7c7e5512abe9.tar.zst
PeerTube-44e702ded455c118f9908b70d25e7c7e5512abe9.zip
Prevent broken transcoding with audio only input
-rw-r--r--server/controllers/api/videos/transcoding.ts2
-rw-r--r--shared/extra-utils/ffprobe.ts12
2 files changed, 12 insertions, 2 deletions
diff --git a/server/controllers/api/videos/transcoding.ts b/server/controllers/api/videos/transcoding.ts
index a39e47dfe..8c9a5322b 100644
--- a/server/controllers/api/videos/transcoding.ts
+++ b/server/controllers/api/videos/transcoding.ts
@@ -49,6 +49,8 @@ async function createTranscoding (req: express.Request, res: express.Response) {
49 49
50 const childrenResolutions = resolutions.filter(r => r !== maxResolution) 50 const childrenResolutions = resolutions.filter(r => r !== maxResolution)
51 51
52 logger.info('Manually creating transcoding jobs for %s.', body.transcodingType, { childrenResolutions, maxResolution })
53
52 const children = await Bluebird.mapSeries(childrenResolutions, resolution => { 54 const children = await Bluebird.mapSeries(childrenResolutions, resolution => {
53 if (body.transcodingType === 'hls') { 55 if (body.transcodingType === 'hls') {
54 return buildHLSJobOption({ 56 return buildHLSJobOption({
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,