Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow to start iPhone video (tested in TracyPlayer) #570

Closed
neckaros opened this issue Oct 6, 2023 · 13 comments
Closed

Slow to start iPhone video (tested in TracyPlayer) #570

neckaros opened this issue Oct 6, 2023 · 13 comments

Comments

@neckaros
Copy link

neckaros commented Oct 6, 2023

Describe the bug
In TracyPlayer from TestFlight and my own application:
Video taken from iPhone 12 Pro (the exemple i have) takes a lot of buffering time when played from URL.
It starts instantly with same URL in VLC or web browser.
It starts instantly if I download and open from file

To Reproduce
Steps to reproduce the behavior:

  1. Open TracyPlayer (ex on macOS)
  2. open URL: https://neckaros.000webhostapp.com/test.mov
  3. it takes minutes to start playing (it stay buffering)

Expected behavior
if you open the same url in the browser or VLC it start instantly

Screenshots

Platform (please complete the following information):

  • Device: MacOS
  • OS: Sonoma 14.0
  • Using latest TracyPlayer from test flight: Version 2.1.2 (21)
@neckaros neckaros changed the title Slow to start iPhone vide (tested in TracyPlayer) Slow to start iPhone video (tested in TracyPlayer) Oct 6, 2023
@kingslay
Copy link
Owner

kingslay commented Oct 6, 2023

这个url打不开,报错
Unable to negotiate TLS/SSL session: -9806
https://neckaros.000webhostapp.com/test.mov: Input/output error
我用vlc也是打不开

@neckaros
Copy link
Author

neckaros commented Oct 6, 2023

It plays in VLC from my country:
image
Maybe it's blocked in mine?
I have the same issue on my personal server but it's not public so i found this free host. Maybe you have some place else where i can share it with a direct link?

@kingslay
Copy link
Owner

kingslay commented Oct 6, 2023

你可以把url发到我的邮箱。我的邮箱在reademe 里面有写

@neckaros
Copy link
Author

neckaros commented Oct 6, 2023

I think i found a solution. I took another smaller video and uploaded it to Github:
https://github.com/neckaros/KSPlayer/raw/develop/2.mov

@neckaros
Copy link
Author

neckaros commented Oct 6, 2023

Tell me if you are able to reproduce with this link otherwise I will email you

Thanks

@kingslay
Copy link
Owner

kingslay commented Oct 6, 2023

你后面给的URL可以复现这个问题了

@kingslay
Copy link
Owner

kingslay commented Oct 7, 2023

找到原因了 因为ffmpeg在下载mov视频的时候 分成很多段进行下载。所以导致很慢。而vlc只分为两段来下载。我看mpv也是分为很多段下载。 这个需要ffmpeg进行处理下 你可以用ffplay播放 也会有这个问题

@neckaros
Copy link
Author

neckaros commented Oct 8, 2023

Thanks!
I think they found a solution here: https://stackoverflow.com/questions/61652486/ffmpeg-making-requests-for-each-frame-when-decoding-a-stream-slow-performance

not sure it apply for your implementation ?

@kingslay
Copy link
Owner

kingslay commented Oct 8, 2023

这个解决方案对于mov的视频是可以,但是在播放其他视频的,就会出问题了。而且不好控制buffer_size。当用户拍摄的mov视频很大,超过buffer_size的大小的话。那还是会继续卡顿

@neckaros
Copy link
Author

neckaros commented Oct 8, 2023

thanks again for all your help!

Would it be possible to apply only on MOV containers and obtain the buffer size like he said:
You can get that value from the second network request bytes range when you are opening the format context (first network request is made with bytes range 0-* and then the second network request is made with bytes range XXXX-* where XXXX should be the buffer size)
From that and what he says: not the whole video is necessary but the first part of audio only ?

i can fallback to iOS or VLC player but I guess iPhone video over network would often be used on an iOS player

@kingslay
Copy link
Owner

kingslay commented Oct 8, 2023

不是所有的mov都会有这个问题,就iPhone手机拍的才会。我也试着要用range来进行判断。但是无法获取range的信息。所以你可能需要用avplayer来进行播放。我的项目有提供了一个avplayer的实现。

@neckaros
Copy link
Author

Letting AVPlayer as the primary player is indeed a good workaround

@kingslay
Copy link
Owner

这个问题你可以用最新的代码试下,应该不会那么慢了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants