Open lavish440 opened 2 weeks ago
this is known, manifests that dont provide default_kid value on ContentProtection tag are currently not supported the idea would be support this along the drm rework but idk how months will require to finish it
i can take a look if its possible do something, if not require too much changes
So it will take some time then. Will something like this work in Shaka?
Will something like this work in Shaka?
yes
this test build should works in theory: https://jenkins.kodi.tv/blue/organizations/jenkins/xbmc%2Finputstream.adaptive/detail/PR-1659/1/artifacts/ but i cannot test by myself
So if I compile from the Piers branch, then it should work?
no, or you use test builds or you have to get it from the relative branch on my personal repository, see PR
I can't use test builds since I mostly test on Linux. I will compile from your repo.
In the meantime can you provide me an example to also test it on Shaka Demo if possible?
i dont have any sample stream as your example attached above then i cant test this code change
you asked for this support, and you cannot to test it?
if i have to test it by myself, i need to construct a custom way with a local server, then anyway i cant share it
i dont have any sample stream as your example attached above then i cant test this code change
you asked for this support, and you cannot to test it?
I can test it on other Android players and they play it correctly but those players don't always follow the standards. So I wanted to confirm it by testing on Shaka.
I can test it on other Android players and they play it correctly but those players don't always follow the standards.
you have just to read DASH specification docs... no need to test tons of players where each one can have different implementations or also partials
if default_kid value on ContentProtection tag is missing need to be extracted from mp4 boxes
Still fails to play.
I compiled the addon from the default_kid_fallback
branch.
Here are the logs:
2024-08-26 15:30:11.143 T:7707 info <general>: Creating InputStream
2024-08-26 15:30:11.145 T:7707 info <general>: AddOnLog: inputstream.adaptive: [Repr. chooser] Resolution set: 1920x1200, max allowed: 1920x1200, Adjust refresh rate: 0
2024-08-26 15:30:12.706 T:7707 warning <general>: AddOnLog: inputstream.adaptive: ParseManifest: The <UTCTiming> tag element is not supported so playback problems may occur.
2024-08-26 15:30:12.708 T:7707 info <general>: AddOnLog: inputstream.adaptive: Manifest successfully parsed (Periods: 1, Streams in first period: 2, Type: live)
2024-08-26 15:30:12.728 T:7707 error <general>: AddOnLog: inputstream.adaptive: ConvertKidStrToBytes: Cannot convert KID "" as bytes due to wrong size
2024-08-26 15:30:12.728 T:7707 warning <general>: AddOnLog: inputstream.adaptive: Initializing stream with unknown KID!
2024-08-26 15:30:13.418 T:7707 error <general>: AddOnLog: inputstream.adaptive: ConvertKidStrToBytes: Cannot convert KID "" as bytes due to wrong size
2024-08-26 15:30:13.419 T:7707 info <general>: Skipped 6 duplicate messages..
2024-08-26 15:30:13.419 T:7707 info <general>: Creating Demuxer
2024-08-26 15:30:13.420 T:7707 info <general>: Opening stream: 1007 source: 256
2024-08-26 15:30:13.820 T:7707 info <general>: Creating video codec with codec id: 27
2024-08-26 15:30:13.820 T:7707 info <general>: CDVDVideoCodecFFmpeg::Open() Using codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
2024-08-26 15:30:13.822 T:7707 info <general>: Creating video thread
2024-08-26 15:30:13.822 T:7714 info <general>: running thread: video_thread
2024-08-26 15:30:13.822 T:7707 info <general>: Opening stream: 1008 source: 256
2024-08-26 15:30:13.884 T:7707 info <general>: Finding audio codec for: 86018
2024-08-26 15:30:13.885 T:7707 info <general>: CDVDAudioCodecFFmpeg::Open() Successful opened audio decoder aac
2024-08-26 15:30:13.885 T:7707 info <general>: OpenStream: Allowing max Out-Of-Sync Value of 50 ms
2024-08-26 15:30:13.885 T:7707 info <general>: Creating audio thread
2024-08-26 15:30:13.886 T:7716 info <general>: running thread: CVideoPlayerAudio::Process()
2024-08-26 15:30:14.023 T:7707 error <general>: AddOnLog: inputstream.adaptive: Decrypt Sample returns failure!
2024-08-26 15:30:14.322 T:7707 info <general>: Skipped 101 duplicate messages..
2024-08-26 15:30:14.322 T:7707 info <general>: Process - eof reading from demuxer
2024-08-26 15:30:14.322 T:7707 info <general>: CVideoPlayer::OnExit()
2024-08-26 15:30:14.322 T:7707 info <general>: VideoPlayer: eof, waiting for queues to empty
2024-08-26 15:30:14.322 T:7707 info <general>: Closing stream player 1
2024-08-26 15:30:14.351 T:7707 info <general>: Waiting for audio thread to exit
2024-08-26 15:30:14.354 T:7716 info <general>: thread end: CVideoPlayerAudio::OnExit()
2024-08-26 15:30:14.354 T:7707 info <general>: Closing audio device
2024-08-26 15:30:14.354 T:7707 info <general>: Deleting audio codec
2024-08-26 15:30:14.355 T:7707 info <general>: Closing stream player 2
2024-08-26 15:30:14.365 T:7707 info <general>: waiting for video thread to exit
2024-08-26 15:30:14.365 T:7714 info <general>: thread end: video_thread
2024-08-26 15:30:14.365 T:7707 info <general>: deleting video codec
2024-08-26 15:30:14.366 T:7707 error <general>: AddOnLog: inputstream.adaptive: Instances: 1
2024-08-26 15:30:14.379 T:7707 info <general>: ADDON: Dll Destroyed - InputStream Adaptive
2024-08-26 15:30:15.922 T:7293 info <general>: CVideoPlayer::CloseFile()
2024-08-26 15:30:15.922 T:7293 info <general>: VideoPlayer: waiting for threads to exit
2024-08-26 15:30:15.922 T:7293 info <general>: VideoPlayer: finished waiting
2024-08-26 15:30:15.922 T:7293 info <general>: CVideoPlayer::CloseFile()
2024-08-26 15:30:15.922 T:7293 info <general>: VideoPlayer: waiting for threads to exit
2024-08-26 15:30:15.922 T:7293 info <general>: VideoPlayer: finished waiting
2024-08-26 15:31:04.538 T:7316 info <general>: CActiveAESink::OpenSink - initialize sink
debug infos are needed
For a specific component or Kodi as a whole?
stadard kodi debug, no specific component
I will need to filter the Kodi log as it has some sensitive info.
ISA is getting the KID from somewhere.
It is f9cb.....fa7
.
But then it says
Decrypt failed with error code 2 and KID: f9cb.....fa7
Decrypt sample returns failure
Here is the full log: Kodi Debug Log
i rougly tested my PR by forcing ISA parser to ignore KID from manifest i can say that PR changes at least for my sample stream works, defaultKID is extracted correctly from mp4box
assuming you have not by mistake builded wrong repo/branch version or installed a wrong version i dont see on log the initialization file downloaded, thats weird
i cant see the relative MPD played so explanations could be: 1) the played MPD provide the KID 2) in the init file are missing the encryption infos
for point 1 the MPD is same of attached above?
for point 2 i need to understand more by inspecting the init file data
send to me the initialization file downloaded, from your censured things above the filename is:
initialization=something-$RepresentationID$.dash?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe
if you dont want attach it here send it to my email
assuming you have not by mistake builded wrong repo/branch version or installed a wrong version
I build from your repo's default_kid_fix
i dont see on log the initialization file downloaded, thats weird Maybe I censored it with something
i cant see the relative MPD played so explanations could be: 1) the played MPD provide the KID 2) in the init file are missing the encryption infos
for point 1 the MPD is same of attached above?
It is a different channel but the MPD should be very similar/ same.
for point 2 i need to understand more by inspecting the init file data send to me the initialization file downloaded, from your censured things above the filename is: initialization=
something-$RepresentationID$.dash?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe
if you dont want attach it here send it to my email
I can email it to you. What's your email?
it written here: http://beacons.ai/castagnait
It is a different channel but the MPD should be very similar/ same
a little change can change code behaviour, attach the new MPD
I have sent you the manifest and the initialisation files via email.
Can you confirm you have received it?
yes i tested locally, first thing, im quite sure that you are running a wrong binary version of ISA, maybe you havent copied new builded files to kodi
from my test with same situation:
2024-08-26 14:40:07.014 T:15676 debug <general>: CurlFile::XFILE::CCurlFile::Open - <http://192.168.1.2:8000/mpd/video/video_init.mp4>
2024-08-26 14:40:07.020 T:15676 debug <general>: AddOnLog: inputstream.adaptive: [AS-0] Download finished: http://192.168.1.2:8000/mpd/video/video_init.mp4 (downloaded 1702 byte, speed 340263.00 byte/s)
2024-08-26 14:40:07.022 T:15676 debug <general>: AddOnLog: inputstream.adaptive: Initializing stream with KID: f9cbfeb7933b52c79efca45b4cb38fa7
2024-08-26 14:40:07.313 T:15676 debug <general>: AddOnLog: inputstream.adaptive: CDMMessage: 1 arrived!
init file is downloaded and KID parsed from mp4box
anyway doesnt matter so much, there is a second weird thing, this in hoping you have not sent to me a MPD manifest that dont match to the log above https://github.com/xbmc/inputstream.adaptive/issues/1657#issuecomment-2309985822
i decoded the init pssh of MPD and have a KID of: 2cd67dd74e6659c0aa7fac52ac16a23d but the mp4 init file have a different KID of: f9cbfeb7933b52c79efca45b4cb38fa7
are differents, where should be equal, so it could be the reason why the decryption dont works seem that the manifest provide a bad pssh init data
i think i found also a my mistake, i update the PR soon
my PR/branch updated, let me know
ok i found also another problem, i need to investigate better i will let you know when done
updated again my PR/branch this time will force update also init data from mp4 so i hope it works
yes i tested locally, first thing, im quite sure that you are running a wrong binary version of ISA, maybe you havent copied new builded files to kodi
I am running the correct version I am sure.
from my test with same situation:
2024-08-26 14:40:07.014 T:15676 debug <general>: CurlFile::XFILE::CCurlFile::Open - <http://192.168.1.2:8000/mpd/video/video_init.mp4> 2024-08-26 14:40:07.020 T:15676 debug <general>: AddOnLog: inputstream.adaptive: [AS-0] Download finished: http://192.168.1.2:8000/mpd/video/video_init.mp4 (downloaded 1702 byte, speed 340263.00 byte/s) 2024-08-26 14:40:07.022 T:15676 debug <general>: AddOnLog: inputstream.adaptive: Initializing stream with KID: f9cbfeb7933b52c79efca45b4cb38fa7 2024-08-26 14:40:07.313 T:15676 debug <general>: AddOnLog: inputstream.adaptive: CDMMessage: 1 arrived!
init file is downloaded and KID parsed from mp4box
anyway doesnt matter so much, there is a second weird thing, this in hoping you have not sent to me a MPD manifest that dont match to the log above https://github.com/xbmc/inputstream.adaptive/issues/1657#issuecomment-2309985822
i decoded the init pssh of MPD and have a KID of: 2cd67dd74e6659c0aa7fac52ac16a23d but the mp4 init file have a different KID of: f9cbfeb7933b52c79efca45b4cb38fa7
are differents, where should be equal, so it could be the reason why the decryption dont works seem that the manifest provide a bad pssh init data
The KID changes very often. Edit: The manifest and the .mp4 files that I SENT you were from the same session so they should have the same KID.
updated again my PR/branch this time will force update also init data from mp4 so i hope it work
I tried and this time I have modified the version and name of ISA to confirm that I am using the latest one. The last PR was very quick to build because only 1 file was changed. The playback still fails.
I can send you the WDV licence request and response if you want.
The KID changes very often
if KID is not static and change very often when in playback, it can mean that use key rotation and currently ISA dont support key rotation (as #1602)
there are no plans to implement key rotation soon, no eta from my part ofc implementation PR from other devs is welcome
anyway on the new log you have to see more Extracting data...
error prints in the logs
that i added to highlight the new build
if are missing, you are doing something wrong
I have mailed you the debug log, manifest and the initialisation files. Confirm if you have received them. Also there are no traces of "Extracting Data" in the logs.
Edit: I can send you the WDV licence response if you need it.
Also there are no traces of "Extracting Data" in the logs.
if there is no "Extracting Data" logs something that im not aware is happening on your device
from your new log i have copied manifest and license string to test your video on my computer
now despite i cannot play it due to geolock, the manifest can be downloaded
and i can see that SESSION::CSession::ExtractStreamProtectionData: Extracting data...
are correctly printed to parse pssh data, here an example
2024-08-26 18:08:12.053 T:21336 debug <general>: AddOnLog: inputstream.adaptive: Download finished: https://sdfsdfsdf/8.mpd (downloaded 9630 byte, speed 5769.00 byte/s)
2024-08-26 18:08:12.059 T:21336 error <general>: XFILE::CDirectory::Remove - Error removing D:\KodiPortable_Builded\portable_data\userdata\addon_data\inputstream.adaptive\manifests
2024-08-26 18:08:12.061 T:21336 debug <general>: AddOnLog: inputstream.adaptive: Manifest saved to: D:\KodiPortable_Builded\portable_data\userdata\addon_data\inputstream.adaptive\manifests\manifest_1724688492.txt
2024-08-26 18:08:12.062 T:21336 warning <general>: AddOnLog: inputstream.adaptive: adaptive::CDashTree::ParseManifest: The <UTCTiming> tag element is not supported so playback problems may occur.
2024-08-26 18:08:12.125 T:21336 info <general>: AddOnLog: inputstream.adaptive: Manifest successfully parsed (Periods: 1, Streams in first period: 2, Type: live)
2024-08-26 18:08:12.125 T:21336 debug <general>: AddOnLog: inputstream.adaptive: [Repr. chooser] Stream selection conditions
Screen resolution: 1280x720
2024-08-26 18:08:12.125 T:21336 debug <general>: AddOnLog: inputstream.adaptive: New period, dispose sample decrypter and reinitialize
2024-08-26 18:08:12.125 T:21336 debug <general>: AddOnLog: inputstream.adaptive: Entering encryption section
2024-08-26 18:08:12.137 T:21336 debug <general>: AddOnLog: inputstream.adaptive: media::CdmAdapter::Initialize: CDM version: 4.10.2710.0
2024-08-26 18:08:12.642 T:21336 debug <general>: AddOnLog: inputstream.adaptive: media::CdmAdapter::OnInitialized: CDM is initialized: true
2024-08-26 18:08:12.642 T:21336 error <general>: AddOnLog: inputstream.adaptive: SESSION::CSession::ExtractStreamProtectionData: Extracting data...
2024-08-26 18:08:12.642 T:21336 debug <general>: AddOnLog: inputstream.adaptive: Created AdaptiveStream [AS-0] with adaptation set ID: "1", stream type: audio
so idk what you are doing on your device, but my code changes works
here there are 2 test builds for ubuntu x64 https://github.com/xbmc/inputstream.adaptive/actions/runs/10560735420?pr=1659 there is a possibility that at least one of these builds can works on your OS, if not works will fail to load ISA, hoping that one works try to see if you get "Extracting data..." on log
notice that these linux builds are double zipped, so you need to extract the zip manually one time, then use kodi menu "install from zip" also make sure before install it, that ISA autoupdate on kodi is also disabled (on addon info) just to make sure that kodi dont replace binary just installed
I installed them. Both of them installed correctly. They seem to download the manifest and the consequent dash files alright but the decryption fails I think. The video is all green and very glitchy. No audio or video playback ocurrs. I have sent you two log files on email. If you need the Licence response, I can email you that as well.
now there are "Extracting data..." on logs, so confirm that you are doing something wrong with your self-buildings
decryption fails I think. The video is all green and very glitchy.
yes something dont work with decryption weird that dont work at all, even if it were that there is key rotation i would expect at least first segments should work
If you need the Licence response, I can email you that as well.
response fwik is encrypted
the only thing i can try to do is try inspecting the init and segment files manually to see if there are drm data changes between init and video segments
you can send to me a debug log+mpd+video init file and 2 or 3 of video segment files as shown on log please kept same video file names of log otherwise i cannot understand what file is on log
I have emailed you everything you need. Sorry for the delay as I was a little busy today.
thanks i noticed that the manifest pssh contains a kid that is equal to kid on segments
i have add a way to extract the kid from the manifest pssh i have no idea if can improve the situation worth a try
new test build https://github.com/xbmc/inputstream.adaptive/actions/runs/10582098639?pr=1659
anyway pssh show a key rotation field value
It is back to the old behavior now. Tries to download 1-2 stream then fails. Also there is no trace of "Extracting Data" Edit: I see KID PARSED FROM PSSH in the logs
Also there is no trace of "Extracting Data"
its ok expected, because use KID PARSED FROM PSSH
strange that it cannot decode since the initial key is equal, im stop here because i have zero idea on how to proceeds, also because pssh seem to signal key rotation and looks like that other things are needed to implement key rotation since it does not work
Sorry I was a bit busy. How can I confirm that the issue is being caused by Key Rotation? The key should stay the same for some time right?
Very strange that popular IPTV apps like OTT Navigator and Tivimate use kodi iptv playlist format still the same playlist works in Tivimate and OTT Navigator even in old versions but kodi always has some issues be it add-on/kodi version/manifest/drm or character limit I think Kodi had introduced 'IPTV' to the home theatre and kodi is available in all platforms unlike Tivimate only android so its essential for kodi to be best IPTV app and not paid proprietary Tivimate. Is it because Tivimate push regular update and kodi-pvr/ISA add-on have very few maintainers?
Sorry I was a bit busy. How can I confirm that the issue is being caused by Key Rotation?
by decoding the manifest pssh with tools is shown index
attribute for key rotation,
the weird thing is that the manifest pssh contains a kid that is equal to kid on segments, but anyway its different from the kid contained on the initialization segment, imo suggest a kind of key rotation or something else that im not aware
in my tests using manifest kid decryption is broken, using kid from segment decryption start but manlformed data, as wrong key used or i don't know...
The key should stay the same for some time right?
in a regular stream the KID is always the same, but in this case there its clear that there is something different. im not so expert of decrypting, i have a kind of idea on how rotation should work but no concrete examples for a correct implementation, and i don't have time for this atm, if someone want collab to fix/implement it welcome...
Very strange that popular IPTV apps like OTT Navigator and Tivimate use kodi iptv playlist format still the same playlist works in Tivimate and OTT Navigator even in old versions but kodi always has some issues be it add-on/kodi version/manifest/drm or character limit
you are talking of totally different things... and not the right place, anyway if you focus the development of an app for a single operating system, you have availability of system or external libraries (developed by big communities and supported by companies) already prepared for use. android apps use ready-made frameworks and external libraries to manage everything, apps have little proprietary custom implementations, "just" integrate and configure existing libraries to the app for the playback and go... they support Kodi ISA properties, only for "compatibility", they do not cooperate with us, if we change a ISA properties (and will do in future) they will go out of specs
kodi instead must be cross-platform, to achieve this must access to low level things and custom implementations there are few c++ libraries that can be adapted/integrated for this use case so we have to manage by ourself every single part, manifest parsing, decoding, decrypting, codecs, hardware/software compatibility, manage live streaming, buffering, and much more...its a big task and therefore difficult to maintain also due to lack of devs
Describe the problem
Hi. I am trying to play Widevine encrypted content. I am using the default
R{SSM}|R
. But the content fails to play. The playback works fine on other players like OTT Nav and NS Player.The response is very small in size around 668 bytes.
Possible fix
No response
Steps to reproduce
No response
Debug log
Stream manifest file(s)
Additional info
No response
Operating system(s)
Android, Linux, Windows
Operating system version(s)
Android 14, Arch Linux, Windows 11
InputStream Adaptive version(s)
22.1.2 (Compiled from Piers branch)
Kodi version(s)
22.0-ALPHA1 (21.90.700) Git:20240820-178dc39-dirty (Compiled from Master branch)