cross-posted from: https://lemmy.ml/post/49015971
YouTube is still one of the major points of centralization on the internet, so I’ve been brainstorming ways around the problem.
From the readme:
Torrent-Tube is a set of tools to help decentralize YouTube videos, by moving them to torrents, which can be shared by many people. It includes:
- A Torrent-Tube search site which searches the Torrents-csv search engine to see if the given YouTube video already exists, and is being seeded.
- It does this by extracting the YouTube [VIDEO_ID] from a link, which you can also do manually if you like (IE, the text after
watch?v=...).- A script to download, and create torrent files from YouTube videos, with a uniform naming style and format, taken from TheFrenchGhosty’s YouTube-DL-Scripts.
- You will need to upload these torrent files yourself to a service (details below), and seed them.
In the future, it may be possible to create a browser plugin that checks a video link that you’re currently watching for existing torrents.
Create torrent script
Requirements
Instructions
Copy a YouTube video URL.
# Clone this repo git clone https://github.com/dessalines/torrent-tube # Run the script ./create_torrent.sh [YOUTUBE_URL]The video will download, and is saved in the
videosfolder. The torrent file is saved in thetorrentsfolder.Add the torrent to your torrent app, such as qbittorrent.
A crucial use-case would be in-browser video playing from torrent-tube and currently that does not seem possible. I have been looking for an alternative to Catbox for a while and am not too fond of Streamable.
Alternatively could Lemmy get embedded support for playing Peertube videos instead of redirecting to the Peertube website and having to play the video there? Similar to how playing Imgur or Catbox videos works in embedded format without having to go to a different website.
This might not be appreciated but I am not web-technical enough to understand this back-end so I asked an LLM and this is what it said
LLM response:
❯ I would like to create the simplest browser-based viewer for videos uploaded to TorrentTube. Is this possible with just a browser extension (no changes to TorrentTube)?
● No.
A standalone browser extension cannot achieve this—regardless of the platform—due to two fundamental constraints:
- Network limitations: Browsers can’t access torrent swarms directly.
Extensions run in a sandbox and lack raw socket access (Manifest V3 has no
socket API). The only viable option is WebTorrent over WebRTC, which
requires WebRTC-capable seeders and
wss://trackers. Without changes to TorrentTube, no such seeders exist (only qBittorrent seeders are present), leaving the extension with zero peers to connect to. - Codec incompatibility:
.mkvfiles aren’t natively playable by the<video>element.
Workable solutions require external components (not on TorrentTube’s side):
- A streaming gateway (e.g., webtor.io or self-hosted): The extension
sends a magnet link to a server that downloads via BitTorrent, remuxes the
video, and streams it via HTTP to
<video>. (This is the simplest path.) - A local helper app via native messaging: The extension communicates
with a local torrent daemon streaming to
localhost.
→ Short answer: An extension alone is impossible. An extension + gateway is possible (and requires no TorrentTube changes).
❯ Could TorrentTube itself implement changes to enable direct browser streaming (no gateway/helper)?
● Yes. With three specific changes, TorrentTube could stream torrents directly in the browser:
- Seed over WebRTC: Run WebTorrent-hybrid seeders (or similar) to provide browser-compatible peers.
- Add
wss://trackers: Modifycreate_torrent.shto include WebRTC-compatible trackers (e.g.,tracker.openwebtorrent.com). - Encode to MP4: Output fragmented MP4 (H.264/AAC) instead of
.mkv(usingyt-dlp --remux-video mp4).
Result: A minimal WebTorrent.js extension (or even a plain webpage) can stream magnets directly via
<video>+ Media Source Extensions—exactly how instant.io/btorrent.xyz works.Key caveats:
- ✅ Backward-compatible: Existing swarms (qBittorrent) remain functional.
- ✅ No transcoding needed: The MP4 format is browser-native.
- ⚠️ Requires one persistent hybrid seeder: Browser peers vanish when tabs close, so a lightweight always-on seed node is needed (but no server costs).
- ⚠️ Format shift:
.mkv→.mp4(both formats can coexist for archival/streaming).
→ Summary: Changes 1–3 transform TorrentTube into a PeerTube-style system where videos stream directly in the browser via a simple extension.
*Want me to draft the modifiedcreate_torrent.sh(withwss://trackers- MP4 output) and a minimal WebTorrent content script for Lemmy?*
Key improvements: Removed redundancy (“no changes from TorrentTube side”), clarified technical terms (“hybrid seeders,” “fragmented MP4”), standardized formatting, fixed “Torrenthub” → “TorrentTube,” and tightened phrasing while preserving all technical nuance.
- Network limitations: Browsers can’t access torrent swarms directly.
Extensions run in a sandbox and lack raw socket access (Manifest V3 has no
socket API). The only viable option is WebTorrent over WebRTC, which
requires WebRTC-capable seeders and
That’s a really good idea given all the problems with youtube and that they can just take down videos or channels without notice. One thing to explore would be having discovery without necessitating tracker sites. Stuff like dht-spider might be worth a look.
It might also be interesting to take an existing GUI like Freetube and try swapping out the backend with a torrent based one.
Torrents-csv does use a crawler I believe to add new torrents. torsniff is one of those spiders that works really well.
It might also be interesting to take an existing GUI like Freetube and try swapping out the backend with a torrent based one.
Ya I’m not sure how to handle the UI side of things yet, especially for content discovery.
Dream might be a good starting point actually. It’s been last updated a year ago, but it does have a solid core for decentralized streaming on top of bittorrent and kademlia DHT. It handles upload, search, and stream videos without central servers.
Nice, I’ll check it out.
I think this is pretty clever, kind of like the old Popcorn Time app for YouTube.
Thx! For the record, this doesn’t cover the viewing part, which would require a torrent app and a local media player of your choosing. Any should work tho.
edit: I’ll add that to the instructions.
A question I like to ask a lot whenever I see a new project that is similar to other existing or popular projects:
- Why should I use this over XYZ?
- What does this project do differently than XYZ?
If a developer can answer these questions, it tells me they have a clear picture of what their project is and should be.
So, I ask the same to you:
- Why should I use this over yt-dlp, Piped, Invidious, etc?
- What does this do differently than the other projects?
Why should I use this over yt-dlp, Piped, Invidious, etc?
None of those are attempts to decentralize youtube. Piped and invidious are only front ends for youtube, which can easily be blocked by youtube at any moment, which has happened in the case of tons of third party clients.
yt-dlp is a very useful tool (which this projects uses), to download youtube videos. It does not help collectively share them, as torrents would.
What does this do differently than the other projects?
Peertube and other youtube alternatives are based on centralized hosting. This is completely unsustainable, because the HD space required for servers quickly grows out of hand, and becomes extremely expensive. Meanwhile, torrents are shared hosting, where many people are sharing files at once. It is the main way large files like movies are distributed over the internet, for decades now. We should apply that same effort to creating torrents for youtube videos, in the same way that is already done for other large files.
Could one integrate this with apps like NextTube or PipePipe? I.e., When I search for a video on those apps, they search the torrent index first, then search Frama Tube / PeerTube second, then search YouTube-proper last. While I’m streaming a video from any of these sources, I am then also downloading and seeding it to the torrent network and I keep seeding the last videos I watched on a rolling basis until an allocated memory space on my disk is full and the oldest or least requested video in that local buffer is deleted to make space for new; while I’m on Wifi to save mobile data? I think providing such seamless integration is the best way to get this space densely populated enough to be useful.
I like your logic here. Torrent index -> alternative platforms -> YT proper.
Assuming the torrent index becomes decentralized, there are really two categories where it makes sense to build this in:
-
The YouTube frontends, as you mention
-
The self-hosted downloaders that already exist, like Tube Archivist
I think the second category is where you get all the seeding traction. Sure, it would be great if the Android frontends also participate, but there are thousands of NAS devices that are already downloading YouTube videos for a single user. If there was an addon that allowed all of these users to share content automatically, I think there would be a lot of buy in / seeding.
Yes, this could potentially be used in youtube front-ends. IE show the magnet link of a given video if it exists, so that it could be torrented.
-
Would be awesome if we could somehow get a decentralized video back-end for Lemmy. Videos are currently still a large issue for uploading here.
This already exists, they’re called torrents, and lemmy works with magnet links already: https://join-lemmy.org/docs/users/02-media.html#images-and-video
Interesting I might test that somewhere soon. But it doesn’t look like just dropping in a video like how Reddit does it.
Will this let me bypass those “login to verify age” walls? I hate those.
Torrents don’t have those, so ya.
Nice, sounds a bit like PeerTube if I am not mistaken. Is the difference that you don’t have to upload a video to make it available in a decentralised matter?
The main difference from peertube, is that peertube is based on webtorrents (which after many years, its been shown that ppl don’t use them), whereas this is based on regular torrents.
You still do need to create a torrent for the videos and seed them, if one doesn’t exist already. But this has the possibility of decentralizing video hosting away from youtube.
I’ll be using this process for every video I watch now.
Any way to combine yours/ordinary torrents and peertube web-torrents, so the systems can support each other ?
The majority of torrenters don’t use webtorrents, and I’m only grabbing the most popular trackers for building these.
Sounds neat! I look forward to trying it out myself shortly. Thank you for sharing.
@dessalines@lemmy.ml mktorrent doesn’t seem to work on windows. Is there an alternative you would consider or can suggest I try?
I don’t use windows so I don’t know.
While moving video files to torrents improves distribution resilience, relying on a centralized search index like torrents-csv reintroduces a single point of control and potential censorship. To truly decentralize the metadata layer, consider whether the search infrastructure itself can be federated or if the client should handle local indexing to eliminate dependency on any external discovery service.
To truly decentralize the metadata layer, consider whether the search infrastructure itself can be federated or if the client should handle local indexing to eliminate dependency on any external discovery service.
A federated search service / index (especially unmoderated) could quickly fill up with spam. So at least the torrent additions / adders themselves need to be vetted and trustworthy for a search to work correctly.
And of course torrents-csv doesn’t have to be the only place hosting magnet links. They could easily be posted to any federated app, like a lemmy community or mastodon also.
I guess the main issue i’d encounter is syncing watched progress metadata with YouTube servers, which Grayjay & Smarttube both optionally do
There are projects out there to create a jellyfin / media server styel experience out there for videos downloaded using
yt-dlp.This doesn’t conflict with those, but is more about the hosting / sharing side. However you download youtube videos, its possible to use a media server to sync watched progress.
I really like this idea, and I suppose it could also be built to include videos from other video hosting cites as well in the future.
Do you think this could become popular enough it to be useful? Public BitTorrent trackers for other media are barely seeded as it is and they have been active for decades. Why would people want to seed media they can watch for free on youtube? (to be clear I understand why but it’s difficult to get enough others to understand something like this.)
Another issue is if it does get popular enough to become useful I could imagine this being a major target from YouTube, or do I misunderstand the copyright laws? Actually considering the db is just one massive torrent.csv file I guess you can’t really sensor that. Although I’m not sure if a copyright troll issue could arise.
Also that 38 MiB csv file is insane.
Do you think this could become popular enough it to be useful?
Everything starts from zero, so really it just requires a push for the project to get started.
Public BitTorrent trackers for other media are barely seeded as it is and they have been active for decades.
I don’t think I agree with this. Many torrents have thousands of seeders, and even if I search for old movies, I can find ones with at least a handful of seeders. Given the popularity of youtube videos, its possible that people would seed their favorites if they have the possibility to do so.
Actually considering the db is just one massive torrent.csv file I guess you can’t really sensor that.
Yep, its kinda wild, that the entire index of popular torrents (which equates to most popular media humankind has created), fits in a
CSVfile of less than 200MB. Makes it pretty hard to censor in that case.Ok you’ve convinced my now, I do hope we can get YouTube videos away from YouTube.
Considering so many torrents seem to die I doubt this would catch on for anybody but the biggest youtubers… Unless you can get those authors to join in this.
It would need to hit a pretty large critical mass to start being possible. I see you also posted with datahoarders, that’s the only hope I guess.
Might I recommend you add some kind of discovery feed ? I wanted to search for something but I couldn’t find anything, unfortunately in your search engine.
People upload to Youtube so they can extract a small share of the rents from surveillance capitalism. If you don’t solve that problem then nothing will change.









