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

NAL Unit exceeds subsample definition #208

Closed
matthuisman opened this Issue Nov 27, 2018 · 59 comments

Comments

Projects
None yet
@matthuisman
Copy link

matthuisman commented Nov 27, 2018

Hi @peak3d

3 out of 4 streams work with this provider.

But one stream errors with a bunch of 'NAL Unit exceeds subsample definition'.
I have tried the stream via their official Android app (exoplayer) and it does playback (using same MPD file & Widevine license).

Using KODI RC1 Windows 64bit

Let me know if you need a live test stream and I can sort for you

@matthuisman

This comment has been minimized.

Copy link
Author

matthuisman commented Nov 29, 2018

Looks like this NAL Unit error is happening on all streams on Android.

@matthuisman

This comment has been minimized.

Copy link
Author

matthuisman commented Dec 3, 2018

@peak3d
Seems this is popping up with some other add-ons now as well.

Any ideas?
Did you want me to get you a test stream?

@peak3d

This comment has been minimized.

Copy link
Owner

peak3d commented Dec 4, 2018

@matthuisman pls. download the video init.m42 and the m4s file where the issues start

in the log above:
https://neunlds638oc.akamaized.net/nlds/skysportsfanpass/drm_sky1/as/live/nlncp/drm_sky1_hd_1600_video/Time=init.m4s
and
https://neunlds638oc.akamaized.net/nlds/skysportsfanpass/drm_sky1/as/live/nlncp/drm_sky1_hd_1600_video/Time=1543446998000.m4s

I cannot read from log if audio or video is the issue, so pls. restict in inputstream.adaptive settings to video / audio and look which stream is the bad one.

@joshjryan

This comment has been minimized.

Copy link

joshjryan commented Dec 4, 2018

