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

[Bug] ISA fails to play content with Widevine DRM #1657

Open
lavish440 opened this issue Aug 25, 2024 · 40 comments
Open

[Bug] ISA fails to play content with Widevine DRM #1657

lavish440 opened this issue Aug 25, 2024 · 40 comments
Labels
Duplicate This issue or pull request already exists Triage: Confirmed issue has been reproduced by a team member

Comments

@lavish440
Copy link

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

2024-08-25 19:45:11.558 T:6522     info <general>: Creating InputStream
2024-08-25 19:45:11.559 T:6522     info <general>: AddOnLog: inputstream.adaptive: [Repr. chooser] Resolution set: 1920x1200, max allowed: 1920x1200, Adjust refresh rate: 0
2024-08-25 19:45:12.798 T:6522  warning <general>: AddOnLog: inputstream.adaptive: ParseManifest: The <UTCTiming> tag element is not supported so playback problems may occur.
2024-08-25 19:45:12.799 T:6522     info <general>: AddOnLog: inputstream.adaptive: Manifest successfully parsed (Periods: 1, Streams in first period: 2, Type: live)
2024-08-25 19:45:12.819 T:6522    error <general>: AddOnLog: inputstream.adaptive: ConvertKidStrToBytes: Cannot convert KID "" as bytes due to wrong size
2024-08-25 19:45:12.819 T:6522  warning <general>: AddOnLog: inputstream.adaptive: Initializing stream with unknown KID!
2024-08-25 19:45:13.301 T:6522    error <general>: AddOnLog: inputstream.adaptive: ConvertKidStrToBytes: Cannot convert KID "" as bytes due to wrong size
2024-08-25 19:45:13.301 T:6522     info <general>: Skipped 3 duplicate messages..

Stream manifest file(s)

<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011"
	xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
	type="dynamic" availabilityStartTime="1970-01-01T00:00:00Z"
	publishTime="2024-08-25T14:15:11.000022Z" minimumUpdatePeriod="PT8S"
	timeShiftBufferDepth="PT4H10M" maxSegmentDuration="PT8S" minBufferTime="PT30S"
	profiles="urn:mpeg:dash:profile:isoff-live:2011">
	<Period id="1" start="PT0S">
		<BaseURL>
			https://example.xyz/output/dash/
		</BaseURL>
		<AdaptationSet id="1" group="1" contentType="audio" segmentAlignment="true"
			audioSamplingRate="48000" mimeType="audio/mp4" codecs="mp4a.40.2" startWithSAP="1">
			<AudioChannelConfiguration
				schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" />
			<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
			<Representation id="audio_77200_und=75200" bandwidth="75200">
				<SegmentTemplate timescale="48000"
					initialization="something-$RepresentationID$.dash?hdnea=exp=END_EPOCH=~acl=/*~hmac=feedfadebeefcafe"
					media="something-$RepresentationID$-$Number$.m4s?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe"
					startNumber="215572539">
					<SegmentTimeline>
						<S t="82779854592000" d="384000" r="1874" />
					</SegmentTimeline>
				</SegmentTemplate>
			</Representation>
			<ContentProtection value="cenc" schemeIdUri="urn:mpeg:dash:mp4protection:2011" />
			<ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95"
				value="PlayReady" />
			<ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
				value="Widevine">
				<cenc:pssh>
					REDACTED
				</cenc:pssh>
			</ContentProtection>
		</AdaptationSet>
		<AdaptationSet id="2" group="2" contentType="video" par="4:3" minBandwidth="229600"
			maxBandwidth="1272000" maxWidth="854" maxHeight="640" segmentAlignment="true"
			frameRate="25" mimeType="video/mp4" startWithSAP="1">
			<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
			<Representation id="video=229600" bandwidth="229600" width="320" height="180" sar="3:4"
				codecs="avc1.4D400C" scanType="progressive">
				<SegmentTemplate timescale="600"
					initialization="something-$RepresentationID$.dash?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe"
					media="something-$RepresentationID$-$Number$.m4s?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe"
					startNumber="215572539">
					<SegmentTimeline>
						<S t="1034748182400" d="4800" r="1874" />
					</SegmentTimeline>
				</SegmentTemplate>
			</Representation>
			<Representation id="video=454400" bandwidth="454400" width="480" height="270" sar="3:4"
				codecs="avc1.4D4015" scanType="progressive">
				<SegmentTemplate timescale="600"
					initialization="something-$RepresentationID$.dash?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe"
					media="something-$RepresentationID$-$Number$.m4s?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe"
					startNumber="215572539">
					<SegmentTimeline>
						<S t="1034748182400" d="4800" r="1874" />
					</SegmentTimeline>
				</SegmentTemplate>
			</Representation>
			<Representation id="video=863200" bandwidth="863200" width="640" height="360" sar="3:4"
				codecs="avc1.4D401E" scanType="progressive">
				<SegmentTemplate timescale="600"
					initialization="something-$RepresentationID$.dash?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe"
					media="something-$RepresentationID$-$Number$.m4s?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe"
					startNumber="215572539">
					<SegmentTimeline>
						<S t="1034748182400" d="4800" r="1874" />
					</SegmentTimeline>
				</SegmentTemplate>
			</Representation>
			<Representation id="video=1272000" bandwidth="1272000" width="854" height="480"
				sar="320:427" codecs="avc1.4D401E" scanType="progressive">
				<SegmentTemplate timescale="600"
					initialization="something-$RepresentationID$.dash?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe"
					media="something-$RepresentationID$-$Number$.m4s?hdnea=exp=END_EPOCH~acl=/*~hmac=feedfadebeefcafe"
					startNumber="215572539">
					<SegmentTimeline>
						<S t="1034748182400" d="4800" r="1874" />
					</SegmentTimeline>
				</SegmentTemplate>
			</Representation>
			<ContentProtection value="cenc" schemeIdUri="urn:mpeg:dash:mp4protection:2011" />
			<ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95"
				value="PlayReady" />
			<ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
				value="Widevine">
				<cenc:pssh>
					REDACTED
				</cenc:pssh>
			</ContentProtection>
		</AdaptationSet>
	</Period>
	<UTCTiming schemeIdUri="urn:mpeg:dash:utc:http-iso:2014" value="https://time.akamai.com/?iso" />
