Fix sideways and squashed phone uploads: read FFmpeg's display matrix before you scale
TL;DR Portrait phone videos usually store landscape frames plus a display matrix that says "rotate on playback". We'll reproduce the three ways pipelines break it (wrong orientation from ffprobe , a landscape ladder that squashes portrait video, and TS stream copies that drop the matrix), then fix each one with a small Python helper and two FFmpeg rules. Tested on FFmpeg 6.1.1, hls.js 1.7.4,…
When recording a video with a smartphone held upright, it often stores landscape frames with a display matrix indicating a rotation. The most common issues arise when these videos are uploaded and processed through pipelines. This can result in the video playing sideways, being squashed into a widescreen box, or having incorrect thumbnails or container shapes. The original file plays fine in all situations, but something in the pipeline drops or misreads the rotation information.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to