ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Wrong aspect ratio on a Samsung Galaxy Note 10.1 (SM-P601)

Open hiteshgupta33 opened this issue 10 years ago • 36 comments

@martinbonnin
Hi

After this fix, at least my videos started playing but the video is whole distorted from the bottom as if the video is corrupted.

The same video plays fine with the native Media player.

Here are some of the details for the same:

Device : Samsung 10.1 (SM-P601) API Level: 4.4.2 We are using MAIN PROFILE with 200k to 800k bit rate. But this is happening with all the devices, checked with Asus 7 as well.

hiteshgupta33 avatar Sep 04 '14 10:09 hiteshgupta33

please edit this ticket and include as many details as possible like:

  • device you are testing with
  • api level
  • dimensions of the video, H264 level
  • screenshot
  • etc

If you can share your url, it would be even better.

martinbonnin avatar Sep 04 '14 10:09 martinbonnin

@martinbonnin ok, i will share them soon....

hiteshgupta33 avatar Sep 04 '14 11:09 hiteshgupta33

@martinbonnin i have edited it here is a sample url we are using: http://vod.hdi.cdn.ril.com/vod/definst/smil:hdivod/4/284/0_y74kwawj.smil/playlist.m3u8

besides this am getting dropped Frames. Here is log for the same:

09-04 17:43:47.311: W/AHierarchicalStateMachine(4304): Warning message AMessage(what = 'omx ', target = 7) = { 09-04 17:43:47.311: W/AHierarchicalStateMachine(4304): int32_t type = 0 09-04 17:43:47.311: W/AHierarchicalStateMachine(4304): void *node = 0x18a 09-04 17:43:47.311: W/AHierarchicalStateMachine(4304): int32_t event = 3 09-04 17:43:47.311: W/AHierarchicalStateMachine(4304): int32_t data1 = 1 09-04 17:43:47.311: W/AHierarchicalStateMachine(4304): int32_t data2 = 117440527 09-04 17:43:47.311: W/AHierarchicalStateMachine(4304): } unhandled in root state. 09-04 17:43:47.721: I/ACodec(4304): [OMX.Exynos.avc.dec] Now Executing 09-04 17:43:47.791: D/EventLogger(4304): droppedFrames [67.01, 1] 09-04 17:43:47.791: D/EventLogger(4304): droppedFrames [67.01, 1] 09-04 17:43:47.806: D/EventLogger(4304): droppedFrames [67.02, 1] 09-04 17:43:47.816: D/EventLogger(4304): droppedFrames [67.03, 1] 09-04 17:43:47.826: D/EventLogger(4304): droppedFrames [67.04, 1] 09-04 17:43:47.836: D/EventLogger(4304): droppedFrames [67.06, 1] 09-04 17:43:47.851: D/EventLogger(4304): droppedFrames [67.07, 1] 09-04 17:43:47.856: D/EventLogger(4304): droppedFrames [67.07, 1] 09-04 17:43:47.871: D/EventLogger(4304): droppedFrames [67.09, 1] 09-04 17:43:47.881: D/EventLogger(4304): droppedFrames [67.10, 1] 09-04 17:43:47.891: D/EventLogger(4304): droppedFrames [67.11, 1] 09-04 17:43:47.901: D/EventLogger(4304): droppedFrames [67.12, 1] 09-04 17:43:47.911: D/EventLogger(4304): droppedFrames [67.13, 1] 09-04 17:43:47.921: D/EventLogger(4304): droppedFrames [67.14, 1] 09-04 17:43:47.931: D/EventLogger(4304): droppedFrames [67.15, 1] 09-04 17:43:47.941: D/EventLogger(4304): droppedFrames [67.16, 1] 09-04 17:43:47.951: D/EventLogger(4304): droppedFrames [67.17, 1] 09-04 17:43:47.961: D/EventLogger(4304): droppedFrames [67.18, 1] 09-04 17:43:47.971: D/EventLogger(4304): droppedFrames [67.19, 1] 09-04 17:43:47.981: D/EventLogger(4304): droppedFrames [67.20, 1] 09-04 17:43:47.991: D/EventLogger(4304): droppedFrames [67.21, 1] 09-04 17:43:48.001: D/EventLogger(4304): droppedFrames [67.22, 1] 09-04 17:43:48.011: D/EventLogger(4304): droppedFrames [67.23, 1] 09-04 17:43:48.021: D/EventLogger(4304): droppedFrames [67.24, 1] 09-04 17:43:48.036: D/EventLogger(4304): droppedFrames [67.25, 1] 09-04 17:43:48.046: D/EventLogger(4304): droppedFrames [67.26, 1] 09-04 17:43:48.056: D/EventLogger(4304): droppedFrames [67.27, 1] 09-04 17:43:48.076: D/EventLogger(4304): droppedFrames [67.29, 1] 09-04 17:43:48.086: D/EventLogger(4304): droppedFrames [67.30, 1] 09-04 17:43:48.096: D/EventLogger(4304): droppedFrames [67.32, 1] 09-04 17:43:48.106: D/EventLogger(4304): droppedFrames [67.32, 1] 09-04 17:43:48.121: D/EventLogger(4304): droppedFrames [67.34, 1] 09-04 17:43:48.131: D/EventLogger(4304): droppedFrames [67.35, 1] 09-04 17:43:48.141: D/EventLogger(4304): droppedFrames [67.36, 1] 09-04 17:43:48.151: D/EventLogger(4304): droppedFrames [67.37, 1] 09-04 17:43:48.171: D/EventLogger(4304): droppedFrames [67.39, 1] 09-04 17:43:48.176: D/EventLogger(4304): droppedFrames [67.39, 1] 09-04 17:43:48.191: D/EventLogger(4304): droppedFrames [67.41, 1] 09-04 17:43:48.201: D/EventLogger(4304): droppedFrames [67.42, 1] 09-04 17:43:48.211: D/EventLogger(4304): droppedFrames [67.43, 1] 09-04 17:43:48.221: D/EventLogger(4304): droppedFrames [67.44, 1] 09-04 17:43:48.231: D/EventLogger(4304): droppedFrames [67.45, 1] 09-04 17:43:48.241: D/EventLogger(4304): droppedFrames [67.46, 1] 09-04 17:43:48.251: D/EventLogger(4304): droppedFrames [67.47, 1] 09-04 17:43:48.261: D/EventLogger(4304): droppedFrames [67.48, 1] 09-04 17:43:48.271: D/EventLogger(4304): droppedFrames [67.49, 1] 09-04 17:43:48.291: D/EventLogger(4304): droppedFrames [67.51, 1] 09-04 17:43:48.301: D/EventLogger(4304): droppedFrames [67.52, 1] 09-04 17:43:48.311: D/EventLogger(4304): droppedFrames [67.53, 1] 09-04 17:43:48.316: D/EventLogger(4304): droppedFrames [67.54, 1] 09-04 17:43:48.326: D/EventLogger(4304): droppedFrames [67.54, 1] 09-04 17:43:48.341: D/EventLogger(4304): droppedFrames [67.56, 1] 09-04 17:43:48.351: D/EventLogger(4304): droppedFrames [67.57, 1] 09-04 17:43:48.371: D/EventLogger(4304): droppedFrames [67.59, 1] 09-04 17:43:48.371: D/EventLogger(4304): droppedFrames [67.59, 1] 09-04 17:43:48.391: D/EventLogger(4304): droppedFrames [67.61, 1] 09-04 17:43:48.401: D/EventLogger(4304): droppedFrames [67.62, 1] 09-04 17:43:48.411: D/EventLogger(4304): droppedFrames [67.63, 1] 09-04 17:43:48.421: D/EventLogger(4304): droppedFrames [67.64, 1] 09-04 17:43:48.431: D/EventLogger(4304): droppedFrames [67.65, 1] 09-04 17:43:48.441: D/EventLogger(4304): droppedFrames [67.66, 1] 09-04 17:43:48.451: D/EventLogger(4304): droppedFrames [67.67, 1] 09-04 17:43:48.461: D/EventLogger(4304): droppedFrames [67.68, 1] 09-04 17:43:48.476: D/EventLogger(4304): droppedFrames [67.69, 1] 09-04 17:43:48.481: D/EventLogger(4304): droppedFrames [67.70, 1] 09-04 17:43:48.496: D/EventLogger(4304): droppedFrames [67.71, 1] 09-04 17:43:48.501: D/EventLogger(4304): droppedFrames [67.72, 1] 09-04 17:43:48.516: D/EventLogger(4304): droppedFrames [67.73, 1] 09-04 17:43:48.521: D/EventLogger(4304): videoSizeChanged [1280, 544]