</MPD>

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)

@lavish440 lavish440 added the Triage: Needed (managed by bot) issue that was just created and needs someone looking at it label Aug 25, 2024
@CastagnaIT CastagnaIT added Triage: Confirmed issue has been reproduced by a team member and removed Triage: Needed (managed by bot) issue that was just created and needs someone looking at it labels Aug 26, 2024
@CastagnaIT
Copy link
Collaborator

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

@lavish440
Copy link
Author

So it will take some time then.
Will something like this work in Shaka?

@CastagnaIT
Copy link
Collaborator

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

@lavish440
Copy link
Author

So if I compile from the Piers branch, then it should work?

@CastagnaIT
Copy link
Collaborator

CastagnaIT commented Aug 26, 2024

no, or you use test builds or you have to get it from the relative branch on my personal repository, see PR

@lavish440
Copy link
Author

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?

@CastagnaIT
Copy link
Collaborator

CastagnaIT commented Aug 26, 2024

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

@lavish440
Copy link
Author

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.

@CastagnaIT
Copy link
Collaborator

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

@lavish440
Copy link
Author

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

@CastagnaIT
Copy link
Collaborator

debug infos are needed

@lavish440
Copy link
Author

For a specific component or Kodi as a whole?

@CastagnaIT
Copy link
Collaborator

stadard kodi debug, no specific component

@lavish440
Copy link
Author

lavish440 commented Aug 26, 2024

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

@lavish440
Copy link
Author

Here is the full log:
Kodi Debug Log

@CastagnaIT
Copy link
Collaborator

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

@lavish440
Copy link
Author

lavish440 commented Aug 26, 2024

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?

@CastagnaIT
Copy link
Collaborator

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

@lavish440
Copy link
Author

I have sent you the manifest and the initialisation files via email.

@lavish440
Copy link
Author

Can you confirm you have received it?

@CastagnaIT
Copy link
Collaborator

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 #1657 (comment)

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

@CastagnaIT
Copy link
Collaborator

i think i found also a my mistake, i update the PR soon

@CastagnaIT
Copy link
Collaborator

my PR/branch updated, let me know

@CastagnaIT
Copy link
Collaborator

ok i found also another problem, i need to investigate better
i will let you know when done

@CastagnaIT
Copy link
Collaborator

updated again my PR/branch
this time will force update also init data from mp4 so i hope it works

@lavish440
Copy link
Author

lavish440 commented Aug 26, 2024

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 #1657 (comment)

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.

@lavish440
Copy link
Author

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.

@CastagnaIT
Copy link
Collaborator

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

@lavish440
Copy link
Author

lavish440 commented Aug 26, 2024

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.

@CastagnaIT
Copy link
Collaborator

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

@lavish440
Copy link
Author

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.

@CastagnaIT
Copy link
Collaborator

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

@lavish440
Copy link
Author

I have emailed you everything you need.
Sorry for the delay as I was a little busy today.

@CastagnaIT
Copy link
Collaborator

CastagnaIT commented Aug 27, 2024

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

@lavish440
Copy link
Author

lavish440 commented Aug 27, 2024

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

@CastagnaIT
Copy link
Collaborator

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

@CastagnaIT CastagnaIT added the Duplicate This issue or pull request already exists label Aug 28, 2024
@lavish440
Copy link
Author

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?

@aicynide
Copy link

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?

@CastagnaIT
Copy link
Collaborator

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

@lavish440
Copy link
Author

@CastagnaIT I tried some Clearkey DRM streams which don't have a default KID in the dash manifest but have it in the initial segments and all of them works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate This issue or pull request already exists Triage: Confirmed issue has been reproduced by a team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants