Peertube: suggestion: more conservative buffering = more consistent playback

Created on 25 May 2018  路  14Comments  路  Source: Chocobozzz/PeerTube

I've just watched a couple of PeerTube videos on a fairly average computer (MacBook running El Capitan), on a fairly average broadband internet connection (DSL broadband on a uni campus). It's pretty late on a Friday night, so heavy traffic on the uni network is unlikely to be affected my net connection. The videos looked good, except that they were both constantly stopping and starting, which totally ruined the viewing experience.

When this happens on YouTube or Vimeo, I can usually fix it by pausing the video for a few seconds, and letting it buffer a bit, then hitting play, or by going back to the start, so it can play the pre-loaded bit while the next bit loads. This sometimes works on PeerTube, but it's a bit hit and miss. Also, I don't usually have to do that much on the legacy video sites these days, because they try to do that buffering automatically.

Considering that PeerTube sites are often loading videos from another instance, and that WebTorrent introduces another layer of complexity, I think it makes sense to make the buffering behaviour of the PeerTube player quite conservative. In other words, I'd rather it did more buffering than it needs to, than not enough. If I have to watch a spinning beech ball for a while after I press play, before the video starts, that's a minor annoyance compared to having it stop and start while it's playing, or worse, freeze up entirely.

Type

Most helpful comment

Just wanted to confirm that I tested this just now on the ancient 32-bit laptop running Trisquel (see above), using a couple of videos on Vidcommons.org. As long as I make sure the quality isn't set too high (I had to change one video from 720 down to 360), and pause for a few seconds to let the video buffer before I start watching, playback now works smoothly. Fantastic work!

All 14 comments

I just tested again using the same video, What Is PeerTube (which is awesome BTW :), on the same net connection. This time I used an older, less powerful computer, which generally does ok watching videos (at the lower quality settings) on YT or Vimeo. The computer is running 32-bit Trisquel 7 (based off Ubuntu 14.04) using the default browser (ABrowser, based on Firefox 60.0.1). It has dual-core 1.6Ghz, 2GB RAM, and an SSD.

The video stopped and started a lot, and when I tried pausing to allow it to buffer, it seem to result in it reloading from scratch, and the buffering didn't seem to be very effective. In the end I gave up watching as the viewing experience was just too frustrating. On the positive side, this is an improvement on the last time I tried to watch a PeerTube video on this computer, where it wouldn't even start playing at all (although this could be due to NoScript, which I did have set to allow all the JS running on PeerTube, but this time I disabled it completely for the tab running PeerTube).

I'm happy to run any tests that might help you tweak the software to provide a smoother viewing experience on older computers or slower internet connections.

Hi @strypey, thanks for your issue because feedbacks on video playback is very important for us.

For your Macbook I don't really understand, because we don't have buffering logic in PeerTube. We just download all the data we can. See https://github.com/Chocobozzz/PeerTube/issues/75. When you stop the video, do you see you still download data (you can see in the controlbar of the player)? If you open the dev console, do you still see HTTP requests after pausing the video?

For your Trisquel computer, I think it's a CPU issue. When you play the video, how many CPU usage firefox consumes?

I'll need to wait until my wife is home to do any more testing with the MacBook, but on the Trisquel PC:

When you stop the video, do you see you still download data

No. The progress bar stops moving, and the k/s number next to download goes down to zero almost straight away.

I think it's a CPU issue. When you play the video, how many CPU usage firefox consumes?

Seems like it. As soon as I hit play on a video, the CPU starts hovering above 90%, and stays that way even when the video is paused. As soon as I close the tab with PeerTube running in it, it goes right back down to around 20%.

To see what is the CPU bottleneck (With the % of CPU used):

  • Could you try to play the video in your web browser with the native player (for example https://framatube.org/static/webseed/217eefeb-883d-45be-b7fc-a788ad8507d3-1080.mp4)?
  • Could you try to play the video, pause it immediately, wait for the video to finish to download and replay the video?

This way, we could see if the video downloading is the main CPU consumer or if it is the video's playback.

Sorry it's taken me so long to get back to this.

Could you try to play the video, pause it immediately, wait for the video to finish to download and replay the video?

See:
https://github.com/Chocobozzz/PeerTube/issues/585#issuecomment-392513822

BTW I tried watching that video using 'open network stream' on VLC, and it worked quite well, which is cool. I don't think that would have allowed my PC to help with seeding though, would it, which is a shame. I wonder if a PT desktop client could be created using components from VLC and a cross-platform BitTorrent client like Transmission, with a UI modeled on the PT web UI?

I also tried with this video in the web browser:
https://framatube.org/videos/watch/9ec10097-baab-4bd9-82d1-39c9afdd6b53

The audio playback was pretty smooth, but the video was very jerky, even at 240p. Again, there seems to be no downloading happening when I pause the video, at least if the progress bar is to be believed.

@strypey the webtorrent desktop client already allows you to play in VLC. You have to download the metainfo file manually and add it to webtorrent, though.

On 2018-06-13 08:04, Rigel Kent wrote:

@strypey the webtorrent desktop client already allows you to play in VLC. You have to download the metainfo file manually and add it to webtorrent, though.

OK. I only vaguely know what this means, which suggests it's a UX that
could be improved on ;)

Perhaps related to this bug, I've been trying to track down some performance problems that seem like they could be either client-side or network related, and I'd love a way to log connectivity and buffer debug info easily.. something a bit like utube's "stats for nerds"

There's been some discussion by the WebTorrent devs about allowing WebTorrent to work over WebSockets, instead of WebRTC:
https://github.com/webtorrent/webtorrent/issues/1492

Would this reduce the CPU usage of PeerTube sites and improve the playback performance? If so, it would be good to make some comments encouraging them to do the WebSocket development, and if anyone here can help on the technical side, please chime in on that issue too.

I've just tested again on the MacBook, with this video:
https://peer.tube/videos/watch/36489c63-1c42-47bb-9fd0-de4a838a1471

The performance is still very stuttery at first, I tried pausing the video, and it did seem to be buffering. I left it for about 10 mintes, and now it's playing fine from the buffer, but it's still playing much faster than it's downloading. According to the display under the video, I'm getting between 9KB and 32KB download speed, from 1 peer; very variable. No uploading appears to be happening. Curiously, the download speed seemed to improve while the video was paused, sometimes hitting 100KB later in the process.

OS: MacOS El Capitan 10.11.6
Browser: Firefox 62 (64-bit)

I have had some problems watching YT through invidio.us recently, so it's possible our net connection is being throttled somehow. Happy to run a benchmark on it if that will help separate out what's PT performance and what's our net connection.

Just wanted to confirm that I tested this just now on the ancient 32-bit laptop running Trisquel (see above), using a couple of videos on Vidcommons.org. As long as I make sure the quality isn't set too high (I had to change one video from 720 down to 360), and pause for a few seconds to let the video buffer before I start watching, playback now works smoothly. Fantastic work!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nutomic picture Nutomic  路  3Comments

Angedestenebres picture Angedestenebres  路  3Comments

ufm picture ufm  路  3Comments

roipoussiere picture roipoussiere  路  3Comments

filmaidykai picture filmaidykai  路  3Comments