Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
102 stars 0 forks source link

Add MPV as a playback engine for videos #1923

Open Raidriar796 opened 2 weeks ago

Raidriar796 commented 2 weeks ago

Is your feature request related to a problem? Please describe.

This isn't related to any issue with the Unity Native or libVLC, this is strictly a feature request.

Describe the solution you'd like

I would like MPV to be a playback engine option for videos, either alongside or replacing existing playback engines.

Describe alternatives you've considered

N/A

Additional Context

MPV has been my media player of choice over VLC for a couple of years now and as much as I'd like to use it over VLC in Resonite, it's hard to say if it's really better or worse than VLC for Resonite's needs from an end user's perspective.

MPV also provides libmpv for use in other applications. There's also the project MPVSharp which is meant for more direct integration with C# applications.

Relevant links: https://mpv.io/ https://github.com/mpv-player/mpv https://github.com/NickvisionApps/MPVSharp

Requesters

@Raidriar796 / raidriar796

Frooxius commented 2 weeks ago

How does this compare to libVLC? Are there any major benefits this would offer?

Integrating and maintaining a playback engine is pretty big undertaking, so it's not something we'd do without a very solid reason to do so. We'd only likely consider this if it was a suitable replacement for libVLC.

If we were to do this with Unity as rendering engine still, we'd also need Unity integration. If there isn't one, we're unlikely to even consider this until new rendering engine comes in - and at that point we'll have to see if this would be better or worse choice than libVLC.

Raidriar796 commented 2 weeks ago

How does this compare to libVLC? Are there any major benefits this would offer?

The biggest benefit from my experience is hardware acceleration, to this day I haven't been able to get VLC to use hardware acceleration properly but I'm sure it's also good when it does work. CPU usage without acceleration is very similar (within margain of error) between the two, but it may be easier for Resonite to utilize hardware acceleration with MPV as well.

We'd only likely consider this if it was a suitable replacement for libVLC.

At the very least, as far as I can check, MPV has complete feature parity with VLC for Resonite's use cases. Even including MP3 playback support.

If we were to do this with Unity as rendering engine still, we'd also need Unity integration

I looked around a bit and haven't been able to find anything specific to Unity, the closest being MPVSharp as listed in the original comment. However, it would likely be better to wait until the new rendering engine before considering this.

To be clear, I do not know what libVLC or libmpv is like to develop with. I have just recently discovered that libmpv exists and with MPV being crossplatform, even emphasizing Vulkan and OpenGL support, I thought it'd at least be worth mentioning if there's ever a want/need to replace libVLC or add more playback engines.

I do want to try and develop something with these libraries at some point, if I do end up doing that and find anything relevant I will mention it here.

Geenz commented 2 weeks ago

Generally appears to be good - it's using FFMpeg which VLC also utilizes as a playback engine. I'll take a look at this over the weekend - it may be worth prototyping a media player with it (if it isn't too difficult to get to the things we need, e.g., an audio stream from the player).