Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What would it take for Lemmy to become a Youtube (and Spotify) replacement? #4204

Closed
4 tasks done
dessalines opened this issue Nov 25, 2023 · 9 comments
Closed
4 tasks done
Labels
area: media enhancement New feature or request type: discussion General talk without any clear action
Milestone

Comments

@dessalines
Copy link
Member

Requirements

  • Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • Did you check to see if this issue already exists?
  • Is this only a feature request? Do not put multiple feature requests in one issue.
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Is your proposal related to a problem?

This is a placeholder for discussion around what it would take for Lemmy to effectively replace youtube, spotify, and other centralized media platforms.

The main alternative in the fediverse is Peertube, which is excellent software, but it has some limitations:

  • Videos (unlike text) require a ton of hard drive space and bandwidth, making peertube very expensive to host.
  • What decentralized content-sharing does exist, is based on webtorrents, which most torrenters don't use. This puts all the hosting cost on single servers, which usually shut down after costs rise.
    • I'd thought that libtorrent would add webtorrent support, but its been stalled for years now.
    • This also could've been circumvented by browser-based torrent plugins, but peertube isn't set up for it (and most torrenters prefer their own clients anyway).

Describe the solution you'd like.

Torrents

Torrents have fully solved the static data distribution problem by decentralizing content sharing. Many torrents have thousands of seeders, and even a video with a small number of seeders is infinitely more healthy and reliable than a single hoster.

Lemmy as a community-based link aggregator is well suited for the use of torrent-magnet links to share content, and already supports it. Torrents are missing the community and discussion features that lemmy has.

Video upload steps

Lets take the example of someone wanting to share a cooking video, and see how a torrent-based solution could work with lemmy.

  • User clicks a button in lemmy to "upload" content. Instead of actually uploading, this either uses a service or helper program to create a torrent, or just shows an instructional dialog for how to create and seed this torrent locally.
  • User pastes the torrent link, and also has the option to upload a custom thumbnail for their video (lemmy is currently missing this)
  • Other users can then click the torrent link, and view the content.
    • Lemmy also could detect torrent magnet links, and have a helper dialog which shows users how to use them. Ideally we would direct people to the most user-friendly torrent client, and possibly one which supports videos natively (popcorntime maybe).

What lemmy has that works well for this purpose:

  • Magnet link posts
  • Communities
  • Comment sections

What lemmy is currently missing:

  • Custom thumbnails.
    • Lemmy scrapes http links for thumbnails, but magnet links don't have them. We'd need the ability to choose a custom thumbnail.
  • A user-friendly way to view these videos, either in the browser, or via people's own torrent clients and video players.

Describe alternatives you've considered.

Peertube - but it has limitations: see discussion above.

Additional context

All of these same ideas apply equally to audio and images.

@dessalines dessalines added enhancement New feature or request type: discussion General talk without any clear action area: media labels Nov 25, 2023
@sleeping-miyagi
Copy link

I'd love to see video support for Lemmy and I do agree that storage and bandwidth are two big concerns of video hosting.

Most centralized video hosting platforms (like YouTube and Vimeo) usually compress videos to reduce bandwidth costs. Depending on the encoding settings (at least for FFMPEG), this may require a lot of CPU power or dedicated hardware (QSV or a GPU) which can be very costly as well. Alternatively, you can pre-define an upload size limit (like in Discord) so users will have to compress videos themselves before uploading.

The torrents idea sounds interesting but it doesn't seem very user-friendly IMO. From what I understand, the user only provides a magnet link to Lemmy and this will require a seperate program to locally store and seed the video content. Wouldn't this expose the user's IP address and require the user to have forwarded ports? Don't they also need to keep their device running? Also, how do we verify that the content is an audio/video file from the magnet link alone?

I think it might be worth looking into something like IPFS to help with bandwidth or using a CDN. Either way, this won't solve the storage problems. Only compression could help with that.

@Die4Ever
Copy link

I feel like this is a lot of things, and also it should probably be a series of plugins? so it would be dependent on issue #3562

@dessalines
Copy link
Member Author

dessalines commented Nov 26, 2023

Most centralized video hosting platforms (like YouTube and Vimeo) usually compress videos to reduce bandwidth costs.

That's all up to video uploaders, but its possible to have helpers to make this process easier on uploaders, ideally via external services. I'm aware that many video uploaders don't know ffmpeg, but I'm sure there's got to be some temporary video service that can help them through the process.

The torrents idea sounds interesting but it doesn't seem very user-friendly IMO. From what I understand, the user only provides a magnet link to Lemmy and this will require a seperate program to locally store and seed the video content.

That is probably the biggest concern, but I think its possible to provide UI helpers to make this flow easier. For example, we could detect torrent links, and have a button appear that links to something like webtor.io (or instant.io) . example

It looks like webtor is also embeddable

Wouldn't this expose the user's IP address and require the user to have forwarded ports?

Yes torrents do (for anyone not using a VPN), but this IMO would be a small price to get away from youtube and centralized stores. The same problem exists for images already of course, which also should be decentralized in the same fashion.

Also, how do we verify that the content is an audio/video file from the magnet link alone?

