mirror of
https://github.com/storytold/filmcraft.git
synced 2026-10-26 02:59:51 -06:00
Phones record portrait video as landscape pictures plus a rotation in the container: the MP4/MOV tkhd matrix (ISO/IEC 14496-12 §8.3.2) or the Matroska Projection pose roll (RFC 9559 §5.1.4.1.28.46). The matrix was parsed but never used, so every portrait iPhone clip imported sideways at its landscape size. - isobmff: Track::display_rotation() reads 0/90/180/270° from the matrix signs (mirrored / sheared matrices are left alone). - matroska: parse Projection (type, yaw, pitch, roll); VideoInfo::display_rotation() for rectangular projections. - frame: VideoFrame::rotated() turns every plane at its own resolution (4:2:2 chroma is widened to 4:4:4 for quarter turns) and swaps the PAR. - codecs: Mp4Source / MkvSource report the displayed size and PAR, and GopCache rotates decoded frames before caching them. - web: the WebCodecs source configures the decoder with the coded size and rotates its output the same way. Tests: a one-frame ProRes MOV built in the test with 0/90/180/270° matrices (reported size + which half ends up on top), plane rotation for RGBA / 4:2:0 / 4:2:2, and a synthetic Matroska file with a -90° roll. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>