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
886 stars 184 forks source link

4.2.2 continuous buffering problem in broadcasts #667

Closed alphi00 closed 7 months ago

cdguy commented 7 months ago

@alphi00 video link? What happens? Please provide more details

cdguy commented 7 months ago

@kingslay please check your e-mail

cdguy commented 7 months ago

This issue is happening again.

I sent you the link. You have to use a VPN to open it.

the stream is active the next 2 hours

thank you!

https://github.com/kingslay/KSPlayer/assets/123307657/60fb013e-9cb1-470f-90c7-d63f7adad60f

cdguy commented 7 months ago

This issue is happening again.

I sent you the link. You have to use a VPN to open it.

the stream is active the next 2 hours

thank you!

2717058961870124800.mp4

@kingslay the issue happens when you watch the content "live". pre-recorded content having the same media properties does not create this issue.

https://github.com/kingslay/KSPlayer/assets/123307657/fe89a0a5-b3ae-4528-90a2-6c36ca6ba063

Also the stream is 50i; however the displayed FPS do not exeed 40fps, which is an issue

L

Thanks

cdguy commented 7 months ago

@kingslay sorry to spam here, but I also tried with the latest mpv release and the stream playback is very smooth

kingslay commented 7 months ago

@cdguy 你提供的url用vpn打不开。你能不能提供一个别的url

cdguy commented 7 months ago

@kingslay please check your mailbox

kingslay commented 7 months ago

@cdguy 你可以试下把这个方法的返回值改成是16

 open func videoFrameMaxCount(fps _: Float, naturalSize _: CGSize, isLive: Bool) -> UInt8 {
        isLive ? 4 : 16
    }
cdguy commented 7 months ago

@cdguy 你可以试下把这个方法的返回值改成是16

 open func videoFrameMaxCount(fps _: Float, naturalSize _: CGSize, isLive: Bool) -> UInt8 {
        isLive ? 4 : 16
    }

Unfortunately the stream ended. I will share with you a new link if my provider finds another 4:2:2 live stream

thank you

cdguy commented 7 months ago

@kingslay

I uploaded the recordings on put.io and the issue happens too (less but happening)

please try those links:

https://api.put.io/v2/files/1276153806/stream?oauth_token=DZON3UYBELCXTRZPTOAM

https://api.put.io/v2/files/1276158289/stream?oauth_token=DZON3UYBELCXTRZPTOAM

https://api.put.io/v2/files/1276158267/stream?oauth_token=DZON3UYBELCXTRZPTOAM

cdguy commented 7 months ago

@kingslay

I uploaded the recordings on put.io and the issue happens too (less but happening)

please try those links:

https://api.put.io/v2/files/1276153806/stream?oauth_token=DZON3UYBELCXTRZPTOAM

https://api.put.io/v2/files/1276158289/stream?oauth_token=DZON3UYBELCXTRZPTOAM

https://api.put.io/v2/files/1276158267/stream?oauth_token=DZON3UYBELCXTRZPTOAM

Not last but least, when you open those links with a VPN connection, the issue is happening more often

cdguy commented 7 months ago

@kingslay can you also please update the testflight tracy player app? Thank you!

cdguy commented 7 months ago

@kingslay unfortunately the bug is not fixed. I don’t get any dropped frames too. No issues in MPV

kingslay commented 7 months ago

有对应的url吗?

cdguy commented 7 months ago

You can try both @kingslay

1- https://api.put.io/v2/files/1276153806/stream?oauth_token=DZON3UYBELCXTRZPTOAM

2-

https://api.put.io/v2/files/1276158289/stream?oauth_token=DZON3UYBELCXTRZPTOAM

3-

https://api.put.io/v2/files/1276158267/stream?oauth_token=DZON3UYBELCXTRZPTOAM

kingslay commented 7 months ago