That would require some kind of infohash-based torrent metadata service (if I had the time, I'd work on one), but even without that, services like webtor can automatically figure that out.

@0x00cl
Copy link

0x00cl commented Nov 30, 2023

Videos (unlike text) require a ton of hard drive space and bandwidth, making peertube very expensive to host.

I don't see how this is solved by the proposed solution. If users are going to upload magnets/torrents and will have to host them for other users to watch/listen content, from my understanding, its exactly the same what peertube does except with a nice GUI. Video hosting is what makes peertube "expensive", not the software itself.

User clicks a button in lemmy to "upload" content. Instead of actually uploading, this either uses a service or helper program to create a torrent, or just shows an instructional dialog for how to create and seed this torrent locally.

There is a torrent creator on the web which I'm sure it could be implemented in lemmy UI, so a user just "uploads" a file, but what happens in the background is, it just creates a .torrent file, so its more user friendly than trying to follow instructions on how to create a torrent.


What's stopping from having a "better" integration with peertube? Its possible to embed videos in a website.

@entropicdrifter
Copy link

entropicdrifter commented Dec 15, 2023

Video hosting is an important technical issue, but it's also important to keep in mind that we've already got technically fine competitors to those services: Vimeo and Tidal, for instance.

One of the biggest issues is the question of how to move content creators from one platform to another without basically just insisting that they beg for scraps via Patreon et al. within their descriptions/content. A FOSS music/video streaming platform is a great idea and sounds perfect to me as a user, but I if were a musician or video essayist trying to make a living off of my art, there's the major issue of monetization to consider.

I'm not saying it needs to be a subscription service, but we should at least allow creators to have the ability to, e.g., force donation/patreon/etc links to appear with their content even if it's a repost or not hosted on the instance they "uploaded" to.

Otherwise, there's an active incentive for creators to keep their content off of this new platform for risk of going broke.

I don't really care about piracy when it means cutting out the giant corpos stealing the lion's share of the revenue from media, but sites like YouTube currently support a lot of grassroots creators as well, so I'm just saying we need to consider at least proper crediting and links for supporting content creators as the default so they can organically grow their fanbases.

@sneakers-the-rat
Copy link

sneakers-the-rat commented Dec 16, 2023

I think for the sake of this issue we can focus it more closer to "what would it take to make lemmy a viable video hosting platform" and agree with OP that p2p is definitely an important tool towards this end, but also bittorrent is not necessarily the ideal tool. I think we can partially separate that from equally valid problems that eg. @entropicdrifter points to re: social incentives and monetization, though bittorrent culture has history that can weigh in here as well (the origin of platforms like bandcamp which arguably found in pirates on private trackers their earliest bases of support)

Asking someone uploading a video to remain an indefinite bittorrent seed to keep their video on a platform i think is a nonstarter for a bunch of reasons, not the least of which being that only those ppl who are capable of being indefinite bittorrent seeds are the only ones that could upload. If we open our horizons beyond bittorrent though there is plenty of space for p2p to play a role :).

Peertube is a good example - they use p2p-media-loader based on webRTC to serve video over p2p. Their model is similar to the old spotify p2p system - use HTTPS server to initiate the stream as a low-latency source, and continue to use it if no other peers are available. If peers are available, start using them to buffer the video, eventually switching entirely to a p2p feed. That uses webtorrent! which rocks! but is not the same thing as asking everyone uploading a video to seed as if it was a pure-bittorrent system.

The hybrid server/client and p2p model is a great fit for something like Lemmy where, yes, the host would be responsible for storage costs for media uploaded to the platform, but the hybrid p2p model would allow a lot of bandwidth costs to be defrayed - and extra-dedicated uploaders could serve as seeds for their own content (and instances could require that if needed) in addition to the instance host.

So tl;dr the peertube p2p media loader could be dropped in as a low-downside high-upside addition to the way lemmy currently serves video, en route to a fuller p2p system like the kind that OP describes. There are a lot of interesting opportunities that come with this w/ federation too - eg. federated lemmy peers could rehost videos from smaller lemmy peers with any additional storage space they have in a way that makes the whole network faster and more resilient.

@Anaisrim
Copy link

Anaisrim commented Jan 8, 2024

Just want to add a quick comment. I suggested Magnet links on the mod coordinating chat room for LemmyNSFW as well. And while it's true seeding would be an issue, the fact is there are use cases where a site administrator / owner would like to separate him or herself from storing the content served. It's not just a storage cost issue. In the NSFW space there are hosting issues and potential legal ramifications across differing jurisdictions. And I'm not talking about clearly criminal content. There are also already web based streaming torrent players right here on github, so that part already exists.

The current situation with video and looping gif support is problematic. Lemmy needs rich content. And that's well beyond just NSFW material.

@dessalines
Copy link
Member Author

@asonix What are your thoughts on this, and how pictrs could play a part (or not) ?

I'd def prefer the solution to be torrent-based, since there's already an ecosystem of seeders ready to seed videos and channels. Pictrs could serve as a sort of temporary (or permanent) seeder.

dessalines added a commit that referenced this issue Feb 4, 2024
dessalines added a commit to LemmyNet/lemmy-docs that referenced this issue Feb 6, 2024
- These instructions can then be linked to in UIs,
  where the post_url is a torrent magnet link.
- Context: LemmyNet/lemmy#4204
Nutomic pushed a commit to LemmyNet/lemmy-docs that referenced this issue Feb 8, 2024
* Add instructions for Torrent-Streaming to docs.

- These instructions can then be linked to in UIs,
  where the post_url is a torrent magnet link.
- Context: LemmyNet/lemmy#4204

* Fixing up language, and wiki link.
Nutomic pushed a commit that referenced this issue Feb 15, 2024
* Adding ability to specify a custom post thumbnail.

- Context: #4204

* Fixing ts-rs serialization.

* Fixing conversion, adding checks.

* Proxying custom_thumbnail. Fixed logic for update.

* Only generate metadata thumbnail is theres no custom thumbnail.
@dessalines dessalines added this to the 0.20.0 milestone May 4, 2024
@Nutomic
Copy link
Member

Nutomic commented Sep 12, 2024

Discussion is completed, feel free to open a new issue with specific features to implement for this.

@Nutomic Nutomic closed this as completed Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: media enhancement New feature or request type: discussion General talk without any clear action
Projects
None yet
Development

No branches or pull requests

8 participants