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

Amazon VOD only plays in 400x224 #205

Closed
satmandu opened this issue Nov 11, 2018 · 20 comments
Closed

Amazon VOD only plays in 400x224 #205

satmandu opened this issue Nov 11, 2018 · 20 comments

Comments

@satmandu
Copy link
Contributor

I'm having this issue using inputstream, kodi 18 nightly ppa, and kodi-gbm on an Ubuntu 18.10 x86_64 machine.

Here's the debug log:

https://paste.ubuntu.com/p/K33pS2cPC5/

@Sandmann79
Copy link
Owner

Set stream selection to Automatic at Inputstream Adaptive Addon settings.

@satmandu
Copy link
Contributor Author

No change.

Debug log:
http://paste.ubuntu.com/p/YMjdXkH2js/

@Sandmann79
Copy link
Owner

Did you restart Kodi?

@satmandu
Copy link
Contributor Author

After kodi restart I see the same issue.

Debug log:

http://paste.ubuntu.com/p/wM6JrsjySh/

@Sandmann79
Copy link
Owner

If you set streamselection to manual and playing an movie, you can switch to higher resolutions?

@satmandu
Copy link
Contributor Author

satmandu commented Nov 12, 2018 via email

@Varstahl
Copy link
Collaborator

Depending on the area, some video streams are encrypted with a scheme that is not currently supported by the standard Widevine. Try with a TV series and check if you can play HD content. In my experience TV series and movies with a low to mid resolution are encrypted with an older scheme, while movies at higher resolutions (720p+) are encrypted with an unsupported scheme.

@ghost
Copy link

ghost commented Nov 15, 2018

Had the same issue on raspberry pi 3, libreelec, milhouse-9.0#1114. Activating "Ignore Display Resolution" in InpuStream Adaptive settings resolved it for me.

@satmandu
Copy link
Contributor Author

Sorry about the spam. Baby + keyboard. :/

@CAPSLOCKFTW Ignore Display Resolution doesn't do anything for me.

@Sandmann79 If I set selectstream to manual I never get an option to choose from a list of streams. How do I enable that?

@Varstahl
Copy link
Collaborator

I was looking back at your issue, and I noticed that you don't use the internal video decoding, but instead you use the external video decoding through ffmpeg:

DEBUG: CAddonVideoCodec: GetPicture::VC_PICTURE with pts 125125 400x224 (396x224) 1.777778 0x7f3650743010:172544 offset:0,114688,114944, stride:512,512,512
DEBUG: ffmpeg[7F36EB7FE700]: [SWR] FR: FL:0.000000 FR:0.585786 FC:0.000000 LFE:0.000000 SL:0.000000 SR:0.414214

This is not the default behaviour and might be the reason why you're having low resolutions. I'm also unsure which version of Kodi you're running, and what type of configuration would cause this to happen. Can you reset the video decoding back to Kodi's standard instead of using ffmpeg, and try again?

@satmandu
Copy link
Contributor Author

I'm using kodi 18 through their nightly ppa via gbm. I think this uses ffmpeg internally.

(When the netflix plugin works I'm definitely getting 1080p output there without any changes, so I don't think this is an issue of failing to decode 1080p... unless this is somehow a widevine DRM issue.)

@Varstahl
Copy link
Collaborator

Netflix uses a different type of Widevine encoding, so that's not saying much. As for the PPA, I don't know, maybe it's a different compilation build.

@oomek
Copy link

oomek commented Dec 20, 2018

Which widevine version do you recommend?
On 1.4.9.1088 movies play in 960x540. On more recent versions (4.10.1192.0 to 4.10.1224.7) I get only audio. How can I make sure I get the most compatible widevine version, there is too many of them and the most recent ones seem to make things even worse.

@oomek
Copy link

oomek commented Dec 20, 2018

There is one thing I still do not understand. I can select the 1080p stream and it plays normally when I set the streams to manual, but it defaults to lowest one when I press play Scratch that, I can see max 540p, I could swear I've had 1080p option, but I messed too much with widevine versions, so I've lot track. What is responsible for selecting the stream? Your plugin, widevine or inputstream?

@Varstahl
Copy link
Collaborator

Which widevine version do you recommend?

Bluntly, the version that works for you.

I can see max 540p, I could swear I've had 1080p option

1080p works, but only for TV series. It's a “problem” with codecs for high bit rate movies. For which reason? I don't know, someone decided it was the best thing to do™.

What is responsible for selecting the stream? Your plugin, widevine or inputstream?

It works like this:

  1. our plugin starts asking for videos available to device X — in our case we chose "Web browser", videos work for the most part, while by picking other devices some won't be reproduced at all —;
  2. our plugin fetches the stream URL, attaches it to metadata for the video playback along with the DRM data, and at that point it's out of our hands;
  3. InputStream.Adaptive sees the Widevine DRM and loads the CDM module;
  4. IS.A checks the streams with Widevine to understand what bitrates can be decoded with the version IS.A has available;
  5. From the list available, IS.A picks the highest resolution possible — that is lower or equal to the display's resolution, unless behaviour is modified through the settings — and starts the playback. If manual stream selection is chosen instead, for debugging purposes it starts with the lowest resolution instead.

That's pretty much all there is to it. Netflix uses some parameters that allow full FHD playback (and 4K, someone says). Amazon uses different encoding, so TV series are played fully (up to FHD, didn't test 4K yet), while movies up to ~540p-ish, while 720p+ and higher don't work.

I've been thinking and saying I should take a look back at the problem, check if it's a problem with HEVC, or just a device problem, sniff and reverse engineer the protocol for different applications instead of going through the primevideo.com website, scraping the UI… I've been thinking and saying that a lot, but time to actually stop everything and do that for real? Still got none :\

@Krzmbrzl
Copy link

Is there a way to get informed about which streams can't be decoded (especially which resolutions those un-decodable streams have)?

@Varstahl
Copy link
Collaborator

I'm not entirely sure. Not before hand, I don't think. The streams get parsed by IS.A and Kodi, we only provide the pointers to the right URLs.

@satmandu
Copy link
Contributor Author

For what it is worth, I ended up getting back to amazon full resolution by just having kodi open google-chrome, by having the amazon plugin open a script thus:

#!/bin/sh
/usr/bin/xrandr -d :0 -r $1
/usr/bin/xrandr  -d :0 --output HDMI1 --set "Broadcast RGB" "Full" --set audio on --auto >> /tmp/xrandr.txt 2>/dev/null; /usr/bin/google-chrome --autoplay-policy=no-user-gesture-required --no-user-gesture-required --window-position=0,0 --window-size=1920,1080 --start-maximized --kiosk $2
/usr/bin/xrandr -d :0 -r 60 

I have a remote working with kodi via libcec, so I also had to add a custom keymap file to ~kodi/.kodi/userdata/keymaps/remote.xml thus:

<keymap><global><keyboard>
<!-- 251 Red -->
<!-- 252 Green -->
<!-- 254 Blue -->
<!-- 253 Yellow -->
<key id="251">Runscript(/home/kodi/bin/quit.py)</key>
<key id="252">Runscript(/home/kodi/bin/left.py)</key>
<key id="254">Runscript(/home/kodi/bin/space.py)</key>
<key id="253">Runscript(/home/kodi/bin/right.py)</key>
</keyboard></global></keymap>

I'm basically sending 4 commands from the remote to chrome through those 4 buttons: quit, left, space, & right, which lets me do everything I need to do with prime videos (aside from clicking on skip intro.)
The scripts for those keys all look like this:

#!/usr/bin/python
import subprocess
subprocess.call("DISPLAY=:0     xdotool search --onlyvisible --class \"Chrome\" windowfocus key 'space'", shell=True)

(This could be cleaner, since kodi lets you send a variable when using Runscript, but this was the quick and dirty version.)

I am still having some issues with the video being a little dark, even after switching my tv display to full instead of limited, so if there's a better way of making 1080p streaming work for Amazon video from kodi, I'm all ears. :)

@Varstahl
Copy link
Collaborator

There's this thread where issues were reporting about the same problems you're describing but on Nvidia Shields. I didn't test it yet, but they both reported working. You can do the same and check if that works, might be worth a shot.

@satmandu
Copy link
Contributor Author

There's this thread where issues were reporting about the same problems you're describing but on Nvidia Shields. I didn't test it yet, but they both reported working. You can do the same and check if that works, might be worth a shot.

Ok, that actually works great! I can confirm that this works fine from Linux with official Kodi 18 nightlies (running on ubuntu). I created a pull request with that change.

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

5 participants