Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aspect ratio broken after switching between different resolution/aspect ratio videos #6646

Closed
needz opened this issue Nov 13, 2019 · 6 comments
Assignees
Labels

Comments

@needz
Copy link

needz commented Nov 13, 2019

When switching from 720x576 16:9 aspect video (aspect2.ts) to 720x576 4:3 aspect video (aspect3.ts), the 4:3 aspect video is stretched on the sides and cannot be scaled by playerView.setResizeMode. Afterwards, after switching to 1280x720 16:9 aspect video (aspect1.ts), then again to 4:3 aspect video, the aspect ratio is fixed on the 4:3 aspect video, but if we then switch to 720x576 16:9 aspect video (aspect2.ts), the 16:9 video is squeezed and cannot be scaled by playerView.setResizeMode again. You can then switch it to 1280x720 16:9 video and back to fix it again.

  1. Run aspect2.ts, then switch to aspect3.ts
  2. Then switch to aspect1.ts, then switch back to aspect3.ts
  3. Then switch to aspect2.ts -> aspect1.ts -> aspect2.ts

2.10.7

Nexus Player, Sony Android TV, Fire TV although it works correctly on nVidia Shield TV somehow.

@ojw28
Copy link
Contributor

ojw28 commented Nov 15, 2019

Please can you more clearly describe each of the three cases, what happens, and importantly, what you expect to happen? It's not clear from the description above. It's also unclear what you're passing to PlayerView.setResizeMode, and what you're trying to achieve.

@ojw28 ojw28 self-assigned this Nov 15, 2019
@needz
Copy link
Author

needz commented Nov 15, 2019

@ojw28, first of all, everything is happening with default aspect ratio in Exoplayer (without setting any PlayerView.setResizeMode) and switching happens without going back to the video list - I am just zapping through videos.

  1. aspect3.ts transforms from 4:3 aspect to 16:9 format by stretching the picture from both sides, so the image is distorted. It must stay 4:3.
  2. In this step going to 1280x720 resolution video and then back corrects the situation.
  3. The 16:9 aspect video is squeezed from 16:9 to 4:3, which distorts the picture by making everything narrow. It must stay 16:9.

It seems that the scaling mode from previous video passes to a new video. It might happen because the resolution of both videos is 720x576, while aspect ratio differs.

Please let me know if it's still unclear, so I can make a video of how it should be and how it happens.

@ojw28
Copy link
Contributor

ojw28 commented Nov 15, 2019

Thanks! I can reproduce this. You're right - What's happening is that the two videos have the same resolution, but have different pixel aspect ratios. In MediaCodecVideoRenderer there's a new input format, but because the resolution is unchanged there's no format change on the output side of the decoder. This means that the new pixel aspect ratio isn't propagated correctly to the view, which means the view doesn't resize the Surface correctly.

@Samrobbo - I think the work you're doing in MediaCodecVideoRenderer should fix this bug. If you want something for testing, you can use the following in an exolist.json:

  {
    "name": "Test",
    "samples": [
      {
        "name": "Aspect ratio playlist",
        "playlist": [
          {
            "uri": "http://mvv.lt/exoplayer/aspect2.ts"
          },
          {
            "uri": "http://mvv.lt/exoplayer/aspect3.ts"
          },
          {
            "uri": "http://mvv.lt/exoplayer/aspect1.ts"
          },
          {
            "uri": "http://mvv.lt/exoplayer/aspect3.ts"
          },
          {
            "uri": "http://mvv.lt/exoplayer/aspect2.ts"
          },
          {
            "uri": "http://mvv.lt/exoplayer/aspect1.ts"
          },
          {
            "uri": "http://mvv.lt/exoplayer/aspect2.ts"
          }
        ]
      }
    ]
  },

@ojw28 ojw28 added bug and removed needs triage labels Nov 15, 2019
@ojw28 ojw28 removed their assignment Nov 17, 2019
ojw28 pushed a commit that referenced this issue Nov 22, 2019
For example, fix handling of pixel aspect ratio changes in
playlists where video resolution does not change.

Issue:#6646
PiperOrigin-RevId: 281276023
@andrewlewis
Copy link
Collaborator

Note: e26a61b appears to cause unexpected changes to the ordering of video renderer events so will be rolled back. We plan to investigate and hopefully submit a fixed version soon.

marcbaechinger pushed a commit that referenced this issue Dec 4, 2019
*** Original commit ***

Improve `Format` propagation within the `MediaCodecRenderer`.

For example, fix handling of pixel aspect ratio changes in
playlists where video resolution does not change.

Issue:#6646

***

PiperOrigin-RevId: 282903626
@needz
Copy link
Author

needz commented Dec 19, 2019

@ojw28, is there any chance you could look into this issue for the next update? It seems to cause various problems on chinese Android boxes, when switching videos with different resolution (not only aspect ratio). Thanks!

icbaker pushed a commit that referenced this issue Apr 27, 2020
Handles pixel aspect ratio changes in playlists where video
resolution does not change.

Issue:#6646
PiperOrigin-RevId: 307817028
@Samrobbo
Copy link
Contributor

Commit 37f0ff9 should have resolved this issue. Let me know if you experience any further issues with this.

@google google locked and limited conversation to collaborators Jul 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants