kingslay / KSPlayer

A video player for iOS、macOS、tvOS、visionOS , based on AVPlayer and FFmpeg, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, support subtitles.
GNU General Public License v3.0
868 stars 182 forks source link

[tvOS] 4K content on 1080p displays stutter and buffer a lot #776

Closed parski closed 1 month ago

parski commented 2 months ago

Describe the bug If you try to play 4K content on an 1080p display on tvOS the video will stutter and buffer a lot. Not sure what to do about it. It also happens in TracyPlayer.

To Reproduce Steps to reproduce the behavior:

  1. Play 4K content.

Expected behavior I expect the content to play normally.

Screenshots (I've added a UIActivityIndicatorView to show on KSPlayer.KSPlayerState.buffering) https://github.com/kingslay/KSPlayer/assets/2445818/6db41a3c-ec98-4c59-a799-b8c0fd089e8c

Platform (please complete the following information):

Additional context I use KSPlayerLayer but it seems to happen on every implementation of these players. I used wired ethernet and have no problem with bandwidth. Playback works perfectly fine on a 4K Apple TV.

kingslay commented 2 months ago

你可以试着在设置-视频里面 把 Use DisplayLayer 设置为false。看下会不会还有这个问题。

parski commented 2 months ago

Setting the option to Off in TracyPlayer makes no discernable difference. Not sure how it's supposed to be set in KSPlayer as the option seems to be a getter only but I'm seemingly able to achieve the same thing through tweaking the logic a bit. Either way, makes no difference.

I've been playing around with altering the CVPixelBuffer but it turns out I have no idea what I'm doing.

Screenshot 2024-04-24 at 08 55 45

Is anyone able to reproduce the problem? I really don't think it's a bandwidth issue. I did a speed test over Wi-Fi which should be my slowest testable speed on this device and I'm getting around 100/100 Mbps. The video I'm testing with (same one as in the original post) has a bitrate between 2-10 Mbps, so well within capacity.

Screenshot 2024-04-24 at 09 11 13 Screenshot 2024-04-24 at 09 11 52
parski commented 2 months ago

It doesn't seem to happen when I set my 4K Apple TV to 1080p output.

kingslay commented 2 months ago

@parski 你可以试着把一个4k的视频片段放到app里面。然后试着进行播放。看会不会有问题。这样就可以排除网络的问题。

kingslay commented 2 months ago

@parski 如果不是网络问题的话,那应该就是解码耗时太久了。那可以试下在设置-视频 把 asynchronous Decompression 设置为true。看下是否有效果。如果还是没有效果的话,那就没有什么好的办法了。这个应该就是硬件的问题,无法顺畅的解码4k的内容。最后你也可以试下mpv或是vlc。看下他们播放4k的内容是不是也会有这个问题。