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, SwiftUI, support subtitles.
https://apps.apple.com/app/tracyplayer/id6450770064
GNU General Public License v3.0
980 stars 198 forks source link

25 / 30 FPS streams stutter #493

Closed chillout23 closed 1 year ago

chillout23 commented 1 year ago

@kingslay 50/60 FPS streams work smoothly, but 25/30 FPS streams are stuttering. A fix for this?

kingslay commented 1 year ago

需要提供url。然后我来测试下

chillout23 commented 1 year ago

Here is an example @kingslay

Device: Apple TV 2022 A15 (tvOS 16.5) URL (25 FPS): https://tv-trtworld.live.trt.com.tr/master_1080.m3u8

Demo with KSPlayer: https://zippysha.re/obqdP503z3/KSPlayer_MOV Alternative link: https://streamable.com/st6fus

Demo with VLC: https://zippysha.re/l4q1P60ez0/VLC_MOV Alternative link: https://streamable.com/e5rgar

Notice how KSPlayer makes this stream stutter, it is much easier to see with your eyes. VLC is smooth and looking nice. Something is wrong with KSPlayer.

Hope this can fixed. Thank you!

kingslay commented 1 year ago

@chillout23 很抱歉我看不出Demo with KSPlayer 在那边卡顿。能够跟我说下是在那一秒会卡顿吗?这个卡顿是只在tvos吗? iOS也会吗?

chillout23 commented 1 year ago

@kingslay It stutters throughout the whole video. I have only tried tvOS. This is a huge issue and it affects everyone using Apple TV. Have you tried to playback this stream on tvOS? The demo video can be a little unclear, but if you compare both videos you can see the difference.

kingslay commented 1 year ago

我有在tvos上播放这个url 不会卡顿

chillout23 commented 1 year ago

Which device? Apple TV 2022 model?

kingslay commented 1 year ago

Apple TV 4K

chillout23 commented 1 year ago

Apple TV 4K, which generation?

chillout23 commented 1 year ago

There is a difference between freezing and stutter, the motion is not smooth with KSPlayer, it is smooth with VLC.

kingslay commented 1 year ago

2022 Apple TV 4K在 2023年7月8日,20:15,chillout23 @.***> 写道: Apple TV 4K, which generation?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

chillout23 commented 1 year ago

Do you have an app I can test the same stream? Because on my side this stream stutters.

chillout23 commented 1 year ago

I would also need some help from other users on this forum, because in my testing KSPlayer makes this stream stutter. I have tried apps like Lilly Player, IPTVX, iPlayTV they behave the same. So either @kingslay cannot see the stutter, or there something wrong with my device. If there are other who can test it would be great. KSPlayer is a really good idea, but this needs to get solved.

kingslay commented 1 year ago

Do you have an app I can test the same stream? Because on my side this stream stutters.

你可以用demo里面的app。里面有两个一个是UIKit的版本,一个是SwiftUI版本。

kingslay commented 1 year ago

@chillout23 你这个是音频正常,然后视频会卡顿吗?还是音频和视频都有问题。

kingslay commented 1 year ago

也有其他人报了一个tvos卡顿的问题,他们拍摄的视频就明显。你的问题是跟他的一样吗? #495

Kimentanm commented 1 year ago

也有用户反馈过,就是在AppleTV上播放时,播放50帧会更丝滑一点,30帧会有一点类似掉帧的感觉,倒也不是卡。 其实就是无法动态调整帧率的问题,如果将AppleTV上的视频格式调整为60帧,那么30帧也不卡了

image
chillout23 commented 1 year ago

也有其他人报了一个tvos卡顿的问题,他们拍摄的视频就明显。你的问题是跟他的一样吗? #495

No my sound is good all the time. I have only stuttering of the video, motion is not smooth, and of course I set my Apple TV 4K to 50 hz, as I live in Europe and most broadcasts are 25/50 FPS. So it is not a framerate issue. It is a motion issue in KSPlayer.

chillout23 commented 1 year ago

Very interesting issue this, as 50 FPS streams work silky smooth :)

kingslay commented 1 year ago

@chillout23 你可以试着改下isUseDisplayLayer 这个方法。把它改成返回false 这样就会变成用CAMetalLayer来进行渲染了。可以看下用CAMetalLayer是否会有问题。如果没有问题的话,那就可以明确问题是在于AVSampleBufferDisplayLayer 了。

chillout23 commented 1 year ago

@kingslay How come you cannot see the problem? I think you cannot see it because you dont compare it to something else like VLC. Have them side by side and you can see what I mean.

kingslay commented 1 year ago

因为我这边的设备无法重现这个问题。我用电脑播放vlc 进行对比。没有看出差距

chillout23 commented 1 year ago

That is strange. There are so many people noticing this issue and you cannot see it, then it will be never resolved unfortunately. KSPlayer will then only be suitable for 50 FPS and 60 FPS streams and nothing else.

UnknownCoder807 commented 1 year ago

@kingslay I have sent you an email with a link to a live tv stream that has a scrolling news ticker at the bottom of the screen. If you play this with VLCKit, it is smooth. If you play with KSPlayer, it has a slight jerkyness/flickering on the scrolling text.

chillout23 commented 1 year ago

@kingslay I have sent you an email with a link to a live tv stream that has a scrolling news ticker at the bottom of the screen. If you play this with VLCKit, it is smooth. If you play with KSPlayer, it has a slight jerkyness/flickering on the scrolling text.

This is exactly what I have tried to show him in my demos with a scrolling news ticker at the bottom as well.

kingslay commented 1 year ago

这个问题昨天跟 @UnknownCoder807 一起进行了调试了。但是解码环节,和渲染环节都没有日志报错信息。所以现在找不到问题所在点。现在只能等在iOS和macOS上试一下。看下是不是只有tvOS才会有这个问题。缩小问题的范围。寻找更多的思路。 @chillout23 。我的demo里面就有iOS和macOS可以用

chillout23 commented 1 year ago

I am happy to report that on Lilly Player this stream is working great, without any stutter. I did not try Lilly Player for a long time and it seems like now this works fine. However it still an issue on IPTVX, iPlayTV and Snappier IPTV. This looks like something to do with the implementation on these apps. Developers of those apps are welcome to use this thread to debug further what could be wrong in their own application.

chillout23 commented 1 year ago

@kingslay , did you give Lilly Player developer a secret patch that no one else know about? @UnknownCoder807 says that the demo app you have here on Github is stuttering also. But on Lilly Player all is good. Please explain to people why.

Edit: Did you fix this in ffa07b?

kingslay commented 1 year ago

我没有给Lilly Player 开发者修复方案。是他自己修复了。昨晚我尝试修复了下问题 @UnknownCoder807 验证说可以了。所以更新到最新的代码应该就没有问题了