xbmc / inputstream.adaptive

kodi inputstream addon for several manifest types
Other
451 stars 241 forks source link

Frame dropping playing 1080p (Netflix, Disney) #460

Closed facakente closed 1 year ago

facakente commented 4 years ago

Every time I play 1080p in kodi in my firestick 4K , I get regularly frames dropping / stuttering , image is not fluid at all.

It happens only with Netflix and Disney , tested other addons and play fine.

On the other hand when playing hdr10 or DV it does play fine , no frame dropping .(Disney or Netflix)

https://paste.kodi.tv/pucovakeko

Played 2 movies in hd , frames drop , then played one movie in DV , no problems .

I suppose problem isn’t the build but the new IA I have installed to fix other problems I had with Netflix or Disney .

facakente commented 4 years ago

@peak3d maybe u can help here

peak3d commented 4 years ago

From log you play a 4K stream:

CDVDVideoCodecAndroidMediaCodec:: width(3840), height(2160), stride(0), slice-height(0), color-format(0)

With 4K streams on your device you are a little bit on the limit what the device can do. Only tunneled playback can probably solve the issues, but this is not (yet) implemented in kodi

peak3d commented 4 years ago

Ok, found your HD streams, but there is nothing obvious in log. Because IA is not doing any timing (it just provides the data to kodi) it is very unlikely that IA is the reason. Pls. file a github issue in the kodi github repo, after trying to playback with "Sync playback to display" in settings::player On.

facakente commented 4 years ago

Ok will do , but I have already tested sync playback to display on , also the video only in IA settings but none of them resolve the issue , still having this problem. You mentioned the device is on limit when playing a 4K stream , though i had no problems with 4K streams.

peak3d commented 4 years ago

I revised my first post from today.

1.) From where do you know that frames are dropped? 2.) Whats the title of the D+ stream?

facakente commented 4 years ago

Dev mode in the firestick , though was just to confirm , as visually I can see that image is not fluid .

Tried inside out and toy story 4 , both hd, but happens with any tested until now .

Just finished to try on matrix and old 18.6 leia stable and the same happens.

peak3d commented 4 years ago

Dev mode == "O" overlay in kodi? Or do you mean AFTV dev tool ?

facakente commented 4 years ago

I mean the firestick dev tool .

Uukrull commented 4 years ago

This was already discussed here:

https://github.com/CastagnaIT/plugin.video.netflix/issues/197

facakente commented 4 years ago

Yes and after checking that issue and disabling frame rate in Firestick settings resolved the frame dropping issue.

facakente commented 4 years ago

However after this change just noticed now that I am unable to whitelist 24p resolutions , they disappeared once I have deactivated frame matching.

Strange I am almost sure when I deactivated for first time to test hd streams it was played in 1080 /24 , currently I just can play in 60p.

facakente commented 4 years ago

yes in order to get all whitelists modes I need to set frame rate on in the Firestick settings.

peak3d commented 4 years ago

I tried with my AFTV 4K stick:

It's a 1080p stream which plays at 23.94fps. There is no single frame drop for me. Can you please play this stream, and avoid refreshrate switching by setting kodi as mentioned above to 23.94hz ?

facakente commented 4 years ago

i have followed your steps and that way i do not have a single frame drop, though i do not have a single drop either with refresh rate on start/stop.

that's why i think problem is related specifically with IA that netflix and disney uses.

As only with these 2 addons i experience this kind of issue.

I will now try your steps playing one of those hd streams.

facakente commented 4 years ago

so playing your video no frames dropping, playing any disney or netflix video, i have frames dropping.

Do you want a log where i can play your video and one hd stream?

facakente commented 4 years ago

https://paste.kodi.tv/difuzucini

first played hd stream, inside out

later your video, just dropped 4 frames after i have move forwarded a couple of min

peak3d commented 4 years ago

yes, can reproduce here

peak3d commented 4 years ago

Ok, solution for Disney is to disable the secure avc decoder, seems that it doesn't work properly. Currently IA has no sign if the stream needs a secure decoder, but it can be controlled in the addon.

@matthuisman can maybe tell more about the options in Disney+ addon, and @CastagnaIT for Netflix.

Edit: Seems that only HD plays without secure decoder, so 1080p requires it. For me it seems that the secure AVC decoder has some performance issues, the HEVC decoder not.

matthuisman commented 4 years ago

Disney is limited to 720 without secure decoder.

With secure decoder does enabling h265 in settings help? Most android devices should support h265? Pretty sure I enable that by default.

And correct, looks like hls has no way to identify if secure decoder is needed.

facakente commented 4 years ago

The only way to fix this for Disney is to disable l1 widevine, otherwise there is the issue.

For Netflix there isn’t any workaround so far.

peak3d commented 4 years ago