09-04 18:00:33.431: D/NAL(5467): profile_idc: 100 09-04 18:00:33.431: D/NAL(5467): level_idc: 30 09-04 18:00:33.431: D/NAL(5467): width: 0768 09-04 18:00:33.431: D/NAL(5467): height: 0576

09-04 18:01:17.171: E/MediaCodecAudioTrackRenderer(5467): Discontinuity detected [expected 9621333, got 0]

hiteshgupta33 avatar Sep 04 '14 12:09 hiteshgupta33

Nice bollywood trailer :-). Works fine on my nexus 5. What device are you testing with ?

martinbonnin avatar Sep 04 '14 13:09 martinbonnin

@martinbonnin

haha, thanks. WIll give you more :)

works fine with my Nexus 5 too. But i need this on tablet. So, this is happening with all tabs. I have wide range of them. Majorly all samsung devices and Nexus 7 too. Happens with both

One thing i noticed is that the surface is displaying a video larger than it should. Can i maintain the aspect ratio as per me in the start only.

hiteshgupta33 avatar Sep 04 '14 13:09 hiteshgupta33

I am a bit limited in terms of devices for testing right now (basically I have a nexus 5 and a bunch of low cost phones running jelly bean). I'll try to get my hands on more of them and let you know.

martinbonnin avatar Sep 04 '14 13:09 martinbonnin

