# Setting up a media server Setting up a media server sounded easy: You have a server, it has movies, it sends your device a movie. Little did I know, I was about to descend into my own personal hell. I'm writing this to encourage you not to follow in my footsteps and to just buy movies on Apple TV when you want to watch them. I started by renting a server through [Hetzner's server auction](https://www.hetzner.com/sb/), which was fairly easy. Then, I installed Jellyfin, which was also straightforward. That is actually sufficient to say you've set up a 'media server', as you can connect to Jellyfin from any device, and it'll stream whatever movies you download onto the server. But that isn't such a great user experience, right? You don't want to have to go hunting for torrents every time you want to watch a movie. And how do you get them on the server anyway? So the next move is to set up 'Radarr' (for movies) and 'Sonarr' (for shows). These programs read torrent indexes, so you can ask for a movie, and they'll sift through a bunch of torrents to find one that looks right and download it. They're especially useful because you can add unreleased movies or ongoing shows, and these tools will automatically download them when they become available. This is when you start to realize how modular the media server community is. Because I lied in the previous paragraph: Radarr and Sonarr don't actually download anything themselves; they just instruct your torrent client to download them, and you can choose any torrent client you like. I was a bit hesitant to just install qBittorrent on my server and start obviously pirating movies, so I instead made an account with a service called 'Premiumize', which downloads torrents for you and then sends you the file once it's downloaded. What's nice about Premiumize is that they cache all the torrents they download, so if you request a popular torrent, they can send it to you ridiculously quickly, and your IP is never exposed publicly to the rest of the swarm. However, Premiumize has just an API where you send them a torrent file, and they send you a download link, while Radarr and Sonarr expect you to have an actual torrent client on your server, like qBittorrent. Luckily, someone on Github has created a tool called '[real-debrid torrent client](https://github.com/rogerfar/rdt-client)' that mimics the qBittorrent API on your machine but actually downloads the torrents through Premiumize. You can then set up Radarr and Sonarr to use this as if it were your torrent client. Zooming out for a moment, let's look at where we are so far: 1. Jellyfin serves your movies and shows. 2. Radarr instructs your torrent client to download movies. 3. Sonarr instructs your torrent client to download shows. 4. Premiumize provides a similar service to a VPN for hiding your torrent activity. 5. The Real-debrid torrent client allows you to hook up Radarr and Sonarr to Premiumize. But we've only just begun. Radarr and Sonarr need to search through torrents to find your movies and shows. They do this by searching through community-maintained torrent indexes but don't come with any out of the box. What most people do (and what I did) is install another tool called Prowlarr, which you can connect to Radarr and Sonarr and have it automatically manage your torrent indexes for you. Now, I guess you want your friends to be able to use your server too. Do you really want to have to explain to them how to use Radarr and Sonarr? No, probably not, because they have pretty intimidating user interfaces. Not to mention that if you let them have access to Radarr and Sonarr, they would be able to download whatever they wanted and consume all your storage space. So there's another tool called 'Jellyseer', which provides a clean UX that allows non-admins to request any movie or show, and then admins can approve the requests. Once the request is approved, it's sent to Radarr or Sonarr (depending on whether the request is for a movie or a show) to be found and downloaded. Obviously, at this point, you want to make your server easily accessible as well, so I bought a domain name and pointed it at my server, then used nginx to map all these different services to different subdomains. And like a good coder, I set up SSL certificates from Let's Encrypt so that all the outgoing traffic would be nice and encrypted. But we've only just begun. It's pretty common for Radarr and Sonarr to download massive files - 10GB movies that look and feel like they were ripped straight from Blu-ray. I'd love to leave them as is, but I don't have the storage space for that. This left me with only one option: transcode the movies into H.265 at a lower bitrate. There are a few tools out there for doing this, but they all seemed incredibly complicated, and I couldn't get any of them to work. Eventually, I gave up and just wrote a [simple Rust program](https://gist.github.com/anchpop/3501702c8e26c01c3683e1ea481be7d3) that calls FFmpeg on every file in /media/shows and /media/movies. I also chose a fairly aggressive CRF of 32, which still looks fine to me but leads to immense space savings. For example, it compressed "Ferrari" from 14GB to 1.5GB, and "Across the Spider-Verse" from 15GB to 4.3GB. Of course, now you actually want to watch the movies and shows on your phone. For this, on iOS, I can recommend the "Swiftfin" app, which is designed to be used with Jellyfin and gives you basically a Netflix-like experience. But, do you really want to have to manually request every movie? Wouldn't it be better to be able to just have it automatically download movies you're likely to want to watch? Of course, there is a way. You can simply make an account on mdblist.com, set up a list of movies based on some criteria (e.g., over a certain Letterboxd score with over a certain number of reviews). This creates a list of movies that can then be pushed to a service for making movie lists called Trakt. Then point Radarr at the list. mdblist will update the Trakt list every 24 hours, so whenever a movie meets your criteria, it'll be added to the Trakt list, which is being periodically checked by Radarr for new movies to download. Zooming out again, here's the new list of tools: 1. Jellyfin serves your movies and shows. 2. Radarr instructs your torrent client to download movies. 3. Sonarr instructs your torrent client to download shows. 4. Premiumize provides a similar service to a VPN for hiding your torrent activity. 5. The Real-debrid torrent client allows you to hook up Radarr and Sonarr to Premiumize. 6. Prowlarr manages torrent indexes. 7. Jellyseer allows non-techies to easily request movies. 8. Nginx and Let's Encrypt allow you to set up memorable URLs to access your server. 9. My Rust program transcodes all your movies and shows to save space. 10. Swiftfin to watch the movies on your phone. 11. mdblist.com for creating a Trakt list of recent big movies. 12. Trakt for creating a list of movies that can be automatically downloaded with Radarr. And I'm getting off easy because I have a server with a static URL. If I had the server in my apartment with its constantly changing URL, I'd need to set up some dynamic proxy situation, and I have no idea where to begin with that. I guess I'm writing this to explain why this is such a nightmare. I think it's cool how modular everything is, but seriously, just buy movies from Apple TV when you want to watch them and save yourself the trouble. Bonus: I also want to set up ErsatzTV. Supposedly you can find "bumps" from youtube and retrojunk.com by "$channel bump". dizqueTv apparently exists too. > Personally, I think Adult Swim had the best bumps, usually just some nice house music with a nice animation and some funny quotes.