Swiftfin icon indicating copy to clipboard operation
Swiftfin copied to clipboard

Implement mpv Player

Open PangMo5 opened this issue 3 years ago • 17 comments

I think VLCkit is really good, too. But it'd be better to change to a better performance and more scalable mpv, so I'm going to leave an issue.

As far as I know, plex is also using mpv. And https://github.com/jellyfin/jellyfin-media-player too.

Of course, I'm currently completely ignorant of mpv. lol

PangMo5 avatar Nov 10 '21 08:11 PangMo5

I'll consider this in my video player refactor.

LePips avatar Nov 10 '21 14:11 LePips

Actually, building mpv for iOS isn't officially supported and looks complicated. We shouldn't even consider it.

https://github.com/mpv-player/mpv/issues/5902

LePips avatar Nov 10 '21 14:11 LePips

Actually, building mpv for iOS isn't officially supported and looks complicated. We shouldn't even consider it.

That's too bad.

PangMo5 avatar Nov 10 '21 14:11 PangMo5

What performance issues do you have with VLCKit?

LePips avatar Nov 10 '21 14:11 LePips

What performance issues do you have with VLCKit?

When I changed the time scroll bar(?) offset when Playing a specific video(MPEG-4, AVI), I felt that it was much slow than other video players. (It's working after 5 seconds.) And there is a crash when playing a video including a specific subtitle(.kor.srt).

But seeing how it works normally through the VLCPlayer in the App Store, There seems to be a problem with the implementation of Swiftfin. In the future, I'll create issues related to this problems again if the same occurs after VideoPlayer refactoring. (Not about "using mpv")

PangMo5 avatar Nov 10 '21 15:11 PangMo5

VLC4 will be released soon, so we can expect better performance 😃

PangMo5 avatar Nov 12 '21 04:11 PangMo5

I may want to investigate some time as I'm interested in attempting to build for iOS/tvOS with some sources:

  • https://github.com/ldwardx/mpv-build-mac-iOS
  • https://github.com/mpv-player/mpv/issues/8362
  • https://github.com/mpv-player/mpv/issues/5331

At first I wouldn't look at entirely replacing VLCKit but instead creating another player based on mpv and then have the option to render with either of them.

LePips avatar Jan 16 '22 21:01 LePips

Here's also something for the future: ~~https://github.com/manhpham90vn/MPVPN~~

Edit: oops

anthonylavado avatar Jan 20 '22 23:01 anthonylavado

Oh ha that isn't an MPV implementation, but some VPN implementation.

LePips avatar Jan 21 '22 01:01 LePips

Gonna reopen as now this seems like something we need to do and eventually replace (or demote) VLCKit

LePips avatar Jan 22 '22 02:01 LePips

I've been able to build the static libraries and connect them to a test project, however mpv isn't built to just be a drop-in implementation like VLCKit. Instead, everything has to be made from scratch. Luckily, iina is something to at least reference.

LePips avatar Jan 26 '22 07:01 LePips

Hi @LePips, hope you're doing well, can you share the step to build for iOS, i'm trying to do so, but i'm facing an error regarding POSIX, i asked the question here few hour ago, but you may know how to fix as you succeed building it, Thank you :)

byMohamedali avatar Sep 22 '22 12:09 byMohamedali

I haven't gotten to this for a very long time so I can't help you regarding this, sorry.

There are a few projects on GitHub if you search "mpv build iOS" to build mpv on iOS to get static libraries. I don't remember which one works.

LePips avatar Sep 22 '22 12:09 LePips

I've been exploring the codebase and have mpv (+ffmpeg, libssl, harfbuzz, etc.) building via static xcframeworks, so far only testing that I can get a pointer back from mpv_create(). Would anyone be interested in a PR adding a basic mpv player view behind an experimental flag?

@LePips I see you're in the middle of a video player refactor, I think the basic work of getting a simple MPV player view shouldn't conflict too much with that and should be simple enough to resolve conflicts after your branch is merged.

ianhattendorf avatar Oct 22 '22 16:10 ianhattendorf

Thanks for the interest! I have also been able to build mpv and have started an equivalent MPVUI project to VLCUI in private until it's ready, using iina as reference. I haven't gotten much into it because I'm doing a lot of work here. Implementing mpv here will be using that MPVUI project.

Essentially the video playing/rendering is outside of this project and should be the concern of VLCUI/MPVUI. With the work that I have done, it will be pretty trivial to allow switching the video playing layer. mpv is capable of a lot more, so I will most likely remove VLCUI because of its missing features and will be less of a concern for this project.

LePips avatar Oct 22 '22 17:10 LePips

Awesome! If you want any help feel free to open up the project or reach out. Excited to see mpv supported by Swiftfin.

ianhattendorf avatar Oct 23 '22 01:10 ianhattendorf

Yattee is also using mpv. https://github.com/yattee/yattee

And I just discovered following project. Could be a good starting point. https://github.com/cxfksword/MPVKit

sathoeni avatar Feb 14 '24 20:02 sathoeni