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

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

Open
hiteshgupta33 opened this issue Sep 4, 2014 · 36 comments
Open

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

hiteshgupta33 opened this issue Sep 4, 2014 · 36 comments

Comments

@hiteshgupta33
Copy link

@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.

@martinbonnin
Copy link
Owner

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.

@hiteshgupta33
Copy link
Author

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

@hiteshgupta33
Copy link
Author

@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]

@martinbonnin
Copy link
Owner

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

@hiteshgupta33
Copy link
Author

@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.

@martinbonnin martinbonnin changed the title video getting distorted after Decoder init failed fix. video getting distorted on a Samsung Galaxy Note 10.1 (SM-P601) Sep 4, 2014
@martinbonnin
Copy link
Owner

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.

@hiteshgupta33
Copy link
Author

@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

@fougere-mike
Copy link

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

@fougere-mike
Copy link

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
Copy link

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
Copy link

@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

@hiteshgupta33
Copy link
Author

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

@martinbonnin
Copy link
Owner

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 martinbonnin changed the title video getting distorted on a Samsung Galaxy Note 10.1 (SM-P601) Wrong aspect ratio on a Samsung Galaxy Note 10.1 (SM-P601) Sep 7, 2014
@fougere-mike
Copy link

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

@martinbonnin
Copy link
Owner

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 ?

@hiteshgupta33
Copy link
Author

@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

@martinbonnin
Copy link
Owner

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.

@hiteshgupta33
Copy link
Author

@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.

@fougere-mike
Copy link

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

@hiteshgupta33
Copy link
Author

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

@martinbonnin
Copy link
Owner

@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.

@hiteshgupta33
Copy link
Author

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

@fougere-mike
Copy link

@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.

@hiteshgupta33
Copy link
Author

@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
Copy link
Author

@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?

@martinbonnin
Copy link
Owner

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

@hiteshgupta33
Copy link
Author

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

@martinbonnin
Copy link
Owner

@hiteshgupta33 we need to reproduce the issue.

@hiteshgupta33
Copy link
Author

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

@martinbonnin
Copy link
Owner

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

@hiteshgupta33
Copy link
Author

@martinbonnin @fougere-mike what is the reason for dropped frames?

@fougere-mike you have a tablet, right? Any ideas?

@fougere-mike
Copy link

@hiteshgupta33 I have tested the stream you provided (http://vod.hdi.cdn.ril.com/vod/_definst_/smil:hdivod/4/284/0_y74kwawj.smil/playlist.m3u8) on my samsung tablet (SM-P600). It did not appear corrupt, and did not appear distorted. Until I can reproduce the issue, I'm not really able to help.

@hiteshgupta33
Copy link
Author

@fougere-mike can you try it on Nexus 7 (Tablet) with my test stream url. It happens on that also.

Thanks buddy

@fougere-mike
Copy link

@hiteshgupta33 I just tried it on the nexus 7. I do not see any problems.

@hiteshgupta33
Copy link
Author

@fougere-mike can you send me your demo code where you tried this, i want to see if i am doing something wrong here.

It's getting distorted on every tablet i can think of except on SM-P600(a little happens on this too).
I really appreciate the help buddy.
my email id : [email protected]

@fougere-mike
Copy link

I was testing your stream by passing the URL to our player; unfortunately I cannot give you that code. However, one thing to check is that you are correctly handling the onVideoSizeChanged(int, int) event -- this is fired whenever the player detects a change in the dimensions of the video. Depending on how your app is structured, you may need to use onVideoSizeChanged() to resize your surface view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants