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

[DRM] License-server key-request fails #713

Closed
jaylinski opened this issue Jun 12, 2021 · 11 comments
Closed

[DRM] License-server key-request fails #713

jaylinski opened this issue Jun 12, 2021 · 11 comments

Comments

@jaylinski
Copy link

jaylinski commented Jun 12, 2021

Description of the issue

When I'm trying to play a DRM protected video via inputstream.adaptive, the request to the license-server fails.

I'm experiencing this issue with the following stream:

#KODIPROP:inputstream=inputstream.adaptive
#KODIPROP:inputstream.adaptive.manifest_type=mpd
#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha
#KODIPROP:inputstream.adaptive.license_key=https://drm.ors.at/acquire-license/widevine?BrandGuid=13f2e056-53fe-4469-ba6d-999970dbe549&userToken=https://drm.ors.at/acquire-license/widevine?BrandGuid=13f2e056-53fe-4469-ba6d-999970dbe549&userToken=<token>
https://orf1.mdn.ors.at/out/u/orf1/drmqxa/manifest.mpd

Important: The license-server URL requires a fresh token for the userToken-param which can be requested by calling https://api-stage-tvthek.orf.at/livestream/_token and copying the base64-value.

This stream may be geo-blocked to Austrian IPs.

Expected behaviour

Kodi (inputstream.adaptive) plays the stream.

This stream may be geo-blocked to Austrian IPs.

Actual behaviour

Kodi doesn't play the stream and shows an error. (See License server returned failure error in logs below)

2021-06-12 16:31:41.742 T:4941    DEBUG <general>: OnPlayMedia /home/osboxes/Downloads/iptv.strm
2021-06-12 16:31:41.759 T:4941    DEBUG <general>: easy_acquire - Created session to https://orf1.mdn.ors.at
2021-06-12 16:31:41.838 T:4941    DEBUG <general>: CCurlFile::GetMimeType - https://orf1.mdn.ors.at/out/u/orf1/drmqxa/manifest.mpd -> application/dash+xml
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerCoreFactory::GetPlayers(https://orf1.mdn.ors.at/out/u/orf1/drmqxa/manifest.mpd)
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: system rules
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: matches rule: system rules
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: mms/udp
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: lastfm/shout
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: rtmp
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: rtsp
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: streams
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: matches rule: streams
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: aacp/sdp
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: mp2
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: dvd
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: discimage
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: sdp/asf
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: nsv
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerSelectionRule::GetPlayers: considering rule: radio
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerCoreFactory::GetPlayers: matched 0 rules with players
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerCoreFactory::GetPlayers: adding videodefaultplayer (VideoPlayer)
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerCoreFactory::GetPlayers: for video=1, audio=0
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerCoreFactory::GetPlayers: for video=1, audio=1
2021-06-12 16:31:41.842 T:4941    DEBUG <general>: CPlayerCoreFactory::GetPlayers: added 1 players
2021-06-12 16:31:41.845 T:4941    DEBUG <general>: Radio UECP (RDS) Processor - new CDVDRadioRDSData
2021-06-12 16:31:41.845 T:4941     INFO <general>: VideoPlayer::OpenFile: /home/osboxes/Downloads/iptv.strm
2021-06-12 16:31:41.861 T:4941    DEBUG <general>: CCurlFile::GetMimeType - https://orf1.mdn.ors.at/out/u/orf1/drmqxa/manifest.mpd -> application/dash+xml
2021-06-12 16:31:41.861 T:5001    DEBUG <general>: Thread VideoPlayer start, auto delete: false
2021-06-12 16:31:41.861 T:4941    DEBUG <general>: OnPlayBackStarted: CApplication::OnPlayBackStarted
2021-06-12 16:31:41.861 T:5002    DEBUG <general>: Thread BackgroundLoader start, auto delete: false
2021-06-12 16:31:41.863 T:4962    DEBUG <general>: Loading settings for /home/osboxes/Downloads/iptv.strm
2021-06-12 16:31:41.864 T:5001     INFO <general>: Creating InputStream
2021-06-12 16:31:41.864 T:5001    DEBUG <general>: ADDON: Dll Initializing - InputStream Adaptive
2021-06-12 16:31:41.864 T:5001    DEBUG <general>: SECTION:LoadDLL(/usr/lib/x86_64-linux-gnu/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.2.6.16)
2021-06-12 16:31:41.864 T:5001    DEBUG <general>: Loading: /usr/lib/x86_64-linux-gnu/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.2.6.16
2021-06-12 16:31:41.882 T:5002    DEBUG <general>: Thread BackgroundLoader 139634725185280 terminating
2021-06-12 16:31:41.899 T:4941    DEBUG <general>: CVideoGUIInfo::InitCurrentItem(/home/osboxes/Downloads/iptv.strm)
2021-06-12 16:31:41.902 T:4941    DEBUG <general>: CPlayerGUIInfo::InitCurrentItem(/home/osboxes/Downloads/iptv.strm)
2021-06-12 16:31:41.919 T:5001     INFO <general>: AddOnLog: inputstream.adaptive: SetVideoResolution (1280 x 952)
2021-06-12 16:31:41.919 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: Open()
2021-06-12 16:31:41.919 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: found inputstream.adaptive.license_key: [not shown]
2021-06-12 16:31:41.919 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: found inputstream.adaptive.license_type: com.widevine.alpha
2021-06-12 16:31:41.919 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: found inputstream.adaptive.manifest_type: mpd
2021-06-12 16:31:41.922 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: Initial bandwidth: 16853151 
2021-06-12 16:31:41.923 T:5001    DEBUG <CSettingsManager>: requested setting (PRERELEASEFEATURES) was not found.
2021-06-12 16:31:41.923 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: MAXRESOLUTION selected: 3 
2021-06-12 16:31:41.923 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: MAXRESOLUTIONSECURE selected: 0 
2021-06-12 16:31:41.923 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: STREAMSELECTION selected: 1 
2021-06-12 16:31:41.923 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: FORCENONSECUREDECODER selected: 0 
2021-06-12 16:31:41.923 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: Searching for decrypters in: /usr/lib/x86_64-linux-gnu/kodi/addons/inputstream.adaptive/
2021-06-12 16:31:41.945 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: Found decrypter: /usr/lib/x86_64-linux-gnu/kodi/addons/inputstream.adaptive/libssd_wv.so
2021-06-12 16:31:41.945 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: Supported URN: urn:uuid:EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED
2021-06-12 16:31:41.945 T:5001    DEBUG <general>: CurlFile::Open(0x7eff5c00c200) https://orf1.mdn.ors.at/out/u/orf1/drmqxa/manifest.mpd
2021-06-12 16:31:42.011 T:4941    DEBUG <general>: ------ Window Init (DialogBusy.xml) ------
2021-06-12 16:31:42.013 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: Download finished: https://orf1.mdn.ors.at/out/u/orf1/drmqxa/manifest.mpd
2021-06-12 16:31:42.013 T:5001     INFO <general>: AddOnLog: inputstream.adaptive: Successfully parsed manifest file. #Periods: 1, #Streams in first period: 2, Type: live, Download speed: 2106643.9874 Bytes/s
2021-06-12 16:31:42.013 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: New period, dispose sample decrypter and reinitialize
2021-06-12 16:31:42.013 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: Entering encryption section
2021-06-12 16:31:42.040 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: CDM version: 4.10.2209.0
2021-06-12 16:31:42.108 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: cdm::OnInitialized: true
2021-06-12 16:31:42.108 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: Initializing stream with KID: 842467D3DA954EB49DB577B8F499AB36
2021-06-12 16:31:42.310 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: CDMMessage: 1 arrived!
2021-06-12 16:31:42.344 T:5001    DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'Content-Type: application/x-www-form-urlencoded'
2021-06-12 16:31:42.344 T:5001    DEBUG <general>: CurlFile::ParseAndCorrectUrl() adding custom header option 'Expect: '
2021-06-12 16:31:42.344 T:5001    DEBUG <general>: CurlFile::Open(0x7eff5c00c200) https://drm.ors.at/acquire-license/widevine?BrandGuid=13f2e056-53fe-4469-ba6d-999970dbe549&userToken=s1wp8J1ozGhm3x1iTvWoQwmR%2FKOAbptYbqjjwcmVRGHRn0cGy97u2BIJTX7AGIZ4Jh3J6%2B0cxIUFoGNa3rOFWJvNhb5prjk3SNTDlB7LURNt9crsKxtZ1YwhJ7nCIs8pYau7DAPBMPuM3m9a4P2WLT%2FGeKjkpkwpxHQIuIJF356PzXy%2FDXUTlA82uMUoEDuatnIz16Vx2Am3EMFY2RZgEWkZ%2FYu0%2BNk3EP5MlCKUULX4t4ha5Uoz7bYxAZSvs1tR
2021-06-12 16:31:42.345 T:5001    DEBUG <general>: easy_acquire - Created session to https://drm.ors.at
2021-06-12 16:31:42.586 T:5001    ERROR <general>: CCurlFile::FillBuffer - Failed: HTTP returned error 400
2021-06-12 16:31:42.586 T:5001    ERROR <general>: CCurlFile::Open failed with code 400 for https://drm.ors.at/acquire-license/widevine?BrandGuid=13f2e056-53fe-4469-ba6d-999970dbe549&userToken=s1wp8J1ozGhm3x1iTvWoQwmR%2FKOAbptYbqjjwcmVRGHRn0cGy97u2BIJTX7AGIZ4Jh3J6%2B0cxIUFoGNa3rOFWJvNhb5prjk3SNTDlB7LURNt9crsKxtZ1YwhJ7nCIs8pYau7DAPBMPuM3m9a4P2WLT%2FGeKjkpkwpxHQIuIJF356PzXy%2FDXUTlA82uMUoEDuatnIz16Vx2Am3EMFY2RZgEWkZ%2FYu0%2BNk3EP5MlCKUULX4t4ha5Uoz7bYxAZSvs1tR:
                                                   
2021-06-12 16:31:42.586 T:5001    ERROR <general>: AddOnLog: inputstream.adaptive: License server returned failure
2021-06-12 16:31:42.586 T:5001    ERROR <general>: AddOnLog: inputstream.adaptive: License update not successful (no keys)
2021-06-12 16:31:42.591 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: CDMMessage: 4 arrived!
2021-06-12 16:31:42.608 T:5001    ERROR <general>: AddOnLog: inputstream.adaptive: Initialize failed (SingleSampleDecrypter)
2021-06-12 16:31:42.608 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: Session::~Session()
2021-06-12 16:31:42.612 T:5001    ERROR <general>: CVideoPlayer::OpenInputStream - error opening [/home/osboxes/Downloads/iptv.strm]
2021-06-12 16:31:42.612 T:5001     INFO <general>: CVideoPlayer::OnExit()
2021-06-12 16:31:42.614 T:5001    DEBUG <general>: AddOnLog: inputstream.adaptive: Close()

Additional info

The DASH reference player (https://reference.dashif.org/dash.js/latest/samples/dash-if-reference-player/) can play the stream without issues.

2021-06-12 16:31:18.627 T:4941     INFO <general>: -----------------------------------------------------------------------
2021-06-12 16:31:18.627 T:4941     INFO <general>: Starting Kodi (19.1 (19.1.0) Git:20210509-85e05228b4). Platform: Linux x86 64-bit
2021-06-12 16:31:18.627 T:4941     INFO <general>: Using Release Kodi x64
2021-06-12 16:31:18.627 T:4941     INFO <general>: Kodi compiled 2021-05-09 by GCC 7.5.0 for Linux x86 64-bit version 4.15.18 (266002)
2021-06-12 16:31:18.627 T:4941     INFO <general>: Running on Ubuntu 18.04.5 LTS, kernel: Linux x86 64-bit version 5.4.0-66-generic
2021-06-12 16:31:18.627 T:4941     INFO <general>: FFmpeg version/source: 4.3.1-Kodi
2021-06-12 16:31:18.627 T:4941     INFO <general>: Host CPU:        Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz, 2 cores available
2021-06-12 16:31:18.627 T:4941     INFO <general>: special://xbmc/ is mapped to: /usr/share/kodi
2021-06-12 16:31:18.627 T:4941     INFO <general>: special://xbmcbin/ is mapped to: /usr/lib/x86_64-linux-gnu/kodi
2021-06-12 16:31:18.627 T:4941     INFO <general>: special://xbmcbinaddons/ is mapped to: /usr/lib/x86_64-linux-gnu/kodi/addons
2021-06-12 16:31:18.627 T:4941     INFO <general>: special://masterprofile/ is mapped to: /home/osboxes/.kodi/userdata
2021-06-12 16:31:18.627 T:4941     INFO <general>: special://envhome/ is mapped to: /home/osboxes
2021-06-12 16:31:18.627 T:4941     INFO <general>: special://home/ is mapped to: /home/osboxes/.kodi
2021-06-12 16:31:18.627 T:4941     INFO <general>: special://temp/ is mapped to: /home/osboxes/.kodi/temp
2021-06-12 16:31:18.627 T:4941     INFO <general>: special://logpath/ is mapped to: /home/osboxes/.kodi/temp
2021-06-12 16:31:18.627 T:4941     INFO <general>: The executable running is: /usr/lib/x86_64-linux-gnu/kodi/kodi.bin
2021-06-12 16:31:18.627 T:4941     INFO <general>: Local hostname: osboxes
2021-06-12 16:31:18.627 T:4941     INFO <general>: Log File is located: /home/osboxes/.kodi/temp/kodi.log
2021-06-12 16:31:18.627 T:4941     INFO <general>: -----------------------------------------------------------------------
2021-06-12 16:31:18.694 T:4941     INFO <general>: CAddonMgr::FindAddons: inputstream.adaptive v2.6.16 installed
2021-06-12 16:31:18.694 T:4941     INFO <general>: CAddonMgr::FindAddons: inputstream.rtmp v3.4.0 installed
@jaylinski
Copy link
Author

Is there a way to get the response content from the license-server request? (Failed: HTTP returned error 400)

It would probably help to debug this issue.

@matthuisman
Copy link
Contributor

if the server is returning 400 it means your not providing enough or the correct data.
It isn't an Inputstream Adaptive issue unfortunately.
You'll need to use EME logger or chrome dev tools to find out the type of request it makes, the headers it needs, the payload type and the response type

@glennguy
Copy link
Contributor

It's possibly a VMP issue.

Try it on an Android device if you have access to one. If it works then VMP is to blame unfortunately.

@glennguy
Copy link
Contributor

Is there a way to get the response content from the license-server request?

Yes, you could try running it through something like mitmproxy

@jaylinski
Copy link
Author

jaylinski commented Jun 13, 2021

@matthuisman @glennguy Thanks for the tips! I think VMP is not the issue, since the stream doesn't work on my (rooted) Android phone.

I used mitmproxy and devtools in order to inspect the requests. The DASH reference player sends some binary blob to the license server, while Kodi sends some JSON non-binary data:

dash_widevine_req
kodi_drm_req
mitmproxy_kodi_drm

Is there any way to change the payload-type? (I read https://developers.google.com/web/fundamentals/media/eme, but it didn't really help me to understand if there are different payload-types...)

@matthuisman
Copy link
Contributor

Ummm. That json data is the response from their server... Not the request payload

@jaylinski
Copy link
Author

jaylinski commented Jun 13, 2021

@matthuisman Have a look at the picture in the middle. It shows the request-payload.

Edit: the request-payload is not json... I see that now. But it is still not the same payload-format as the DASH player is sending.

@matthuisman
Copy link
Contributor

matthuisman commented Jun 13, 2021

https://github.com/xbmc/inputstream.adaptive/wiki/Integration#inputstreamadaptivelicense_key

So try add ||R{SSM} to the license url.
(Not sure why json would be the default...)
Most of the time R{SSM} = raw format is used

this isn't an issue in IA. General help like this should be done in the Kodi forum. And these issues kept for actual bugs

@jaylinski
Copy link
Author

jaylinski commented Jun 13, 2021

Thanks for your help! I totally missed the info in the wiki 🙈.

I think I'll get it to work with this info! Thanks for your quick replies and for your work on this addon! Greatly appreciated!

@jaylinski
Copy link
Author

jaylinski commented Jun 13, 2021

It works now. If anyone else has the same issue, this is the config which works for me:

#KODIPROP:inputstream=inputstream.adaptive
#KODIPROP:inputstream.adaptive.manifest_type=mpd
#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha
#KODIPROP:inputstream.adaptive.license_key=https://drm.ors.at/acquire-license/widevine?BrandGuid=13f2e056-53fe-4469-ba6d-999970dbe549&userToken=5LP8TLRfoqD5eqKI%2Ft%2FH7BELNn64VSk%2BNgRfW9%2FSPu3B9%2Fo%2FZt98Zc8aP9%2FlHbkv2oEzi3oiMpzfcP0OIcSYohZqn1MtY2wfdnrEirZqkOr4N4Rnaff4GuMEcXQn5sxTfeCwGKW%2Ft30z3khWolbXybdALPVFbqd%2BAbnbLqH2chHWGA6WgVQhGPn%2BvpeeWDu0cJf5CjJESlkV35S%2FX4vXhn6A8M4z%2FGupnJ7h7IQSkkWctg3b%2FiR80DTe49OdCFgc||R{SSM}|
https://orf1.mdn.ors.at/out/u/orf1/drmqxa/manifest.mpd

@matthuisman
Copy link
Contributor

matthuisman commented Jun 13, 2021

I'll look into making R{SSM} the default payload type if none provided

PR done: #716

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