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 197 forks source link

Video stutters (visionOS) #766

Closed ianmagallan closed 5 months ago

ianmagallan commented 5 months ago

Description One of my users has reported that while playing locally stored videos, the video stutters. Since I don't own an Apple Vision Pro yet, I can't test/debug using a real device, but my assumption is that frames are being dropped.

I've tested an MKV file, using TracyPlayer for macOS, iOS and visionOS and it seems that the only one that shows warnings about dropped FPS quite often (and stutters) is the visionOS version of the app. If I hardcode the tuple returned by videoClockSync and always return (diff, .next), it seems that the video works smoothly (not a solution, because then the video and audio are constantly out of sync).

Repro steps

  1. Install TracyPlayer on iOS and play a video from the local storage.
  2. Install TracyPlayer on visionOS and play a video from the local storage.
  3. Install VLC and play a video from local storage
  4. The VLC version looks smooth, the iOS version doesn't seem as smooth as VLC but good enough and will not show any dropped frames logs, whereas visionOS is constantly dropping frames.

Expected behavior Neither iOS nor visionOS drop frames.

Screenshots

visionOS

https://github.com/kingslay/KSPlayer/assets/24428301/3d19cd90-bd70-4ea3-8ca3-a840a3ea2d16

iOS

https://github.com/kingslay/KSPlayer/assets/24428301/d4b4099c-13f5-4ed6-bc5a-5168ef240fcc

VLC

https://github.com/kingslay/KSPlayer/assets/24428301/376c2af8-739e-4b97-aca1-fed3f043b4a4

kingslay commented 5 months ago

你可以提供那个测试的MKV file吗?你可以看下 Dropped Frames 的值是多少。你是通过什么协议来访问那个本地存储视频的呢? 是smb,upnp还是nfs呢?

ianmagallan commented 5 months ago

I believe that I don't use any of the protocols you mentioned? The file that I am playing, is in the local storage of the simulator on this case. Regarding my user.. I can't really say, but I am pretty sure that also loads them from storage (from what I've seen in the tracking events).

One interesting thing though, is that I recommended him to test the same video in TracyPlayer in the App Store (visionOS) and he mentioned that TracyPlayer reproduces the same video without stuttering, meaning that the dropped frames might be unrelated to KSPlayer and rather be a simulator issue (CPU running high, hardware acceleration and so on). I've had a look at TracyPlayer's settings and I adjusted some of them to it, and hope it gets fixed since before I was using all default settings -- Is TracyPlayer using different settings than the ones shown in the demo that could be what makes the difference with such files?

Here is the link to the file that I've used to test it: https://mega.nz/file/0TczTABD#kU0-XltxLXQ6pi22IOa86bxvjMhq0AYh3x5j_WSfmNQ

kingslay commented 5 months ago

配置是会有不一样的,那个demo很久没有更新了。

ianmagallan commented 5 months ago

I'd assume that the TracyPlayer uses the latest version from the LGPL repository, right? Just to make sure that it's a matter of finding the right settings 👀

kingslay commented 5 months ago

是的,TracyPlayer 是用最新的lgpl分支的代码。