[FFmpeg-trac] #9895(undetermined:new): Autorotate wrong direction for some android mp4 videos

FFmpeg trac at avcodec.org
Mon Aug 29 19:31:11 EEST 2022


#9895: Autorotate wrong direction for some android mp4 videos
-------------------------------------+-------------------------------------
             Reporter:  Taylor       |                    Owner:  (none)
  Hughes                             |
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Description changed by Taylor Hughes:

Old description:

> Summary of the bug: For some mp4 uploads from native android apps
> (probably using a weird and/or broken encoder), ffmpeg interprets the
> rotation differently from Chrome/Quicktime and autorotates the video
> incorrectly, despite the rotation/display matrix appearing correct via
> ffprobe.
>
> How to reproduce:
> Given video in this unusual format (attached) with rotation = 90
> ffmpeg -i upsidedown-original.mp4 -y upsidedown-out.mp4
> Upside down video results with rotation = 0
>
> Patches should be submitted to the ffmpeg-devel mailing list and not this
> bug tracker.

New description:

 Summary of the bug: For some mp4 uploads from native android apps
 (probably using a weird and/or broken encoder), ffmpeg interprets the
 rotation differently from Chrome/Quicktime and autorotates the video
 incorrectly, despite the rotation/display matrix appearing correct via
 ffprobe.

 How to reproduce:
 Given video in this unusual format (attached) with rotation = 90
 ffmpeg -i upsidedown-original.mp4 -y upsidedown-out.mp4
 Upside down video results with rotation = 0

 ffprobe output:
 {{{
 [STREAM]
 index=1
 codec_name=h264
 ...
 [SIDE_DATA]
 side_data_type=Display Matrix
 displaymatrix=
 00000000:            0      -65536           0
 00000001:        65536           0           0
 00000002:            0           0  1073741824

 rotation=90
 [/SIDE_DATA]
 [/STREAM]
 }}}

 but log indicates cclock instead of clock rotation for 90deg:

 {{{
 [transpose @ 0x149f0a260] Setting 'dir' to value 'cclock'
 }}}

 resulting output video thus appears 180deg from expectation

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9895#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list