New Feature: vfs-read-chunk-size


#142

Hey, would you mind pointing me in the right direction for guides you have on implementing the ST2 setup with scripts. I’ve learning a bit from random sources that it seems to have to do with a service account or multiple ones, setting regions, and somehow cycling between users?


#143

Hi,
i can’t make vfs-read-chunk-size to work correctly with Plex. I’ve tried with 1080p film with high bitrate and every 1 minute it’s buffering. I’m using rclone 1.43 but i have the same problem with 1.42.
I’m reading the plex error and it say “Connection reset by peer”. Can you help me?

This is my mount command

sudo /usr/bin/rclone mount --umask 0 --allow-non-empty --allow-other --dir-cache-time 48h --vfs-read-chunk-size 128M --vfs-read-chunk-size-limit off --buffer-size 64M --max-read-ahead 200M --log-file /home/XXX/logs/rclone.log --log-level DEBUG gcrypt: /home/XXXX/media &


#144

Using unionfs or playing directly from the mount? Direct Streaming/Transcoding or Direct Playing? Share the log from you play the file.


#145

Direct play from the mount.


#146

What client are you using?


#147

Samsung smart TV. I’m using this app from many year and no problem with plexdrive.


#148

Can you share the log when you play the file?


#149

Hi,
in the link above rclone’s log. I didn’t find anything of strange.

https://pastebin.com/zJzBzsA9


#150

I think you get the buffering because it repeatedly opens and closes out the file. I had the problem with Direct Streaming with ATV clients and had to turn off Direct Play.


#151

I want to use Direct Play feature because i don’t want to transcode.
What we can do to make vfs to work properly with direct play?


#152

You can’t as it’s a bug in the client. It grabs some and closes out the file.

If you Direct Stream, it really has almost no resource use as it’s not full transcoding.


#153

If it was a bug in the plex client, i should have to experience the same problem when the file is local or with plexdrive.


#154

Locally, you wouldn’t see an issue as it’s fast enough to mask it since you aren’t going to a cloud provider to retrieve data over the Internet.

With Plexdrive, it does chunked read ahead, which is different from what rclone does so that masks the issue as it doesn’t close out the file.

You could trying using the cache feature, which is similar to what plexdrive does if you don’t want to use Direct Stream over Direct Play.


#155

When i direct play a video plex server should read from the rclone buffer size if it was enabled.
From what i understood when a video start rclone download the file and fill the buffer and the video will play from the buffer.
I suppose that if the video will buffer if because the rclone buffer is empty.
I’ve tried the rclone cache but is too slow compared to plexdrive.


#156

I’m not sure what to tell you as it’s a bug/defect in the way the plex client is pulling. It repeatedly opens and closes the file to request pieces of the file rather than doing an open and a read of the file.

There isn’t any amount of caching or anything else that is going to fix it as once the file closes, the cache is dumped.

I’ve suggested to turn Direct Play off as that’s a minimal CPU hit on the server as it Direct Streams rather than transcodes.

It’s all in the logs that you shared on what the issue is and why it buffers.


#157

Thanks for your answer. What i want is only to understand how it works and fix the problem.
So…if it was how you say that the cache was destroyed once the file was closed, what the buffer size do?
Maybe @ncw or @B4dM4n can you explain us?


#158

When you say ‘buffer’, I’m assuming you mean ‘cache’.

buffer-size or ‘cache’ is there when a file is opened and read ahead. It will buffer up / cache / store / keep in memory the next part of the file that you configure with the buffer-size option.

Once the file is closed though, the buffer drops so having a larger buffer would be worse in this scenario as the file keeps opening and closing.

To fix it, turn off Direct Play on that client.


#159

@Animosity022 is correct, --buffer-size is used to read data from the remote into memory, before it is actually needed by by the opening program (Plex in this case). All data in --buffer-size is discarded once the program closes the file.

Some Plex clients in Direct Play mode (and also other programs) open and close the file regularly, which discards all --buffer-size data. This is not the fault of rclone, but of the reading program.

There are 2 solutions for this problem:

  1. use the cache backend to store chunks between open and close calls
  2. fix the used program (turn Direct Play off)

Otherwise there is no solution in sight for rclone right now.


#160

Thanks to all for your answer. I will wait for a resolution. In the meanwhile i’ll revert back to plexdrive because cache it’s too slow.


#161

I’m not sure why you are so hesitant to turn off Direct Play. It really is no hit from the server / client.

If you are expecting Plex to change their client and how the old ones work, you’ll be waiting a long time.