The Project 📹

A couple years ago I got connected with Andrew Case, the co-creator of Aleph with Beth, a YouTube channel with the goal of making top-quality Biblical Hebrew educational resources available to everyone who wants them. They’ve created hundreds of really well produced videos — lessons, practice stories, quizzes, songs, and more. Their videos are designed so that anyone, of (nearly) any age, with any educational, cultural, or linguistic background can learn Biblican Hebrew by watching and studying their videos.

I’ve been dabbling in learning the languages of the Bible since I was a kid, and when I first came across Aleph with Beth, my first thought was, “Man! I wish this was available 20 years ago!”

Because Andrew and his wife Bethany (the “Beth” in Aleph with Beth) have the goal of making all the resources they’re creating accessible to as many people as possible, they’ve published all their videos and other supplemental educational content under a free, Creative Commons license. Specifically, that means they actively encourage people to copy, redistribute, and spread around their content. They want people to copy their work and share it around online for others to consume for free.

I like that. We need more of that kind of generosity in the world.

So, I ended up in a conversation with Andrew at one point, and he mentioned that they wanted their videos to be a resource that even people without good internet access could make use of. We also talked about how it would be nice to find a way to “future-proof” the videos, so even when YouTube ceases business (as all companies eventually do), these videos will still be available and useful to those who want them.

Why BitTorrent? 🌊

As we were talking, we realized that one technology that could potentially help us achive both of these goals quite well is BitTorrent. BitTorrent is probably most widely known for its usage as a way to illegally pirate copyrighted material, and so some people have come to think that BitTorrent itself is illegal. However, that’s untrue. The technology itself is very legal, and is used in many legitimate contexts, even though there are indeed people who use it for illicit purposes.

Practically, BitTorrent provided Aleph with Beth with two really interesting and valuable features for their use case:

First, BitTorrent allows for downloads to happen as slowly as needed. Some of the people that Andrew knew who wanted to study their material live in remote African villages with only slightly-better-than-dialup internet. YouTube just simply doesn’t work in those conditions. But, with BitTorrent, someone could leave their computer on and downloading for several days or weeks, and slowly download the videos for as long as it took. Bit-by-bit, kilobyte-by-kilobyte, these videos can be downloaded and saved to students’ computers, where they can eventually be watched, rewatched, and shared with others in the villiage via USB or Bluetooth indefinitely thereafter.

So, BitTorrent would allow people to watch Aleph with Beth videos, even with extremely poor internet (or, no internet at all).

Second, BitTorrent is an extremely resilient protocol. A LOT of really powerful companies and governments have tried to restrict people from using BitTorrent (specifically to combat piracy), yet it still continues to be widely used protocol today, over 2 decades after it was created. Someday YouTube will shut down. And, with it, the hundreds of millions of videos that have been uploaded to the company’s servers will most likely be lost. But, as long as network-connected computers continue to exist, torrents will continue to be a way that those computers can share files between them. Which, I think is pretty cool. That means that turning a YouTube channel or playlist into a torrent and hosting it online is a half-decent way to make sure people can continue to access those videos into the future… assuming the internet continues to be a thing. ¯\_(ツ)_/¯

Sounds like something worth trying!

So, let’s give it a try. 🔥

What you’ll need 🤓

In order to do this, we’ll need a few things.

First, you’ll need a foundation with the Linux/MacOS command line. This tutorial will assume you know how to set up a Linux VPS, navigate directories, make new directories, and do other basic functions on the command line. I’m sure there are other ways to do this that don’t involve the command line, but that’s just not how I did it. 🤷🏻‍♂️

Next, you’ll need a computer with yt-dlp and rsync installed on it. You may optionally also want a batch file re-namer. I use vimv.

Finally, you’ll need a Linux server to host the torrents. I used a very cheap Debian VPS I was already renting from BuyVM, but any VPS from a company that gives you permission to seed torrents from it should do.

If you have an old computer that you can keep always on and plugged in, you could also potentially use it as a free server, instead of renting a VPS.

Download All the Things! 😎

So, let’s get to the fun part! Let’s start by downloading all the videos that we’re going to want to eventually turn into a torrent!

NOTE: Legal Disclaimer

Again, please bear in mind that you should only proceed to download and reshare a YouTube playlist if you have permission from the content creator. All Aleph with Beth videos are in the Public Domain, and so, I have legal permission to do this. Also, Andrew specifically asked me to do this 🙃.

Don’t do this if you don’t have permission/licensing rights!!!

First, create and navigate to a new directory/folder where we’re we’ll download the videos to.

Once there, here’s the command I run to download all the videos from a playlist:

yt-dlp -f 'bestvideo[height<=?1080][ext=mp4]+bestaudio[ext=m4a]/best[ext=m4a]' \
--add-metadata -i "" \
--output "%(playlist_index)s-%(title)s.%(ext)s"  --sleep-interval 3 --max-sleep-interval 10 \
--merge-output-format mp4  --embed-thumbnail --playlist-start 1

That command is a bit of a beast, so here’s a breakdown of how it works:

  • yt-dlp: we’re using the yt-dlp program to download this playlist.
  • -f 'bestvideo[height<=?1080][ext=mp4]+bestaudio[ext=m4a]/best[ext=m4a]': When YouTube stores a video, it stores it in a bunch of different file sizes and codecs. This flag loosely translates to “find the best mp4 video that has a resolution less than or equal to 1080p, and find the best m4a encoded audio file, and stitch them together”. When I created the torrent for Aleph with Beth, I used [height<=?1080] to create one torrent for 1080p videos, and then I changed the flag to [height<=?480] to do another torrent for 480p videos (better for phones/mobile devices).
  • --add-metadata: This flag will grab the description information from the YouTube video and encode it into the downloaded video file.
  • -i "": This is where we put the URL of the channel/playlist that we want to download. If you put a channel’s URL in here, you can download the whole channel. Andrew and Beth have taken great efforts to keep their playlists in the best order for students wanting to study through their material, so we’re just going to download their lessons playlist, instead of downloading the “channel” and needing to do a bunch more cleanup work after.
  • --output "%(playlist_index)s-%(title)s.%(ext)s": Because this script will download hundreds of videos into the directory its run in, we want to make sure that the resulting videos are named in an order that we can work with. This flag does that. It currently will save all the videos in the form of [VIDEO NUMBER]-[VIDEO NAME].mp4. The first video will be labeled 001-, the second 002-, etc.
  • --sleep-interval 3 --max-sleep-interval 10: This one is important. If YouTube thinks you’re a robot trying to download hundreds and hundreds of videos from their site, they will ratelimit you by giving you an 429 Error when you try to download, and eventually they’ll blacklist you. This command makes it so that your computer will pause for a random amount of time (between 1 and 10) between downloading each video. This will make it less likely that you get blocked/rate-limited.
  • --merge-output-format mp4: This just means “make sure the final file is in the mp4 format”.
  • --embed-thumbnail: This grabs the YouTube video thumbnail, and embeds it into the downloaded file.
  • --playlist-start 1: Where in the playlist should the download start? Useful for if you need to download just a specific part of the playlist for some reason, or if you pause the download 100+ videos in and want to restart without re-downloading everything. The current 1 just means, “start at the first video”, but you can change it to wherever you want to start the download from.

We run that command, and go get a coffee. ☕

Then dinner. 🍲

Then probably go to sleep and come back tomorrow because it’ll likely take hours for all the videos to download (depending on the size of your playlist). 😴

But, when it’s done, we’ll have downloaded the entire playlist!!

[Optional] Filename Cleanup 🧹

At this point, we should have all our videos saved into a directory, numbered in the order they show up on the playlist.

However, we have a minor problem. The filenames aren’t really great for saving and sharing:

001-Hebrew - First Words - דברים ראשנים  - Free Biblical Hebrew - Lesson 1.mp4
002-Hebrew - Plural Nouns & Adjectives - Free Biblical Hebrew - Lesson 2.mp4
003-Hebrew - Review Game for Lessons 1-2 - Free Biblical Hebrew.mp4
004-Hebrew - Conjunction & Gender - Free Biblical Hebrew - Lesson 3.mp4
005-Hebrew - First vocab in action - Biblical Hebrew - Lesson 3b.mp4
006-Hebrew - Subject Pronouns - Free Biblical Hebrew - Lesson 4.mp4
007-Hebrew - Pronoun Practice - Biblical Hebrew - Lesson 4b.mp4
008-Hebrew - Review Game for Lessons 3-4 - Free Biblical Hebrew.mp4
009-Hebrew - Family Terms - Free Biblical Hebrew - Lesson 5.mp4

They’re usable for sure, but there’s a lot of superfluous information in the names that would be nice to cleanup. These names are great for SEO, and to help people find these lessons on YouTube or via other search engines. But, if we’ve already downloaded the “Free Biblical Hebrew Videos” torrent, we don’t need to know that each individual video is about “Free Biblical Hebrew”.

It would be nice if we could take that out.

Enter, vimv.

vimv (which you can get from GitHub) is a really powerful little utility that allows you to mass-rename all the files in a directory as if they were lines of text in a text file. Specifically, it opens the file names as lines of text in a vim instance, and allows you to use all the powerful text-editing tools in vim to quickly edit rename hundreds of files.

A detailed tutorial of vim/vimv is waaaay outside of the scope of this tutorial, but it’s easy enough to find tutorials for if you dig around.

I’m sure there’s lot of other mass-file editing utilities around for different operating systems, but I’ve not used them, so I can’t recommend any specifics.

After a few smart search/replace commands, a bit of block editing, and some tweaking of the filenames with vimv, we end up with:

001 - First Words - דברים ראשנים - Lesson 1.mp4
002 - Plural Nouns & Adjectives - Lesson 2.mp4
003 - Review Game for Lessons 1-2.mp4
004 - Conjunction & Gender - Lesson 3.mp4
005 - First vocab in action - Lesson 3b.mp4
006 - Subject Pronouns - Lesson 4.mp4
007 - Pronoun Practice - Lesson 4b.mp4
008 - Review Game for Lessons 3-4.mp4

Much better!


Sync to Server ♻️, and Build the Torrent 🏗️

K, we’re on the home stretch! Next, we need to move the videos we’ve downloaded to the server that we’re going to host the torrent from.

Why not just download the videos on the server to start with? The first couple times I tried this, I just ran the above YouTube script right on my server. It worked ok. The downside was that YouTube was sometimes more sensitive to hundreds of videos being downloaded from an IP address associated with a VPS/Datacenter, and quickly started rate-limiting my downloads. At the time, I wasn’t using the --sleep-interval 1 --max-sleep-interval 10 parameters, so that might solve the problem. But I just started getting in the habit of downloading the videos from a different IP address as they’d be hosted from. Doing it from my laptop meant I could use the tools I already have setup (yt-dlp, vimv, etc.), and I could change IP addresses with my VPN if I do end up getting rate-limited. The downside is that the downloads/uploads take longer.

Sync the Videos ⏯️

I used the following rsync command to sync the videos to my server:


Simple enough. You can look up an rsync tutorial if you have any issue here.

Set up transmission-cli 🔧

The tool we’ll use for seeding the torrent is called transmission-cli.

This program can be complicated and annoying to work with. It’s not super intuitive.

So, here’s how I made it work for me.

These commands were tested on Debian.

Start by installing the programs needed for us to create a torrent through transmission-cli:

sudo apt install transmission-cli transmission-daemon

I also recommend creating and using a specific directory to be storing all your torrents’ files in. I’ll use /home/user/torrents for examples here.

Before we start, we also need to start transmission-daemon. We can do that by just simply running the command transmission-daemon.

Then, we’re ready to create our torrent!

Build the Torrent File 📁

The command to create a torrent file using transmission-cli is as follows:

transmission-create -o ~/[TORRENT NAME].torrent -c "[TORRENT DESCRIPTION]" \
-t udp:// \
-t udp:// \
-t udp:// \
-t udp:// \

This will make a torrent file of whatever SOURCE_DIRECTORY you specify. I like to simply navigate to whatever directory my torrent files are in (/home/user/torrents/My_New_Torrent/, for example), which allows me to us to . as my SOURCE_DIRECTORY.

When you run this command, it will create a .torrent file with the name you specific in your $USER directory.

Then, we can add it to transmission-daemon and start seeding it!

Add & Start the Torrent 💧

The command to add a torrent to the daemon is:

transmission-remote -n 'transmission:transmission' \

Big thing to note: Make sure that for the TORRENTS_DIR you put the directory of all torrents, and not the directory of a specific torrent. (So, you want /home/user/torrents/, not /home/user/torrents/My_New_Torrent)

When that completes, you should get a response like:

localhost:9091/transmission/rpc/ responded: "success"

This means that the torrent has been successfully added to the daemon.

Now you can run the command below to see the current torrents in the daemon:

transmission-remote -n 'transmission:transmission' -l

It should show something like:

    ID   Done       Have  ETA           Up    Down  Ratio  Status       Name
     1   100%   160.5 MB  Done         0.0     0.0    0.0  Idle         My_Torrent
Sum:            160.5 MB               0.0     0.0

Note the Done percentage. If it says 100%, then your torrent should be good and ready to seed! If not, you might have a problem. (I had an issue when I tested these instructions; just ended up needing to kill the transmission-da daemon, and start it again. Worked instantly thereafter.)

If you want to see more information about your torrent, you can type the command:

transmission-remote -n 'transmission:transmission' -t1 -i

Where the 1 is the torrent ID given in the previous command.

This command will also display the magnet link 🧲 for your torrent, which you can use instead of the .torrent file, if you want.

Download Torrent from Another Device ⬇️

At this point, you have a functioning torrent!

Now, you can try downloading it from a different device!

To do that, you can either export the created .torrent file from your server’s user directory to whatever device you want to download the torrent too (using something like rsync), or you can copy the magnet link 🧲 mentioned above, and use it to add the torrent to whatever device you want to download to.

Two things that are worth knowing here:

  1. Torrents work best when there are many devices that are all seeding (hosting) a given file. Downloading a torrent can be a slower process if there is only a single device that’s seeding that torrent. Sometimes, if a file doesn’t start downloading right away, that slowness can be due to the downloading device searching for where the seeding device is on the internet. That can take time, especially for a new torrent. Let it sit for an hour or two, and if it still doesn’t start downloading after that point, then there’s probably an issue to fix.
  2. One thing that can speed up the “searching” process mentioned above is trackers (the -t udp://... flags in our transmission-create command above). A tracker is a special server that lets people wanting to download a torrent know where seeders of that torrent can be found. It is possible to have a torrent without trackers, but it will just take longer for the device downloading to be able to find where to download the files from. The trackers I included in the command were servers that were working for me when I first set up this command, but you might want to search out, more up-to-date trackers if you’re trying this in the future.

That’s it! 😅

Welp… That was a marathon! But, that’s what you need to know if you want to turn a YouTube playlist/channel into a torrent.

If you want to see the final result, you can download the most recent version of the Aleph with Beth lessons torrent from Andrew and Beth’s site here.