Yes, sorry, nothing I can change - file a bug report on amazon, below the content of a test strm file where you comment out line 6 (##) to use the unsecure decoder, or leave it as it is to use the secure decoder.

There is nothing different in kodi, only the usage of the secure decoder or not.

#KODIPROP:inputstream=inputstream.adaptive
#KODIPROP:inputstreamaddon=inputstream.adaptive
#KODIPROP:inputstream.adaptive.manifest_type=mpd
#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha
#KODIPROP:inputstream.adaptive.license_key=https://proxy.uat.widevine.com/proxy?video_id=d286538032258a1c&provider=widevine_test||R{SSM}|
#KODIPROP:inputstream.adaptive.license_flags=force_secure_decoder
https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd
matthuisman commented 4 years ago

@CastagnaIT could add a setting to Netflix to enable / disable secure decoder?

I think Netflix generates a MPD for playback. So, if secure decoder is off, could remove robustness_level from mpd and drop the quality?

Here is where L1 secure decoder is enabled: https://github.com/CastagnaIT/plugin.video.netflix/blob/fa481f08071308abcd1758dab4edaa83f8f4f002/resources/lib/services/msl/converter.py#L110

I suspect those resolutions won't play without that, so maybe you can just SKIP them if Secure Decoder is turned off in settings?

@facakente does enabling H265 not make a difference? I thought that would then use the HEVC decoder even for 1080

facakente commented 4 years ago

No , only way to fix it is to disable L1. I played with all options but problems persists.

matthuisman commented 4 years ago

And just a FireTV issue right? Fine on Shield / other android?

peak3d commented 4 years ago

At least on shield this issue does not exist

fritsch commented 4 years ago

When I read multiple replies. Wasn't it working when you switch the refresh rate before kodi is starting the video?

Could it be that the secure decoder somehow does not know about the fps? If it got the above right?

peak3d commented 4 years ago

Nope, I tried this @fritsch but no difference. Also opening gui overlay as some mentioned doesn't solve it

matthuisman commented 4 years ago

Has anyone tried a build without the jni commit just out of interest? I know that commit is here to stay but would just be interested to see if it works. If so, we know its possible?

http://mirrors.kodi.tv/test-builds/android/arm/kodi-20200521-6e4c8210-revertjnileia-armeabi-v7a.apk

peak3d commented 4 years ago

This issue was present already with 18.6 / ndk

matthuisman commented 4 years ago

Oh OK. Sorry. I thought it was newer!

CastagnaIT commented 4 years ago

hi, i read all discussion now

@facakente can you say the name of settings you try to disable? (just for understand)

Yes and after checking that issue and disabling frame rate in Firestick settings resolved the frame dropping issue.

@facakente have you tried to remove the "HW_SECURE_CODECS_REQUIRED" text to this line? https://github.com/CastagnaIT/plugin.video.netflix/blob/fa481f08071308abcd1758dab4edaa83f8f4f002/resources/lib/services/msl/converter.py#L113 this disable securedecoder

start to become a bit too many options to add for devices that don't work well and this is confusing for me and also for users, first i want to understand the possible solutions if any

facakente commented 4 years ago

@CastagnaIT in Netflix in UI I didn’t see any option that could impact hd streams , I have disabled hdr profiles , nothing else.

Regarding the code line you mentioned, no i did not test it , i am not familiar with it , so if someone can remove that line and send me the link to test it , I am happy to do it.

CastagnaIT commented 4 years ago

There plugin.video.netflix_1.4.0_20200607_k18.zip

peak3d commented 4 years ago

@CastagnaIT from what I can tell you don't have to do anything here. FHD streams need the secure decoder, and removing the flag lead to non-playback. Only SD (and for Disney HD) streams are working. Much easier workaround for @facakente is use the 3 refreshrates which are provided by default from his device (60 / 59.9 / 50) and be happy that a 30 EUR device works so nice.

Or - file an issue report on Amazon.

CastagnaIT commented 4 years ago

well, so the problem is only on 24 fps?

I was thinking about buying this device but if have this problem, i prefer to continue using my fat HTPC...

facakente commented 4 years ago

if playing with this last change, stream does not even start, keeps loading but i can see that time is moving forward.

CastagnaIT commented 4 years ago

yes as Peak3d explain this is not a solution usable with your L1 device then cause break of playback..

facakente commented 4 years ago

ok i see, didnt see comment above.

Yep i see we need to deal with this limitation, not sure if amazon will do anything here.

Anyway thanks for the help guys.

At least hdr streams work fine.

Indeed for 30£ i must say this is a very good device.

peak3d commented 4 years ago

@CastagnaIT the device plays the content nice on 59.9hz. You don't do anything wrong trying this device, really.

mano3m commented 4 years ago

I can confirm using an overlay like CTRL+SHIFT+O completely fixes the stutters with 1080p streams on my fire TV 4k. What does Kod do differently with an overlay on screen?

dagwieers commented 4 years ago

@mano3m What do you mean with overlay?

I have a feeling this relates to a problem I reported a year ago: https://github.com/xbmc/xbmc/issues/16299

CastagnaIT commented 4 years ago

he means "overlay" tha graphics over the video images (like Coded info, by press key O)

some year ago similar issue was on windows when playing videos in DXVA in hardware decoding, and has been fixed by fernetmenta or afedchin i do not remember perhaps was this PR: https://github.com/xbmc/xbmc/pull/11301 or some PR with refactor/rework

peak3d commented 4 years ago

I can confirm using an overlay like CTRL+SHIFT+O completely fixes the stutters with 1080p streams on my fire TV 4k. What does Kod do differently with an overlay on screen?

Beside the fact that I cannot confirm (stutter even with overlay), the question is more what surfaceflinger is doing different if it composes gui and video frame.

mano3m commented 3 years ago

Any update on this one? I can confirm an overlay doesn't always help. It does always make it a lot better.

wsnipex commented 3 years ago

Would it be possible to allow the addon to disable refresh rate switching in kodi? That could be a viable workaround for netflix. Or some way to force hevc profiles? btw, how can I verify that hevc profiles work without a 4k TV?

mano3m commented 3 years ago

Obviously you can disable that in Kodi setting. It however defies the purpose for me of using Kodi over the normal Netflix app, which lacks the ability to do refresh rate switching... Watching a 24p video at 60hz refresh rate on my 100ft projection screen is unbearable for me...

Op zo 25 okt. 2020 10:11 schreef Wolfgang Schupp notifications@github.com:

Would it be possible to allow the addon to disable refresh rate switching in kodi? That could be a viable workaround for netflix. Or some way to force hevc profiles? btw, how can I verify that hevc profiles work without a 4k TV?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpeak3d%2Finputstream.adaptive%2Fissues%2F460%23issuecomment-716116313&data=04%7C01%7C%7Cc093845a70774e313d0208d878c5f4f0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637392138889602519%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=6kqpvv4X2L7RAug6xPDeL3F9ym1Dh9OhKtxbpHwRixM%3D&reserved=0, or unsubscribe https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAFXGBRL6T2TH5MMXPXDY7TSMPTT7ANCNFSM4NVGZAUA&data=04%7C01%7C%7Cc093845a70774e313d0208d878c5f4f0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637392138889612515%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=CKTjLU%2F3MkNU3%2F6rKBefJGoTdjDWIc9LQTCxg2AckaE%3D&reserved=0 .

CastagnaIT commented 3 years ago

Would it be possible to allow the addon to disable refresh rate switching in kodi?

this is not an appropriate option not all videos are available in HEVC, some videos might have different refresh rate and not all devices support HEVC decoding

and would increase the complexity of configuring the addon that i want to avoid, filling the add-on with dedicated options for individual devices only is not acceptable already now in some cases users make a lot of confusion

Or some way to force hevc profiles? btw, how can I verify that hevc profiles work without a 4k TV?

you can try in this way:

if your device not support hevc decoding the screen will be shown black or else kodi will stay in loading loop, if a video works/played you have to check if the video codec is hevc, so in the codec info window shown, see "Video decoder" should say HEVC

CastagnaIT commented 3 years ago

i forgot, if your android device/TV not support HDCP >= 2.2 the media-info flag [ H.265 ] or [4K] are not shown

I suggest you to install the add-on also on a personal computer (on a PC the 4K/HEVC flag are shown) then find a video that have these flags, and play the title on your android device

wsnipex commented 3 years ago

I tried, but couldn't find any hevc stream, so I just went with this workaround: https://github.com/wsnipex/xbmc/commit/5a1c96fcaa466ffd729d39deec43f9101fae7758

build is available for anyone interested: http://mirrors.kodi.tv/test-builds/android/arm/kodi-20201031-5a1c96fc-matrix-wsnipex-aftv4k-armeabi-v7a.apk

hunterzero99 commented 3 years ago

I'm hitting this bug, too. I get dropped frames, and visible stuttering with the Netflix plugin on a Fire Stick 4k when using framerate matching. I have the stutter with 1080p and 4K Dolby Vision files as well (not sure why some others don't seem to).

It is resolved when I turn on Sync Playback to Display, but then I lose passthrough audio. It is resolved when I disable framerate matching and manually set the frame rate to 60fps. It is not resolved when I disable framerate matching and manually set the frame rate before starting playback. It is not resolved when a menu is on the screen.

I'm currently testing on The Queens Gambit episode 3, starting at 23 minutes. It is much more visible during high motion scenes, so either full motion/panning, or scenes with ton's of cuts (the opening sequence of Star vs. the Forces of Evil on Disney+ drops a ton of frames).

If there are any logs or additional information I can provide let me know. I have root access on the device if it makes any difference.