@martinbonnin Thanks a lot. I am a lot dependent on this. And i ll keep studying it.

Thanks a lot for all the support... You rock,

Cheers

hiteshgupta33 avatar Sep 04 '14 13:09 hiteshgupta33

I have a Galaxy Note 10.1 -- I'll take a look.

fougere-mike avatar Sep 04 '14 16:09 fougere-mike

The video does not appear distorted on my tablet (SM-P600). Here's a screenshot: https://www.dropbox.com/s/4cnuzplz5nvzg4x/ExoPlayer.Screenshots_2014-09-04-12-26-02.png?dl=0

fougere-mike avatar Sep 04 '14 16:09 fougere-mike

I've been able to reproduce this. It happens with 480p video only on my side. It looks like the native MediaPlayer will report dimensions of [872, 480], while exoplayer reports dimensions of [720, 480].

The result is that using exoplayer causes the video to be stretched. I'm still looking into why the dimensions are different.

EDIT: The problem is likely that we do not correctly handle non-square pixel formats. We should be able to get the sample aspect ratio from the VUI data. I'm looking into it.

fougere-mike avatar Sep 04 '14 19:09 fougere-mike

@martinbonnin I have resolved this issue in my fork, although I'm not 100% sure it will work everywhere. The SPS parsing will now extract the aspect ratio and adjust the width / height accordingly.

However, there was an issue with the codec reverting to the dimensions indicated in the SPS data (without adjusting for non-square pixel aspect ratio), even though it was being configured with the correct, adjusted dimensions. In order to get around that, I have saved a copy of the MediaFormat which is passed to configureCodec(), and I use it after the fact to extract the adjusted dimensions.

This may be dangerous depending on the stream contents -- I'm really not sure. However, my tests have all worked great.

I've opened a pull request, so you can check it out: #25

fougere-mike avatar Sep 05 '14 20:09 fougere-mike

@martinbonnin hey, did you have a look in to the fix by fougere - mike. Is it going to be stable?

hiteshgupta33 avatar Sep 07 '14 15:09 hiteshgupta33

Not sure yet.. The aspect ratio extraction looks good to me. Whether we should send that to the MediaCodec API is another question and I'm not sure there. I would expect the API to be 'aspect ratio agnostic' but maybe I am wrong. Also @fougere-mike do we have the same behaviour on all devices, Nexus 5 included ? If the issue appears on a Galaxy Note 10.1 and not on a Nexus 5, it means the MediaCodec API behaves differently and this does not look good... :-/

martinbonnin avatar Sep 07 '14 22:09 martinbonnin

I don't have a nexus 5 to test with, but it was affecting my nexus 7 devices as well as the samsungs.

fougere-mike avatar Sep 07 '14 22:09 fougere-mike

I am confused. When testing with this url (http://vod.hdi.cdn.ril.com/vod/definst/smil:hdivod/4/284/0_y74kwawj.smil/playlist.m3u8), I get the following streams:

  • 200000 bps: 640x288 [PAR 1:1 DAR 20:9]
  • 400000 bps: 640x288 [PAR 1:1 DAR 20:9]
  • 800000 bps: 640x288 [PAR 1:1 DAR 20:9]
  • 1200000 bps: 640x288 [PAR 1:1 DAR 20:9]
  • 1600000 bps: 850x368 [PAR 1:1 DAR 425:184]
  • 2300000 bps: 1280x560 [PAR 1:1 DAR 16:7]
  • 4000000 bps: 1280x560 [PAR 1:1 DAR 16:7]
  • 6000000 bps: 1280x560 [PAR 1:1 DAR 16:7]
  • 9000000 bps: 1280x560 [PAR 1:1 DAR 16:7]

So nothing close to 480p and everything with square pixels... Do I miss something ?

martinbonnin avatar Sep 08 '14 08:09 martinbonnin

@fougere-mike i tried it with your code, but it's still the same for me. I would like to mention one thing that i have different heights for contents and constant width.

Could you give me the test url with which you tested it?

Here is the screen shot of what i am getting. device-2014-09-08-135007

hiteshgupta33 avatar Sep 08 '14 08:09 hiteshgupta33

I'm afraid, we have 2 bugs here. One is a corrupted video, other is a aspect ratio problem. @hiteshgupta33 Are you sure you gave us the correct link ? http://vod.hdi.cdn.ril.com/vod/definst/smil:hdivod/4/284/0_y74kwawj.smil/playlist.m3u8 is the 'happy new year' trailer and I cannot locate the scene in your screenshot.

martinbonnin avatar Sep 08 '14 08:09 martinbonnin

@martinbonnin oh that was the correct link.

This screen shot is from another video again a anamorphic video. So, basically this problem is with all the content. I just wanted to show what's happening on the tablets.

So basically, we have constant width and variant height. What did you mean by corrupted video, i didn't understand that.

hiteshgupta33 avatar Sep 08 '14 10:09 hiteshgupta33

@martinbonnin Agreed, there are definately 2 different issues here.

fougere-mike avatar Sep 08 '14 17:09 fougere-mike

@fougere-mike @martinbonnin What can we do about the corrupted video. ? Any ideas?

hiteshgupta33 avatar Sep 09 '14 05:09 hiteshgupta33

@hiteshgupta33 so far, we have been unable to reproduce your bug so it's difficult to investigate it. @fougere-mike I have merged the aspect ratio parsing so that we have this for later. I did not take the changes to MediaCodecVideoTrackRenderer yet, I want to wait a bit how things go before doing so.

martinbonnin avatar Sep 09 '14 08:09 martinbonnin

@martinbonnin I guess @fougere-mike was able to reproduce this issue.

hiteshgupta33 avatar Sep 09 '14 09:09 hiteshgupta33

@martinbonnin Ok, sounds good.

@hiteshgupta33 Unfortunately, I may have jumped the gun on that one. I was able to create a situation where the video appeared distorted (stretched), and assumed from your description it was the same problem. However, from your recent comments and screenshot it appears our issues were not the same. I have not seen any video corruption akin to your last screenshot.

fougere-mike avatar Sep 09 '14 18:09 fougere-mike

@fougere-mike oh, that can be the case.

So, with the url i gave you, it doesn't distort at your end like the way i have showed in my screenshot.

hiteshgupta33 avatar Sep 10 '14 06:09 hiteshgupta33

@martinbonnin @fougere-mike hey guys, i think they fixed it for DASH. @martinbonnin they have fixed the issue you referred it to to the exoplayer issues. Can we do a similar thing?

hiteshgupta33 avatar Sep 12 '14 14:09 hiteshgupta33

@hiteshgupta33 they fixed the aspect ratio issue. Your problem is corrupted frames. It has nothing to do with aspect ratio.

martinbonnin avatar Sep 12 '14 14:09 martinbonnin

@martinbonnin what do you think should be done to fix corrupted frames issue?

hiteshgupta33 avatar Sep 12 '14 14:09 hiteshgupta33

@hiteshgupta33 we need to reproduce the issue.

martinbonnin avatar Sep 12 '14 14:09 martinbonnin

@martinbonnin can i help in that? i am sure i can ;)

hiteshgupta33 avatar Sep 12 '14 15:09 hiteshgupta33

I don't have a note 10.1 myself so I don't know

martinbonnin avatar Sep 12 '14 15:09 martinbonnin