Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Force re-encode if there are rotation info

Chocobozzze339ec3f29a6
diff --git a/packages/ffmpeg/src/ffmpeg-default-transcoding-profile.ts b/packages/ffmpeg/src/ffmpeg-default-transcoding-profile.ts
index 4925331b23..9ad32baf52 100644
--- a/packages/ffmpeg/src/ffmpeg-default-transcoding-profile.ts
+++ b/packages/ffmpeg/src/ffmpeg-default-transcoding-profile.ts
@@ -147,6 +147,8 @@ export async function canDoQuickVideoTranscode (path: string, maxFPS: number, pr
if (videoStream['pix_fmt'] !== 'yuv420p') return false
if (fps < 2 || fps > maxFPS) return false
if (bitRate > getMaxTheoreticalBitrate({ ...resolutionData, fps })) return false
+ // Force a re-encode when the input has a Display Matrix rotation to apply into the pixels
+ if (resolutionData.hasRotation) return false
return true
}
diff --git a/packages/ffmpeg/src/ffprobe.ts b/packages/ffmpeg/src/ffprobe.ts
index bedb077b26..67adf6c300 100644
--- a/packages/ffmpeg/src/ffprobe.ts
+++ b/packages/ffmpeg/src/ffprobe.ts
@@ -149,7 +149,8 @@ export async function getVideoStreamDimensionsInfo (path: string, existingProbe?
height: videoStream.height,
ratio: buildAspectRatio({ width: videoStream.width, height: videoStream.height }),
resolution: Math.min(videoStream.height, videoStream.width),
- isPortraitMode: videoStream.height > videoStream.width
+ isPortraitMode: videoStream.height > videoStream.width,
+ hasRotation: rotation !== undefined && rotation !== '0'
}
}