Avidemux Forum

Avidemux => Windows => Topic started by: thoste on January 17, 2023, 08:07:40 AM

Title: How to find if a video is auto-rotated? Show real auto-rotate header field of MP4 ?
Post by: thoste on January 17, 2023, 08:07:40 AM
Assume I have a *.MP4 video with a resolution of 2400 x 1080 pixel or 1080 x 2040 pixel.

When I double click it the well known VLC video player on Windows plays it correctly in portrait mode.
When I load it into Avidemux then its somehow shown and loaded rotated by 90 deg to the left.

How do I find out if the MP4 video file really contains a header field with a auto-rotate value of 90 deg counterclockwise?

Is there a peek-into-video-header function in Avidemux?

If there is currently such a header value:
How can I auto-rotate the video (with minimum quality loss) in Avidemux by 90 deg clockwise and set the auto-rotate flag in header to 0 (=zero)?

Thomas

Title: Re: How to find if a video is auto-rotated? Show real auto-rotate header field of MP4 ?
Post by: eumagga0x2a on January 17, 2023, 11:29:42 PM
Quote from: thoste on January 17, 2023, 08:07:40 AMWhen I load it into Avidemux then its somehow shown and loaded rotated by 90 deg to the left.

By design, Avidemux shows videos as they are encoded, it doesn't apply any transformations.

Quote from: thoste on January 17, 2023, 08:07:40 AMHow do I find out if the MP4 video file really contains a header field with a auto-rotate value of 90 deg counterclockwise?

Rotation metadata is stored in MP4 containers as a display matrix in the track header ("tkhd" atom), it is always present. Avidemux doesn't evaluate it in any way, 36 bytes skipped right before reading 2 x 4 bytes used to store width and height (https://github.com/mean00/avidemux2/blob/e56094e917a72072d168d4f91191a9ff184c165f/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4Analyzer.cpp#L481) contain the matrix.