this post was submitted on 07 Jul 2023
85 points (98.9% liked)

Fediverse

17735 readers
39 users here now

A community dedicated to fediverse news and discussion.

Fediverse is a portmanteau of "federation" and "universe".

Getting started on Fediverse;

founded 5 years ago
MODERATORS
 

Can someone help me with how peertube P2P works? I can understand how ActivityPub is used for all the "social" parts but I'm a bit confused about the actual video player.

Redundancy:
I have my own instance and I made a redundancy of a video from the blender instance. if I watch the video on my instance I see 2 peers, my instance and the blender one. I can seen both in Firefox dev tools.
If I watch the same video on the blender instance I see 7 peers, the blender instance, mine, and others. why are these extra peers not showing on my instance? do I need to do something? If I watch the video on one of these other instances mine does show up in the their peers list.

I also made a video from framatube redundant but my instance doesn't appear as a peer on framatube.

Client P2P:
If I watch a video does my browser share It over P2P? if so what is the point of this? it seems to lose the video as soon as I leave the page so this functionality seems a bit useless to me.

EDIT: Answered in comments.

BitTorrent:
If I download a video I get the option of a BitTorrent torrent. If I seed this torrent can it be leeched by web clients? I tried and It doesn't show up in the peer list. What's the point of running a full BitTorrent tracker if it doesn't work with the main P2P system?

