Skip to content

Support reflective video transformations during ExoPlayer playback (e.g. from QuickTime/iOS MP4 files) #2012

Open

Description

@hust-twj

Version

Media3 main branch

More version details

No response

Devices that reproduce the issue

Any device, it seems have nothing to do with device

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

  1. Change media.exolist.json file -> "Playlists" -> "Cats -> Dogs"
  2. Replace its original uri with below:
    "https://zh-files.oss-cn-qingdao.aliyuncs.com/20170808223928mJ1P3n57.mp4","https://wx-love-img.afunapp.com/ec34db03f040ee1cfb9cfef5c087aaf3"
    In fact, the two urls above are all rotated -90 degree
    screenshot-20250103-104814

Expected result

And the weird thing is, for "https://zh-files.oss-cn-qingdao.aliyuncs.com/20170808223928mJ1P3n57.mp4",the video frame is OK
for "https://wx-love-img.afunapp.com/ec34db03f040ee1cfb9cfef5c087aaf3", the video frame is not OK, it rotates -90 degree. It should like this:
screenshot-20250103-105024

Actual result

for "https://wx-love-img.afunapp.com/ec34db03f040ee1cfb9cfef5c087aaf3" , the video frame rotate -90 degree, like this
image

Media

The reproducible url:"https://wx-love-img.afunapp.com/ec34db03f040ee1cfb9cfef5c087aaf3"

Bug Report

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

Activity

  1. claincly commented on Jan 3, 2025

    @claincly
    Contributor

    @rohitjoins I feel this could be related to extractors not parsing the correct rotation? Could you take a look?

  2. hust-twj commented on Jan 6, 2025

    @hust-twj
    Author

    @rohitjoins I feel this could be related to extractors not parsing the correct rotation? Could you take a look?

    @claincly @rohitjoins Thanks in advance.

  3. rohitjoins commented on Jan 16, 2025

    @rohitjoins
    Contributor

    Hi @hust-twj,

    Thank you for your patience. I investigated the media in question and found that its transformation matrix is not purely rotational, it also involves flipping. Our current implementation assumes that the transformation matrix only represents rotation, which is why it doesn’t handle this case correctly.

    Tools like ffmpeg, mediainfo, or even media players like VLC use a mathematical formula to calculate rotation based on the assumption that the transformation matrix is purely rotational. In this case, that assumption doesn’t hold, leading to incorrect rotation values and ultimately displaying the wrong output since the video should also be flipped.

    I’ll mark this issue as a feature request to add support for flipping using the transformation matrix. Thanks for reporting this!

    Here’s a comparison of VLC (incorrect) vs. QuickTime (correct):

    Image
  4. icbaker commented on Jun 16, 2025

    @icbaker
    Collaborator

    The commit linked above makes ExoPlayer behave like VLC - so these videos are now the right way up, but still incorrectly mirrored in the y-axis. Resolving the mirroring issue is a bit more complicated. I will re-title this issue to reflect that's what it's tracking.

  5. changed the title [-]Video frame rotates -90 degree[/-] [+]Support reflective video transformations during ExoPlayer playback (e.g. from QuickTime/iOS MP4 files)[/+] on Jun 16, 2025
  6. xxoo commented on Jan 9, 2026

    @xxoo

    This webm is transformed with ffmpeg:

    ffmpeg -display_rotation 90 -display_hflip -i 01.webm -codec copy 02.webm
    02.webm

    It looks like this in chrome:

    Image

    But ExoPlayer does not seem to respect the meta orientation:

    Image
  7. added a commit that references this issue on Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions