CastagnaIT / plugin.video.netflix

InputStream based Netflix plugin for Kodi
MIT License
1.91k stars 259 forks source link

Video Stream only at 540? - CoreElec - Linux - Arm #655

Closed spikerguy closed 3 years ago

spikerguy commented 4 years ago

Bug report

Your Environment

Used Operating system:

I've tried to set 1080 in the plugin setting but still it is only playing at 540p.

Yes ignored rules, not sure how I can help in debugging the cause of it only playing at 540p. I can play at 720p on chromium (1080p with a hack extension)- armv7 browser on the exact same device.

Kodi Log

SUMMARY for the problem

If the follow links not works, copy/paste the link in to the browser

The tests, and how to check resolutions:

https://github.com/CastagnaIT/plugin.video.netflix/issues/655#issuecomment-647163339

The cause of the problem:

https://github.com/CastagnaIT/plugin.video.netflix/issues/655#issuecomment-648695860 https://github.com/CastagnaIT/plugin.video.netflix/issues/655#issuecomment-648929816

Notice for user, to be read before you say it does not work:

https://github.com/CastagnaIT/plugin.video.netflix/issues/655#issuecomment-663852816

sk2212 commented 4 years ago

@CastagnaIT For my understanding, they are using a custom Chromium launcher with a custom user agent string which starts the Chromium Browser.

Maybe all of the magic is that user agent string which reduce the video quality to 540p.

So I think, on a Chromebook Netflix is running also without any problems.

AreaScout commented 4 years ago

If I choose to select the stream manually in inpustream.adaptive settings then it's even worse it's 768x432 :(

CastagnaIT commented 4 years ago

For my understanding, they are using a custom Chromium launcher with a custom user agent string which starts the Chromium Browser.

this how can help me? i have ask for details

So I think, on a Chromebook Netflix is running also without any problems.

the theory is not useful...

sk2212 commented 4 years ago

They are using following:

[Desktop Entry] Version=1.0 Name=Chromium (Media Edition) GenericName=Web Browser (Media Edition) Comment=Access the Internet Exec=chromium-browser %U --user-agent="Mozilla/5.0 (X11; CrOS armv7l 11895.95.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.125 Safari/537.36" Terminal=false X-MultipleArgs=false Type=Application Icon=chromium-browser Categories=Network;WebBrowser; MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https; StartupNotify=true Actions=NewWindow;Incognito;TempProfile; X-AppInstall-Package=chromium-browser

[Desktop Action NewWindow] Name=Open a New Window (Media Edition) Exec=chromium-browser --user-agent="Mozilla/5.0 (X11; CrOS armv7l 11895.95.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.125 Safari/537.36"

[Desktop Action Incognito] Name=Open a New Window in incognito mode (Media Edition) Exec=chromium-browser --incognito --user-agent="Mozilla/5.0 (X11; CrOS armv7l 11895.95.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.125 Safari/537.36"

[Desktop Action TempProfile] Name=Open a New Window with a temporary profile (Media Edition) Exec=chromium-browser --temp-profile --user-agent="Mozilla/5.0 (X11; CrOS armv7l 11895.95.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.125 Safari/537.36"

marcinolawski commented 4 years ago

@CastagnaIT Screenshot: KodiNetflix720

marcinolawski commented 4 years ago

@CastagnaIT Hack:

  1. Replace your user-aget to "Mozilla/5.0 (X11; CrOS armv7l 11895.95.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.125 Safari/537.36"
  2. Install libwidevinecdm.so from https://pi.vpetkov.net/libwidevinecdm.so_.zip
  3. (Rather not relevant) disable Xcompmgr
AreaScout commented 4 years ago

I have changed the user-agent string inside the addons/plugin.video.netflix/resources/lib/common/device_utils.py file either this is the wrong place to do it or this solution is not working

sk2212 commented 4 years ago

@marcinolawski Do not know if this would help but maybe you can record the network requests sent from Chromium Browser during login/play (CTRL + SHIFT + I).

CastagnaIT commented 4 years ago

if you use chrome dev tools you can not see encrypted content is needed to use a proxy "netflix-mitm-proxy" (in my repository) from a computer that decrypt the flow and save it to a log so the rpi must point the connection to the proxy in the pc

CastagnaIT commented 4 years ago

another thing you can do is provide the manifest request data of your browser via chrome dev tool (CTRL + SHIFT + I)

steps: 1) open nf website and go to homepage 2) To Chrome dev tools open page Sources 3) locate the file cadmium-playcore....js and open it 4) enable the pritty view or the code is show very ugly 5) now research "Sending MSL request" and put a break point (click to the line number) now the situation is similar to this: image

ONLY now, if you try to move the mouse pointer over a image of a tvshow, the code will be paused to the break point.

then on the right of screen, you can see the data the "method" data MUST contain "manifest" text, if it is not "manifest" press play button and try again to move the mouse over another tvshow image

when you have catch the "manifest" method, copy all "body" data to a text file and give me the file

marcinolawski commented 4 years ago

OK, but it will take a few hours before I find time for this.

wagnerch commented 4 years ago

Here is a manifest.json from a Pi4 using chromium with the method suggested in https://github.com/CastagnaIT/plugin.video.netflix/issues/655#issuecomment-647211925

CTRL+ALT+SHIFT+D confirms 1080p.

{
    "version": 2,
    "url": "manifest",
    "id": 15928332716196,
    "languages": ["en-US"],
    "params": {
        "type": "standard",
        "viewableId": 70270364,
        "profiles": ["heaac-2-dash", "heaac-2hq-dash", "playready-h264mpl30-dash", "playready-h264mpl31-dash", "playready-h264hpl30-dash", "playready-h264hpl31-dash", "vp9-profile0-L30-dash-cenc", "vp9-profile0-L31-dash-cenc", "playready-h264mpl40-dash", "playready-h264hpl40-dash", "vp9-profile0-L40-dash-cenc", "dfxp-ls-sdh", "simplesdh", "nflx-cmisc", "BIF240", "BIF320"],
        "flavor": "PRE_FETCH",
        "drmType": "widevine",
        "drmVersion": 25,
        "usePsshBox": true,
        "isBranching": false,
        "useHttpsStreams": true,
        "supportsUnequalizedDownloadables": true,
        "imageSubtitleHeight": 1080,
        "uiVersion": "shakti-v1c24c919",
        "uiPlatform": "SHAKTI",
        "clientVersion": "6.0023.976.011",
        "supportsPreReleasePin": true,
        "supportsWatermark": true,
        "showAllSubDubTracks": false,
        "videoOutputInfo": [{
                "type": "DigitalVideoOutputDescriptor",
                "outputType": "unknown",
                "supportedHdcpVersions": [],
                "isHdcpEngaged": false
            }
        ],
        "titleSpecificData": {
            "70270364": {
                "unletterboxed": false
            }
        },
        "preferAssistiveAudio": false,
        "isUIAutoPlay": false,
        "isNonMember": false,
        "desiredVmaf": "plus_lts"
    }
}
wagnerch commented 4 years ago

Also can confirm libwidevinecdm.so is the same that InputStream Helper downloads for ARM-based machines.

frodo19 commented 4 years ago

Just one remark for the issue. All stream in Kodi Coreelec , NF addon plays at 540. When I choose one Trailer, for example Snowpiercer, my CE machine play the trailer at 1980*1020, probably not protected.

CastagnaIT commented 4 years ago

mmmh thanks for the manifest this confirm that the problem is not here... I will try to study to see if i am able to implement a different msl encryption/decr method apparently i see no other way to try

wagnerch commented 4 years ago

I managed to get mitm proxy working, and one thing I noticed is there is a "challenge" added to the payload. Base64-decoding it reveals some interesting cleartext information:

000004e0: f2a0 72f4 4c44 3a5f 7949 2131 f40f c1e2  ..r.LD:_yI!1....
000004f0: f118 1476 87c3 3aa1 d81a 180a 1161 7263  ...v..:......arc
00000500: 6869 7465 6374 7572 655f 6e61 6d65 1203  hitecture_name..
00000510: 6172 6d1a 160a 0c63 6f6d 7061 6e79 5f6e  arm....company_n
00000520: 616d 6512 0647 6f6f 676c 651a 170a 0a6d  ame..Google....m
00000530: 6f64 656c 5f6e 616d 6512 0943 6872 6f6d  odel_name..Chrom
00000540: 6543 444d 1a19 0a0d 706c 6174 666f 726d  eCDM....platform
00000550: 5f6e 616d 6512 0843 6872 6f6d 654f 531a  _name..ChromeOS.
00000560: 230a 1477 6964 6576 696e 655f 6364 6d5f  #..widevine_cdm_
00000570: 7665 7273 696f 6e12 0b34 2e31 302e 3136  version..4.10.16
00000580: 3130 2e36 3208 0801 1000 1800 2001 122c  10.62....... ..,
00000590: 0a2a 0a14 0801 1210 0000 0000 03d2 6749  .*............gI

I couldn't find/tell if the plugin does this?

CastagnaIT commented 4 years ago

depends on what type of http request/response you mean

usually the challenge is used for license request

wagnerch commented 4 years ago

I e-mailed you the proxy log, didn't want to include it on the issue. It was in the manifest request payload, btw.

CastagnaIT commented 4 years ago

today i have 1080p to my arm device, and i do not understand if is something that i changed in my local experiments or if netflix has resolved the issue

someone can try and report?

AreaScout commented 4 years ago

@CastagnaIT These are good news, yesterday I got a new libwidevine 13020.82.0 so I was confident that it could work now, but it didn't, I tested it just now again and still on my side it does not work :(

the-dreamer commented 4 years ago

I did also a short test and tried several shows where at least the info is displaying 1080p but still got max SD. RPI3 LibreElec 9.2.3 Germany

CastagnaIT commented 4 years ago

well, i fairly certain the problem is the missing "challenge" data

i have tried a workaround and works but is not a good solution, I will contact a dev i hope he can give me some additional information

AreaScout commented 4 years ago

@CastagnaIT If you do have a workaround just for now, I would be happy to try it :)

CastagnaIT commented 4 years ago

i will publish the workaround if the dev answer me that there is no alternative about widevine procedures are no joke

AreaScout commented 4 years ago

@CastagnaIT

Yes understandable, wooo I am happy that this will work again, I have reactivated my WiiU yesterday, but Netflix on Kodi is 100+ times better than the APP on WiiU

sk2212 commented 4 years ago

Can confirm that resolution is still 540p with CoreElec 9.2 and Netflix Plugin 1.5.0

edragon7 commented 4 years ago

Can confirm that resolution is still 540p with CoreElec 9.2 and Netflix Plugin 1.5.0

Still the same resolution at 540p; no change.

wagnerch commented 4 years ago

It seems to me this challenge blob comes from libwidevinecdm, but tracing/debugging cadmium player is a real pain with the obfuscation. Most of the clear text strings are in libwidevinecdm.

Oddly, I could take that blob from my Pi 4, drop it into my OSMC box, and also get HD video. Which suggests that it does not have anything to do with MSL PSKs or the MSL session, and nothing probably host/client specific.

But at least in my testing, it seems this "challenge" token is the problem. It also seems that only certain platforms are required to send this challenge token.

AreaScout commented 4 years ago

Yes, only Linux ARM running Netflix kodi plugin, so I think on X11 ARM with older Chrome browser the problem must also be there !?

wagnerch commented 4 years ago

What I mean to say is in cadmium-player there is a boolean enableCDMAttestedDescriptor, if that is true then it calls what I am guessing is CDMAttestedDescriptor class which generates the challenge. But it's pretty hard to follow. I'll have to check my reactContext on the Pi 4 to see if that is sent to request this feature. My guess is either cadmium-player knows to send it based on some platform attribute or Netflix sends it in the truths.

CastagnaIT commented 4 years ago

the challenge data is provided in some way by widevine session i do not think you will find something in the source

i can easly limit to add this challenge data only for arm devices this not a problem

can you send me via e-mail the full ReactContext from RPI browser?

wagnerch commented 4 years ago

Sent 2x reactContext, 1st one is "anonymous" so I don't know if that is useful (via view source), the 2nd one is plucked via element picker and pasted into Geany (text editor).

CastagnaIT commented 4 years ago

last mail received is good but i found nothing of useful by comparing with windows side

wagnerch commented 4 years ago

Yeah, only thing that stood out was obsfucatedTruths had an extra element "44" but no real smoking gun. So maybe they just base it on what the browser sends (ChromeOS), so probably as simple as any non-Android ARM device for sure.

CastagnaIT commented 4 years ago

well i got a response, to fix in right way the challenge data needed for the manifest, are needed changes to InputStreamAdaptive and after test NF to use widevine encryption on all type of platforms is probably that in the future it will be mandatory to make this change

so to now i implement the workaround

spikerguy commented 4 years ago

Finally we have a strong lead on this :smile:

Nice work.

CastagnaIT commented 4 years ago

This is the test version, let me know:

Kodi19:plugin.video.netflix_1.5.0+matrix.1_20200624.zip Kodi18:plugin.video.netflix_1.5.0_20200624.zip

AreaScout commented 4 years ago

It works ! Thank you for the test version :)

screenshot001

Hardware: OdroidXU4 Kodi:18.7 OS: Debian Buster

notoco commented 4 years ago

s905x2 coreelec 9.2.3 works!

sk2212 commented 4 years ago

Confirming! Working again on Odroid C2 with CoreElec 9.2! Thanks for the amazing work, dude!

vteccorp commented 4 years ago

Yeahhh... 1080p works beautifully! Beelink GT King / CoreELEC 9.2.3

Thanks for Your hard work CastagnaIT :)

Deadmansshoe commented 4 years ago

Its working again! Amazing! PI 4, Rasbian Buster, Kodi 18.7

Thank you very much for your time and effort CastagnaTI!

42Swampy commented 4 years ago

Raspberry Pi 4 + LibreELEC 9.2.3 is working!

AlessandroSpa commented 4 years ago

Confirm Raspberry pi4 with Libreelec 9.2.3 is working right. Thanks a lot

Isator commented 4 years ago

Raspberry Pi 3 with LibreElec 9.2.3 : it's working (Thanks a lot !), but not with every show (Brooklyn 99 is still 540 max)

Deadmansshoe commented 4 years ago

I have to agree with @Isator, some series only play in 540p although the plugin tells me 1080p should be possible. More examples are The Sinner and Riverdale. As far as I have tried, movies always reach the indicated quality (or 1080p at 4k).

magoscur0 commented 4 years ago

I confirm @Isator and @Deadmansshoe movies are playing at 1080p, but series (The.Last.Kingdom) only at 540p. Kodi running on Arch Linux x86-64

Mantul2020 commented 4 years ago

Any chance for kodi android widevine l3 to get 1080p

npmstart-pray commented 4 years ago

well i got a response, ...

@CastagnaIT in case they don’t follow this repo, has someone brought this to the attention of the InputStreamAdaptive devs? I’m looking forward to what happens in the ARM world with Apple making the change...

CastagnaIT commented 4 years ago

I confirm @Isator and @Deadmansshoe movies are playing at 1080p, but series (The.Last.Kingdom) only at 540p. Kodi running on Arch Linux x86-64

on linux not all tvshows and movies can be played as described (1080p) for some reason this difference has always existed

but should be interesting to see in RPI browser on The.Last.Kingdom what resolution is specified

@CastagnaIT in case they don’t follow this repo, has someone brought this to the attention of the InputStreamAdaptive devs? I’m looking forward to what happens in the ARM world with Apple making the change...

they already know