From b02f1aec303d6b85b61995dd74418ce70a26e405 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 21 Oct 2024 16:29:59 +0200 Subject: [PATCH] Fix detecting video stream rotation --- packages/ffmpeg/src/ffprobe.ts | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/packages/ffmpeg/src/ffprobe.ts b/packages/ffmpeg/src/ffprobe.ts index d18401586..6c1c53988 100644 --- a/packages/ffmpeg/src/ffprobe.ts +++ b/packages/ffmpeg/src/ffprobe.ts @@ -1,6 +1,6 @@ -import ffmpeg, { FfprobeData } from 'fluent-ffmpeg' import { buildAspectRatio, forceNumber } from '@peertube/peertube-core-utils' import { VideoResolution } from '@peertube/peertube-models' +import ffmpeg, { FfprobeData } from 'fluent-ffmpeg' /** * @@ -114,7 +114,11 @@ async function getVideoStreamDimensionsInfo (path: string, existingProbe?: Ffpro } } - if (videoStream.rotation === '90' || videoStream.rotation === '-90') { + const rotation = videoStream.rotation + ? videoStream.rotation + '' + : undefined + + if (rotation === '90' || rotation === '-90') { const width = videoStream.width videoStream.width = videoStream.height videoStream.height = width @@ -205,16 +209,19 @@ async function getChaptersFromContainer (options: { // --------------------------------------------------------------------------- export { - getVideoStreamDimensionsInfo, - getChaptersFromContainer, - getMaxAudioBitrate, - getVideoStream, - getVideoStreamDuration, - getAudioStream, - getVideoStreamFPS, - isAudioFile, ffprobePromise, + getAudioStream, + getChaptersFromContainer, + + getMaxAudioBitrate, + + getVideoStream, getVideoStreamBitrate, + getVideoStreamDimensionsInfo, + getVideoStreamDuration, + getVideoStreamFPS, hasAudioStream, - hasVideoStream + + hasVideoStream, + isAudioFile }