@cdguy [https @ 0x600003884000] HTTP error 429 TOO MANY REQUESTS [in#0 @ 0x600003390000] Error opening input: Server returned 4XX Client Error, but not one of 40{0,1,3,4}

在mac或tvos上会有这个问题吗?还是只有iOS才会

cdguy commented 7 months ago

@cdguy [https @ 0x600003884000] HTTP error 429 TOO MANY REQUESTS [in#0 @ 0x600003390000] Error opening input: Server returned 4XX Client Error, but not one of 40{0,1,3,4}

在mac或tvos上会有这个问题吗?还是只有iOS才会

both ios and tvos

kingslay commented 7 months ago

目前这几个连接打不开。报错 [https @ 0x6000018b8630] HTTP error 429 TOO MANY REQUESTS [in#0 @ 0x6000013b8700] Error opening input: Server returned 4XX Client Error, but not one of 40{0,1,3,4}

kingslay commented 7 months ago

把yadifMode 改成0 是不是就不会有这个问题了

cdguy commented 7 months ago

@kingslay on ios yes, but on tvos the issue is still there. But as you know yadif mode=1 outputs better results, and with MPV it is smooth

cdguy commented 7 months ago

The last commit (https://github.com/kingslay/KSPlayer/commit/9a797ca817cf2dcef3c30c3626543c714cd037e6) still did not fix it :/

kingslay commented 7 months ago

嗯 这个问题还没解决 因为你给的url 目前无法播放 所以 我无法debug

cdguy commented 7 months ago

嗯 这个问题还没解决 因为你给的url 目前无法播放 所以 我无法debug

It seems that put.io stream service is blocking connection.

if you have a remote media server, upload those 3 media files and play those file:

“Feed Satelite 4-2-2 non transcoded” “4-2-2 pure satellite feed_second video” “4-2-2 Pure Satellite Feed”

the videos are in this link: https://go.wetransfer.com/b-zvg8ImxsWw

cdguy commented 7 months ago

嗯 这个问题还没解决 因为你给的url 目前无法播放 所以 我无法debug

I sent you 3 private links via e-mail

you can try them @kingslay

cdguy commented 7 months ago

You can try both @kingslay

1- https://api.put.io/v2/files/1276153806/stream?oauth_token=DZON3UYBELCXTRZPTOAM

2-

https://api.put.io/v2/files/1276158289/stream?oauth_token=DZON3UYBELCXTRZPTOAM

3-

https://api.put.io/v2/files/1276158267/stream?oauth_token=DZON3UYBELCXTRZPTOAM

@kingslay I deleted those links because they constantly apply a bandwith limitation. you can try with the google drive links I shared with you yesterday

kingslay commented 7 months ago

好的

cdguy commented 7 months ago

I see that you update some code, if it is related to the 4:2:2 playback, may I ask you to update the tracy player testflight app? thank you

kingslay commented 7 months ago

跟这个没有关系。但是我有找到思路了 但是改动比较大 还要等一下

kingslay commented 7 months ago

@cdguy 用mpv播放的话,视频显示的是HDR10还是HDR呢?

cdguy commented 7 months ago

@cdguy 用mpv播放的话,视频显示的是HDR10还是HDR呢?

I will check in an hour but the links I provided are all in SDR @kingslay

kingslay commented 7 months ago

你提供给我的第一个url是HDR10。目前排查出问题是因为yuv422p10le的转码太慢了。导致视频播放的时候会丢帧。

Stream #0:0[0x100]: Video: h264 (High 4:2:2) ([27][0][0][0] / 0x001B), yuv422p10le(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn

cdguy commented 7 months ago

你提供给我的第一个url是HDR10。目前排查出问题是因为yuv422p10le的转码太慢了。导致视频播放的时候会丢帧。

Stream #0:0[0x100]: Video: h264 (High 4:2:2) ([27][0][0][0] / 0x001B), yuv422p10le(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn

the 3 videos I shared with you: 4-2-2 Pure Satellite Feed.ts 4-2-2 pure satellite feed_second video.ts Feed Satelite 4-2-2 non transcoded.ts

they all have the BT709 colour range. and this colour range is SDR Ekran görüntüsü 2023-11-29 143427 Ekran görüntüsü 2023-11-29 143458 Ekran görüntüsü 2023-11-29 143444

cdguy commented 7 months ago

你提供给我的第一个url是HDR10。目前排查出问题是因为yuv422p10le的转码太慢了。导致视频播放的时候会丢帧。

Also this finding might you help:

If I play those video stored locally (apple files app) with my iphone device, there are no dropped frames However if I play those files via a remote server (like the google links I sent you) you see the dropped frames @kingslay

cdguy commented 7 months ago

Here is the difference @kingslay

https://github.com/kingslay/KSPlayer/assets/123307657/06669f9b-845e-4746-bbbe-6bea1007ba6d

https://github.com/kingslay/KSPlayer/assets/123307657/61639d96-0d18-483a-9889-94623e20d6b0

kingslay commented 7 months ago

@cdguy 我尝试修复了下。也更新tf包了 你试下

cdguy commented 7 months ago

@cdguy 我尝试修复了下。也更新tf包了 你试下

can you please update the tracy player testflight app? I have a few friends who can try new 4:2:2 live stream thank you for your hard work!!

kingslay commented 7 months ago

testflight 更新好了

kingslay commented 7 months ago

@cdguy 用新的testflight包 ,效果怎样呢?还有问题吗?

cdguy commented 7 months ago

It is almost perfect, but now there are random dropped frames.

it does not matter if the content is played locally (via apple files app) or remotely.

i will send you the video link via e-mail

thanks!

https://github.com/kingslay/KSPlayer/assets/123307657/a0068fd0-0699-49c4-8945-01943f09011d

kingslay commented 7 months ago

是的,这个就是我之前说的转像素格式耗时太多,导致视频帧滞后,所以才会丢帧。苹果无法直接显示yuv422p10le这样的像素格式。这个目前还找不到解决方案。mpv也会存在丢帧的情况吗?

cdguy commented 7 months ago

是的,这个就是我之前说的转像素格式耗时太多,导致视频帧滞后,所以才会丢帧。苹果无法直接显示yuv422p10le这样的像素格式。这个目前还找不到解决方案。mpv也会存在丢帧的情况吗?

Yes you told me; with MPV there are no issues, there are no frame losses

alphi00 commented 7 months ago

I am not a developper, I can only test if you update the testflight app; can you update it? Thanks

kingslay commented 7 months ago

好的 我更新下

alphi00 commented 7 months ago

Thanks

cdguy commented 7 months ago

@kingslay

if I use Yadifx2 I will get random frame losses; however if I use "Yadifx2 Spatial Skip" (mode=3) everything is perfect

kingslay commented 7 months ago

@cdguy 是那个视频会有这个问题呢?你把视频发给我

cdguy commented 7 months ago

是那个视频会有这个问题呢?你把视频发给我

I finally had the opportunity to record a stream. The dropped frames are happening when you use the yadif x2 and yadif x2 spatial skip. No dropped frames when I use MPV

kingslay commented 7 months ago

我试着优化了下性能。@cdguy 你可以试下。

cdguy commented 7 months ago

我试着优化了下性能。@cdguy 你可以试下。

also please update tracy player testflight, I will run tests with other friends who can only have access to testflight Thank you

kingslay commented 7 months ago

好的,我现在就更新下。