Additional info, for reference: when I see this same error (referenced in maxgalbu/xbmc.plugin.video.nba#87), I hear audio, but no video is displayed.
If it's helpful, I can try to also get additional logging sometime today.

@cablegoon

This comment has been minimized.

Copy link

cablegoon commented Dec 9, 2018

I am having the same issue on a fire tv and sheild (android tv) with various releases on kodi. Let me know if you want logs from my end too.
this happens with the NBA league pass app

@micahg

This comment has been minimized.

Copy link

micahg commented Dec 10, 2018

I get this too with my sportsnet addon. It works on Ubuntu (64bit) but fails on my Android machines. Please let me know if I can assist.

@joshjryan

This comment has been minimized.

Copy link

joshjryan commented Dec 20, 2018

Note: I am still seeing the same issue with RC3.

@Lakersfan16

This comment has been minimized.

Copy link

Lakersfan16 commented Dec 30, 2018

@cablegoon @joshjryan Any solutions for the only Audio problem yet?

@UniqueSports

This comment has been minimized.

Copy link

UniqueSports commented Jan 5, 2019

We have the same audio only issue on Android devices (checked on a mobile and an NVIDIA SHIELD). Our source is same as the NBA league pass app. Can provide logs and the video chunks in question if interested.

@matthuisman
You might wanna remove sensitive info such as tokens from the logs before posting them publicly.

@ivankokan

This comment has been minimized.

Copy link

ivankokan commented Jan 8, 2019

Hi @peak3d, I have been comparing implementations of WV_CencSingleSampleDecrypter::DecryptSampleData under all three wvdecrypter*.cpp files, and noticed some differences at the methods' beginnings. Are these intentional, are they maybe the root cause of "audio+ video-" issue on Android TVs?

@joshjryan

This comment has been minimized.

Copy link

joshjryan commented Jan 8, 2019

If helpful, here are the logs from when I receive the "NAL Unit exceeds subsample definition" error: http://paste.kodi.tv/ijeqojuduy

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

hey guys
for those of you who are able to compile kodi , I've discovered a patch that seems to eliminate this issue .
I have not tested it extensively , please test and inform the results .
The patch is in the file that outputs the message ( the one that ends in "jni.cpp" ) and is inserted just before the test the causes the message .
here it is :
// bypass all validity tests if packet is complete
if (packet_in == packet_in_e )//packet completed ok
{
data_out.SetDataSize(data_out.GetDataSize() + data_in.GetDataSize() + configSize + (4 - fragInfo.nal_length_size
) * nalunitcount);
return AP4_SUCCESS;
}

// old test , do not change this in the original code , just insert the above lines before this test .
// as i've modified the old test for debugging , no need to modify original code .
if (nalsize + fragInfo.nal_length_size_ + nalunitsum > *Clear + *Cipher)

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

this file is in the wvdecryper folder .
If anyone succeeds in building an apk with this patch and it works , please share it .

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

for the first time in almost a year , i am able to watch league pass on kodi android . ( denver game ) . I'll update if
it survives till the end of the game .

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

It did

@UniqueSports

This comment has been minimized.

Copy link

UniqueSports commented Jan 18, 2019

It did

@lyossy
Hey, Nice work!

Do you know how to cross compile the patch on Ubuntu for Android arm devices ?

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

kodi themselves have a file called "readme.md" that has instructions compiling on ubuntu 16.04 for all
3 platforms : arm7,arm8,x86 ..
google "compiling kodi for android" .
I was not able to generate the full apk , as on my setup it reached 99% and failed .
I was able to build just the buggy library for arm v7 .
It is called "libssd._uv.so" .
by replacing this library with the one i built with said patch , i was able to watch streams that previously
only played audio .

@UniqueSports

This comment has been minimized.

Copy link

UniqueSports commented Jan 18, 2019

@lyossy
Hey, thanks for the reply. Yes, I was using the guide on https://github.com/xbmc/xbmc/blob/master/docs/README.Android.md

I'm not sure how to generate the apk from the modified local version. I'm not a C++ guy and have even less experience with the kodi development itself.

Did you just target arm7 when building the library itself (not the apk) ?

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

hi
I initially selected the armv7 enviorment as it runs fine on the other platforms .
I am running it on an x86 cheapo chinese tablet and it runs fine .

@UniqueSports

This comment has been minimized.

Copy link

UniqueSports commented Jan 18, 2019

@lyossy
Okay, thanks. I'm going to try it again on an AWS instant since my VPS ran out of space when compiling the build tools.

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

first of all i tried to build the apk . this sets up the enviionrment for compiling the addons .
later , i just ran the make process in the library folder .
I'm not sure if it's allowed , but i can send you a patched apk that i created that includes the patched library .Can somebody comment if this is allowed ?
If so , send me a link to a location i can upload to ( file is 62 MB )

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

works on mibox 3 ( amlogic s905x androidtv )

@Lakersfan16

This comment has been minimized.

Copy link

Lakersfan16 commented Jan 18, 2019

@lyossy what exactly do I need to change now to get video and audio? (Sorry im new to this)

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

are you a programmer or at least
proficient in programming ?

@Lakersfan16

This comment has been minimized.

Copy link

Lakersfan16 commented Jan 18, 2019

@lyossy im a bit proficient

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

you need to edit a cpp file whose name
ends with "_jni.cpp" in the wvdecryper
folder . you have to insert the 3 lines of
cpp code i posted a few hours ago just
before the test that causes the "NAL"
error to appear .
than , rebuild the kodi apk ( make sure
you have rebuilt the addons ) .
uninstall your current leia installation
and install the apk you built .

@Lakersfan16

This comment has been minimized.

Copy link

Lakersfan16 commented Jan 18, 2019

@lyossy you said earlier you can send us the apk. So is this still the case?

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

You must realize that i was not able to
build the apk from source , so i modified
the existing rc5.2 apk to include my patch . I don't know what is the policy of
team kodi regarding distribution of such an apk .
If somebody can verify it's ok , and provide an upload link that can host 60+
mb i will upload the apk .

@Lakersfan16

This comment has been minimized.

Copy link

Lakersfan16 commented Jan 18, 2019

I think as long as you dont say that it is an official version it should be alright.
https://uploadfiles.io

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

OK , give me a few minutes .

@Lakersfan16

This comment has been minimized.

Copy link

Lakersfan16 commented Jan 18, 2019

@lyossy Thanks man. Appreciate it

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

OK , I sent you the link . note that the file will be available for an hour , as I am not sure I'm allowed to share it .
Remember you need to uninstall previous Leia installation , otherwise apk will not install ( it is not accepted as an update )
Please inform the forum how it goes .

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

You can test it immediately using archived games . also I noted that the league pass add-on is not working well after installation of the add-on . after a reboot it works much better

@Lakersfan16

This comment has been minimized.

Copy link

Lakersfan16 commented Jan 18, 2019

It works perfectly. Thanks man. Finally i can watch the NBA on the big screen. Appreciate your effort. 🐐

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

Have fun 😋
Can you specify your device , CPU , android version .
Verified on MINIX neo u9 , a logic s912 , regular android 6.0

@Lakersfan16

This comment has been minimized.

Copy link

Lakersfan16 commented Jan 18, 2019

@lyossy Device: Orbsmart S84
CPU: AML S912 Octa Core ARM Cortex-A53
Android 7.1

@peak3d

This comment has been minimized.

Copy link
Owner

peak3d commented Jan 18, 2019

Sorry for absense, was anyone able to pull a sample stream (segment) ?
Simply look into kodi log, and pick the URL of one downloaded segment (video I guess)

The "fix" provided above will not be accepted until the root cause is clear.

Thx for the work done here!

@angus1225

This comment has been minimized.

Copy link

angus1225 commented Jan 18, 2019

Thanks for the big work!!
Don't leave us apart!!

@blairhandley

This comment has been minimized.

Copy link

blairhandley commented Jan 18, 2019

Hey @lyossy there could I please have a copy aswell

@lyossy

This comment has been minimized.

Copy link

lyossy commented Jan 18, 2019

Sorry , I am not allowed to distribute it . however , I believe an official solution is coming soon . if you can't wait , you can build the apk yourself . please note that this is just an ad hoc patch , until an official solution is available , and is proven working only on current NBA international league pass . I have no idea if it works with other sources . I did this out of a personal need , and made it public to help fellow lp subscribers .
It was not my intention to offend anybody .

@UniqueSports

This comment has been minimized.

Copy link

UniqueSports commented Jan 19, 2019

@peak3d
Here are few chunks form a while back. https://www.mediafire.com/folder/vbtb4z8u84v1y/ this contain a playlist, two init chunks (video) from two different bitrates, one regular video chunk and an audio init chunk.

let me know if you need anything else.

@peak3d

This comment has been minimized.

Copy link
Owner

peak3d commented Jan 19, 2019

Thx @UniqueSports , will look today at the issue

@matthuisman

This comment has been minimized.

Copy link
Author

matthuisman commented Jan 20, 2019

@peak3d
I've also just emailed you some files :)

@peak3d

This comment has been minimized.

Copy link
Owner

peak3d commented Jan 21, 2019

I pushed the fix, version is 2.3.13, pls. verify, thx!
B.t.w. thx @UniqueSports / @matthuisman for providing sample files!

@dwane3

This comment has been minimized.

Copy link

dwane3 commented Jan 21, 2019

Where is download 2.3.13?

@dwane3

This comment has been minimized.

Copy link

dwane3 commented Jan 21, 2019

peak3d, please update to 2.3.13 version on official repo..

@peak3d

This comment has been minimized.

Copy link
Owner

peak3d commented Jan 22, 2019

@dwane3 you can either wait for tomorrows kodi nightly packages, or download the addon from here:
-> https://jenkins.kodi.tv/blue/organizations/jenkins/peak3d%2Finputstream.adaptive/detail/2.3.13/1/artifacts

After downloading you can run "Install from zip" in addon section

@matthuisman

This comment has been minimized.

Copy link
Author

matthuisman commented Jan 22, 2019

Tested on Windows and confirm the 4th stream that wasn't working is now working.
Will try on Android soon

@matthuisman

This comment has been minimized.

Copy link
Author

matthuisman commented Jan 22, 2019

Hmm

Android seems to be playing but is just white noise and KODI's GUI goes all "funny" as well.
This is on all 4x streams of this particular add-on.

Using KODI 18 RC 5.2 ARMV8
And used your android-aarch64/inputstream.adaptive-2.3.13.zip

Also tried other Widevine content on another add-on and it played fine.

I've emailed @peak3d with debug log, and all the corresponding video / audio files

Oh wait... I don't think you can install binary add-ons via zip in Android?
Maybe it's still using the older version.
I'll try nightly build for Android...

Yes, latest nightly (kodi-20190122-1f5af1ae-master-arm64-v8a.apk) on Android works.
Don't try to install zip (like I did) in Android RC as it won't work

@joshjryan

This comment has been minimized.

Copy link

joshjryan commented Jan 23, 2019

Latest nightly fixed it for me.
Android
32-bit
FireTV stick 4k
NBA League Pass plugin (@ivankokan's fork, which handles the PIL issues from the official repo)

@matthuisman

This comment has been minimized.

Copy link
Author

matthuisman commented Jan 23, 2019

Fixed in v2.3.13 22baed3
Thanks @peak3d

@micahg

This comment has been minimized.

Copy link

micahg commented Jan 23, 2019

Hi, I can also confirm this fixed my issues. Tested 2.3.13 on my firestick and mi box.

Thanks very much!

@matthuisman matthuisman referenced this issue Jan 23, 2019

Closed

No video #1

@cablegoon

This comment has been minimized.

Copy link

cablegoon commented Jan 28, 2019

works for me - thanks for everyones help

@matthuisman matthuisman reopened this Jan 31, 2019

@matthuisman

This comment has been minimized.

Copy link
Author

matthuisman commented Jan 31, 2019

I have found that I get no audio on Windows KODI 18 on that same troublesome stream.
KODI 18 Android works fine though.
screenshot000

To get a better debug log, I switched Inputstream to Audio only.
Played one of the good streams and then played the stream that fails.

I will email @peak3d the needed files to debug :)

@peak3d

This comment has been minimized.

Copy link
Owner

peak3d commented Jan 31, 2019

This thread seems not to be related to the issue, pls. open a new issue for this, thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment