OS X files on network shares (afp/smb) not cached
Files played from network shares (AFP and SMB shares tested on Synology NAS) don't use cache by default, resulting in choppy playback.
A temporary workaround is to put cache=8192 in ~/.mpv/config. cache-default=8192 does not fix choppiness. Possible regression since I didn't notice this problem until very recently.
mpv has no clue that these files come from the network, unless you access them directly using smb://, ftp:// or http:// for example, and not through the filesystem.
Only thing you can do it to manually or always enable the cache.
@ChrisK2 filesystem type for given file can be determined programatically using statfs
For example:
#include <sys/param.h>
#include <sys/mount.h>
#include <stdio.h>
int main (int argc, char *argv[]) {
struct statfs fs;
if (statfs(argv[1], &fs) == 0) {
puts(fs.f_fstypename);
}
}
$ cc -o statfs statfs.c
$ ./statfs ~/video.mkv
hfs
$ ./statfs /Volumes/Media/video.mkv
afpfs
Hm, I guess that could be implemented then.
I second that request.
Similarly, always enable caching on non local UNC paths on windows, and network fs (anything fuse except encfs/ecryptfs/ntfs3g too) on Linux.
statfs exists on Linux too, but returns a weird fs id on linux.
I can volunteer for doing the Linux implementation of this. Will help sshfs users a lot. Am 16.02.2014 14:02 schrieb "ChrisK2" [email protected]:
Hm, I guess that could be implemented then.
Reply to this email directly or view it on GitHubhttps://github.com/mpv-player/mpv/issues/558#issuecomment-35196145 .
Keep in mind that statfs is entirely, and you'll probably have to add a few configure checks.
Streams can request cache with setting stream->streaming = true;.
Keep in mind that statfs is entirely,
I meant to write entirely non-portable.
Yes. On Linux one might even have to use /proc/mounts to get a useful fs name. When the OS X variant is there, I'll tackle Linux.
+1. This seems like a good idea.
For a Windows implementation, it looks like GetDriveType is the way to go: https://gist.github.com/rossy2401/9044827
Hello, I implemented it for BSD/OSX in the remote-volumes branch.
Hello, I implemented it for BSD/OSX in the remote-volumes branch.
OK, look as nice as such an ifdef party could possible be made look nice.
One small suggestion: maybe let the check_stream_remote function return whether the stream is suspected remote or not, instead of setting stream->streaming in platform specific code.
Also, I wonder if it would be better to just pass the path instead of the stream ptr to that function. On the other hand, the stream could for example be used to check the file handle directly instead of the path (if one of the plsatform APIs allows this).
One small suggestion: maybe let the check_stream_remote function return whether the stream is suspected remote or not, instead of setting stream->streaming in platform specific code.
I didn't want to overengineer it but you are right. It's better to immediatly abstract away the platform independent parts. Will change that.
As for the passing stream, it's probably needed on Windows. On BSDs I just realized there is fsfstatfs which takes a fd instead of a path.
pushed the BSD implementation to master ^
Seems to cache even when cache=no is set in my config. Really annoying since 10.9's smb implementation takes forever to start doing anything useful. I can copy a 6GB file in minutes but I can't stream it without lag.
Pic related: the spots with no activity are the video playing back, and the spike in activity is when the video lags. If I understand caching properly, then that's essentially what mpv is doing despite my settings.
You can check whether it's caching by looking at the terminal output. It'll print something like [cache] Cache size set to 320 KiB in the first lines.
Anyway, closing, since it's implemented for OSX and Win32, and nobody seems to care about the Linux case.