EDIT: BitTorrent is incompatible with webtorrent that peertube uses. Peertube also uses HLS instead of webtorrent and behaves a bit different (you can't seed it with a webtorrent client).

Peer discovery:
As I said in 1 and 2 how does the player actually find peers? Is there something like DHT or a tracker built in to peertube? if it's an internal tracker how does the tracker find peers?

EDIT: It uses a tracker build in to peertube.

Thanks for any help.

top 21 comments
sorted by: hot top controversial new old
[–] poVoq@slrpnk.net 14 points 1 year ago* (last edited 1 year ago) (3 children)

If I watch a video does my browser share It over P2P? if so what is the point of this? it seems to lose the video as soon as I leave the page so this functionality seems a bit useless to me.

This is the main feature of Peertube. It allows many people to watch the same video simultaneously without totally overwhelming and DDos-ing the server that hosts the video.

Peertube uses webtorrents: https://webtorrent.io/

[–] deadsuperhero@lemmy.ml 1 points 1 year ago* (last edited 1 year ago) (1 children)

Only partially true nowadays. WebTorrents is a format that PeerTube can use, but is deprecated and non-default in newer releases. Instead, the preferred method now is HLS, which I think is a fair bit more reliable.

[–] poVoq@slrpnk.net 1 points 1 year ago* (last edited 1 year ago) (1 children)

Hmm, really? That seems to remove the main benefit of Peertube over just hosting a video on any other ActivityPub enabled website.

Is there an explanation somewhere why they decided to depreciate webtorrents?

[–] deadsuperhero@lemmy.ml 0 points 1 year ago (1 children)

They explain the rationale here: https://docs.joinpeertube.org/admin/configuration#webtorrent-transcoding-or-hls-transcoding

Basically, it's extremely buggy. HLS with a p2p loader is generally more reliable, with faster loading and higher quality.

[–] poVoq@slrpnk.net 2 points 1 year ago (1 children)

Thanks. Hmm, this "HLS with p2p" is not well explained on that page. I guess I'll need to investigate what that does exactly. I assume it is not doing the same client based seeding like webtorrent is able to do?

[–] deadsuperhero@lemmy.ml 1 points 1 year ago

I would assume so? I mean, I still see peer stats on the video player, even though all my videos use the HLS format?

[–] thomas@lemmy.douwes.co.uk 1 points 1 year ago (1 children)

Would it not make more sense if your instance downloaded and redistributed the torrent? then you could keep seeding after the tab closed. it also wouldn't leak your IP then.
What about peer discovery? I opened that webtorrent website in two browsers and they didn't peer, is that demo real?

[–] poVoq@slrpnk.net 4 points 1 year ago (1 children)

This is about visitors re-seeding the video they watch, but yes like all p2p systems it leaks their IP to other peers.

[–] thomas@lemmy.douwes.co.uk 1 points 1 year ago (1 children)

Why not also use the instance to re-seed? it could keep seeding after the visitor closed the video.

[–] poVoq@slrpnk.net 2 points 1 year ago (1 children)

AFAIK it does, but if the instance seeds it then that is no different from hosting the video directly on the website, thus this doesn't help with bandwidth at all.

[–] thomas@lemmy.douwes.co.uk 1 points 1 year ago (1 children)

why? if 5 instances are seeding the video, clients should be able to download from all 5 instances and spread the bandwidth usage right?

[–] poVoq@slrpnk.net 3 points 1 year ago (1 children)

Other Peertube instance are not hosting the video at all AFAIK. The ActivityPub federation and the webtorrent p2p bandwidth off-load are two fully separate things.

[–] thomas@lemmy.douwes.co.uk 1 points 1 year ago (1 children)

Webtorrent seems to have some issues with peer discovery. I've tried the instant.io site they have linked on webtorrent.io and I can't get it to download or share anything, the desktop client managed to download a torrent from my peertube instance over normal BitTorrent but I can't share it over webtorrent. I downloaded a video from my peertube instance using btorrent.xyz over webtorrent but I can't seed new files because the peers don't find each other. when I use a webtorrent with a tracker (like peertube) it works fine but how were sites like instant.io supposed to discover peers without trackers? I don't think DHT exists for webtorrent yet.

You can manually seed videos on instances using redundancy but I was thinking automatic redundancy for watched videos might be a good idea, I guess you can do automatic redundancy for entire instances but that would take up a lot of storage space.

One of the nice thing with BitTorrent is the high reliability so I assumed that was what peertube was trying to do, I guess the idea is not to provide data redundancy but to split load instead?

[–] poVoq@slrpnk.net 1 points 1 year ago (1 children)

I guess the idea is not to provide data redundancy but to split load instead?

Yes, the sole reason.

[–] thomas@lemmy.douwes.co.uk 1 points 1 year ago* (last edited 1 year ago)

I have done some testing and I found a few reasons I'm having issues with webtorrent:

  • The only reason they where working at all is because they were downloading from the HTTP URL in the torrent file, P2P was not working at all.

  • To download the webtorrent from the blender instance I need to have the video watched in my browser to peer with the webtorrent client, the instance peers don't work on non-peertube webtorrent clients.

  • The reason instant.io was broken is my adblocker was blocking the tracker.

  • ~~The tracker in my peertube instance is broken.~~

EDIT:
I was a bit wrong here, there are two different formats in peertube: webtorrent and HLS. I was getting confused why the video on my instance (HLS) and the one on the blender one (webtorrent) was behaving differently with webtorrent clients. They are completely different formats so that makes sense now.

[–] madeindjs@lemmy.ml -1 points 1 year ago (1 children)

I did think about building a Chrome extension to do this with Youtube. I wonder if it's possible

[–] poVoq@slrpnk.net 6 points 1 year ago (1 children)

Why on earth would you want to help Google saving bandwidth?

[–] madeindjs@lemmy.ml 1 points 1 year ago

Yeah, said like this it sounds stupid 😅

[–] deadsuperhero@lemmy.ml 3 points 1 year ago

A simple way to understand it: PeerTube itself doesn't actually federate videos - instead, it's a shared catalogue where metadata representing video entries are the things that get shared from server to server, as ActivityPub Objects. This makes federation fairly lightweight, because instances aren't just passing copies of huge files back and forth on a network.

The actual video itself is hosted on the parent instance, or at the very least, in an Object Storage Layer (basically a CDN) that the server is integrated with. When a video is uploaded, it gets re-encoded in either one or two different formats - Webtorrent, or HLS. When people watch the video, it becomes peered between videos, where people with more of a downloaded video helping people with less of a downloaded video. The methods, I think, depend on which encoding format was used - HLS largely relies on "Playlists" that put together a video broken into several files, for seamless playback, Webtorrent I think works a little more like a traditional torrent does, with seeders.

[–] EthicalAI@beehaw.org 2 points 1 year ago (1 children)

All good questions! I’d also just like to know what a few of the “best” instances are to watch videos on. I don’t get discovery. They all have weird names.

I follow a bunch of the stuff on kolektiva.media but would love to see more content get shared on cool instances

load more comments
view more: next ›