mpv-android / mpv-android

#mpv-android @ libera.chat
MIT License
2.05k stars 254 forks source link

(Better) SMB support #496

Open Estebiu opened 2 years ago

Estebiu commented 2 years ago

It'd be absolutly fantastic if you could add SMB support to mpv.

It is already possible to stream videos this way if you mount them with "android samba client" from google and open the video/music file from the app "Files", but if it's an .mkv the scrolling it's really laggish.

So again, please implement this feature. It would save my life.

Pentaphon commented 2 years ago

This seems out of the scope of this project. It is just a player. Not a media center.

I suggest trying Nova Video Player, Kodi or VLC for this.

You can even configure Nova Video Player to use mpv as an external player if you want and it works perfectly.

Estebiu commented 2 years ago

This seems out of the scope of this project. It is just a player. Not a media center.

I suggest trying Nova Video Player, Kodi or VLC for this.

You can even configure Nova Video Player to use mpv as an external player if you want and it works perfectly.

Well, maybe you are right, maybe it's not the job a player like mpv should do, but that would be nice.

Already tryied using Nova player+mpv, but if i must be honest, i dislike the UI of Nova+the idea of using 2 separated apps

Pentaphon commented 2 years ago

i dislike the UI of Nova+the idea of using 2 separated apps

Maybe but it's better to have that than never have Nova use mpv and never have mpv have SMB support.

moneytoo commented 2 years ago

In an ideal world, it should be enough to install single document provider app (like your mentioned "android samba client" or cifs-documents-provider), enter credentials once and have it accessible to all user apps. We shouldn't require every media playing app implementing clients for SMB, SFTP, FTP...

Estebiu commented 2 years ago

i dislike the UI of Nova+the idea of using 2 separated apps

Maybe but it's better to have that than never have Nova use mpv and never have mpv have SMB support.

Anyway, when using nova+mpv, sometimes mpv crashes during playback and it's a pain.

Pentaphon commented 2 years ago

Anyway, when using nova+mpv, sometimes mpv crashes during playback and it's a pain.

Well, that's something you have to log and show to the dev.

YanceyChiew commented 2 years ago

In an ideal world, it should be enough to install single document provider app (like your mentioned "android samba client" or cifs-documents-provider), enter credentials once and have it accessible to all user apps. We shouldn't require every media playing app implementing clients for SMB, SFTP, FTP...

As far as my experience is concerned, the Android Samba Client , just like the Google Drive app, needs to fully cache the video before serving it to the player. Am I not getting it right, or when you mention it you're not saying that it currently works as expected?

moneytoo commented 2 years ago

@YanceyChiew Yes, these two do need to fully cache files but others don't (like the cifs-documents-provider or webdav-provider).

nisehime commented 2 years ago

This seems out of the scope of this project

How? You can alread pass a URL to open a remote file and in the PC version there's support for smb using smb://PATH already.

It's strange that it's not supported in Android version unless I'm doing something wrong.

Pentaphon commented 2 years ago

How? You can alread pass a URL to open a remote file and in the PC version there's support for smb using smb://PATH already.

Because this is a simple video player, not a media center. I doubt the dev is going to do all the work to make mpv-android into a media center. Use Nova Video Player for you want and then make it use mpv as an external player.

nisehime commented 2 years ago

So mpv on PC is a media center now? As I imagine it a media center is when you have a library of your media files which can be categorised, played and other actions performed with them in a single app. Adding a simple support for a protocol won't make it media center.

Pentaphon commented 2 years ago

So mpv on PC is a media center now?

No. It doesn't work like one. You need to drop this and just look for another project. This project is not going to change just for you.

It's strange that it's not supported in Android version unless I'm doing something wrong.

I play videos over smb with mpv-android all the time using my phone and Solid Explorer.

What you want is for mpv for connect to smb shares by itself, but that's not what the devs are going to do. It has to be used with another software for that to work and you just have to deal with that.

sfan5 commented 2 years ago

Allowing mpv to play from SMB is not a great technical challenge, but where do people get the URLs they want to enter? Nobody is going to type smb://mymediacenter.local/disk2/this%20movie%20has%20a%20really%20long%20name.mkv by hand so there must already be some app people are using to browse SMB. Do these apps even allow directly passing the right URLs to external players?

Adding the ability to browse SMB from mpv-android would indeed be an unreasonable amount of work.

nisehime commented 2 years ago

Well, I was talking about the URL format specifically. As I said it's already implemented in the parent project (libmpv) along with many other protocols, so I thought it's not a big deal to do so here as well. Those who need it will find a way how to pass the URL I guess.

Pentaphon commented 2 years ago

Well, I was talking about the URL format specifically. As I said it's already implemented in the parent project (libmpv) along with many other protocols, so I thought it's not a big deal to do so here as well. Those who need it will find a way how to pass the URL I guess.

I keep telling you to just use an SMB-compatible file manager or a player like Nova with mpv but you keep ignoring this solution so you can try to convince the mpv-android dev to work on native SMB connecting/browsing and this simply isn't going to happen.

YanceyChiew commented 2 years ago

smb:// protocol is handled by ffmpeg/Libav with an --enable-libsmbclient build flag, that's similar to having a samba built in. The windows version of mpv I am currently using also does not support the smb:// protocol.

Perhaps adding support for the content:// protocol to the open URL method is a more general workaround.

nisehime commented 2 years ago

I think it's you who is trying to convince devs what to (not) work on for some reasons. Nobody here is forcing anyone to bring native smb support right now. I was just pointing out that your arguments about "media center" were not true, neither that it's out of scope of this project. I mean, it's a project which is based on mpv, which already has smb support (through ffmpeg, yes). So I thought it shouldn't have been a problem to enable it. If it is - ok, case closed. If it is just about the build flags, well, maybe someone will do it's own build then, ok.

I already tried playing through total command lan plugin, and the system closed the foreground service it has used for some reasons, so the video playback stopped. I tried CIFS documents provider and encountered a problem here too. I don't need Nova player, neither do I need Solid explorer. Wasting storage space on them to play a movie like once a week, when I could just enter smb url in the player itself, is an overkill for me.

I don't know what OP meant though, maybe he actually wanted browsable SMB support. So I'm speaking for myself of course.

Pentaphon commented 2 years ago

I don't know what OP meant though, maybe he actually wanted browsable SMB support.

That's clearly what you and he want and the dev has already said its an unreasonable amount of work so you are just going to have to find other solutions like I did.

YanceyChiew commented 2 years ago

I tried CIFS documents provider and encountered a problem here too.

The CIFS Document Provider should be able to meet your needs, although its content link cannot be opened directly in mpv-android, but you can browse the remote directory through the file manager(com.google.android.documentsui) and invoke mpv-android to playback the selected file. It's just that there is a bug in the latest version(1.4.0) of this app, and its owner has not appeared for a while, using the previous version(1.3.2) can avoid the problem.

nisehime commented 2 years ago

The windows version of mpv I am currently using also does not support the smb:// protocol

Yeah, you're right. And basically ffmpeg's smb support is disabled everywhere it seems for some reasons. Maybe it has its problems.

The CIFS Document Provider should be able to meet your needs

I already opened an issue on its github. I tried both 1.4.0 and 1.3.2 versions and my problem was on both of them.

sfan5 commented 2 years ago

Perhaps adding support for the content:// protocol to the open URL method is a more general workaround.

Already supported fyi

YanceyChiew commented 2 years ago

Already supported fyi

It is indeed supported in the intent filter, but when I try to open the content link through the open URL method of the main interface, I get the following prompt:

05-22 00:41:48.949 32738   499 V mpv     : event: start-file
05-22 00:41:48.949 32738   499 V mpv     : [cplayer:v] Running hook: ytdl_hook/on_load
05-22 00:41:48.950 32738   499 V mpv     : [cplayer:v] Set property: android-surface-size="1080x2400" -> 1
05-22 00:41:48.950 32738   499 V mpv     : [ytdl_hook:v] ytdl:// hook
05-22 00:41:48.950 32738   499 V mpv     : [ytdl_hook:v] not a ytdl:// url
05-22 00:41:48.950 32738   499 V mpv     : [stream_callback:v] Opening content://com.android.providers.media.documents/document/video%3A61742
05-22 00:41:48.950 32738   499 V mpv     : [stream:error] No protocol handler found to open URL content://com.android.providers.media.documents/document/video%3A61742
05-22 00:41:48.950 32738   499 V mpv     : [stream:error] The protocol is either unsupported, or was disabled at compile-time.
05-22 00:41:48.950 32738   499 V mpv     : [cplayer:v] Opening failed or was aborted: content://com.android.providers.media.documents/document/video%3A61742

By the way, directly opening the external content uri probably also needs to handle the request for access permissions.

Pentaphon commented 2 years ago

I already opened an issue on its github. I tried both 1.4.0 and 1.3.2 versions and my problem was on both of them.

You might as well try Nova Video Player since that is proven to work and you can make it so mpv can be launched as the default player instead of the built-in ffmpeg player.

sfan5 commented 2 years ago

It is indeed supported in the intent filter, but when I try to open the content link through the open URL method of the main interface

Ah right, there was a small difference here. Launching content URIs directly from other apps works but not via manual action.

sfan5 commented 2 years ago

I stumbled upon the following app today: https://f-droid.org/packages/com.wa2c.android.cifsdocumentsprovider/

From the description it should allow you to open and browse SMB folders directly from the new "open document tree" functionality in mpv.

liweishu commented 6 days ago

@moneytoo

Yes, these two do need to fully cache files but others don't (like the cifs-documents-provider or webdav-provider).

cifs-documents-provider 的传输速率并不足以支持高码率视频,安卓的文件管理实在是简陋,使得各种 app 的 smb 支持都得自己实现。