Takeout your media

defsub
6 min readNov 12, 2022

--

Photo by Andrew Teoh on Unsplash

A few years ago I started working on an open source personal media system called Takeout. It has gradually evolved from a server that scanned an S3-capatible bucket and created playlists for VLC, to a system I use daily for music, podcasts, radio and movies. There’s a server written in Go, a Flutter app, Android TV app, and a web UI. I plan to write a series of posts about the design of Takeout and dive into the details of the most interesting parts. To kick things off, I’ll go through some of the background and reasons why this project was started.

Why Another Media System?

There are many excellent media systems. In fact, I’m a lifetime Plex Pass member and have used Plex for many years. Plex is great but at times it doesn’t align with my needs. Prior to Plex, I also used Slim Devices, XBMC/Kodi, and DLNA with WD TV Live devices. When Plex offered the Plex Cloud service back in 2016, I was all in. Plex Cloud could index and serve cloud media from the cloud, and best of all, it was free. Until then I had primarily used Plex at home and had to pre-download media in the app to take it with me on the go. There were a few unfortunate times when I was sitting on a plane and realized a recent app update lost all my downloads. Plex Cloud brought a new dimension to the service. At times it was slow and buggy, likely due to trying to reduce costs, but it was awesome. Unfortunately in 2018 Plex Cloud was discontinued. I was back to streaming from home and pre-downloading.

Why not run Plex in the cloud?

Running Plex in the cloud is definitely an option that people seem to like. You can install Plex on a VPS, mount network drives locally, and run Plex as if you’re running it at home. The downside to this is that it’s likely very expensive. You’ll need to pay for the VPS, cloud storage, and all the media streaming network usage. There are probably some solid options to make this fit a budget but I think storage and network costs would keep me up a night.

Why not stream from home?

You can load up your home PC or NAS with high capacity drives and create your own home cloud. This is probably the best option for a rich media experience at home. The problem I’ve run into is that my uplink is slow, I need to deal with NAT issues, and I need to be an IT person at home to deal with the PC or NAS. The IT person part cannot be understated. There are definitely people where this is the best and only reasonable option. If you’re that person, with a RAID 6 NAS filled with several TBs of the highest quality media and CAT 7 in every room, hats off to you. You are awesome.

The amount of media you have is a huge factor in whatever system you chose. And you also need to decide if you’re comfortable using cloud storage instead of local drives for personal media. Cost is a factor either way, so do the math and see what works for you. My preference is to not have servers at home and use the cloud to keep things simple. Takeout is designed to minimize costs when running in the cloud, it also supports being entirely hosted at home, or a combination of the two. It’s entirely up to you.

Limitations

When comparing systems like Plex to Takeout, it’s good to explain the differences and limitations of the Takeout design. Media servers that have access to local media files can efficiently scan files for embedded metadata tags, bitrates, inspect containers, track details, etc. There is a huge amount of data that can be gathered and presented. It’s all interesting stuff and it’s really fast to seek throughout local files to find information.

Metadata scanning is limited with media files stored in the cloud. It takes a lot more time to access and scan remote media using network APIs. There may even be additional cost to do this which is far from ideal. Limited access directly reduces the metadata that can be obtained. Instead, Takeout relies on media organization and naming conventions to understand and index all media files. With reasonable filenames, lots of regexps, logic and powerful services such as MusicBrainz and TMDB, the resulting metadata can still be quite extensive and enjoyable. If you’re looking for bitrates, audio tracks/channels, and other details, that information is only available during playback, if at all.

Takeout also doesn’t do any transcoding of media at the server to adapt to the consuming device capabilities. In fact, I’ve never been a fan of transcoding since it requires significant compute power that I never seem to have enough of for real-time processing. In Plex, transcoding is a feature I turn off. A good alternative is to ensure all media is playable as-is, using containers and formats that are supported across all players and platforms you plan to use. It’s not always that easy, that’s why transcoding exists, but there are some good options available that work on many devices.

Similar to transcoding, Takeout apps delegate all media processing to the underlying platform. There is no additional hardware acceleration or enhancement to transform the media in any way. The media stream is a pass-through to the platform and any external audio system. Nowadays there are a wide variety of media containers and formats supported by most platforms. A good example would be the extensive media supported on Android with ExoPlayer. Taking the time to encode media such that it is supported by your device platforms definitely makes media more accessible and readily available for systems like Takeout. Choosing open source containers and formats really helps as well since they are generally well supported and widely used.

The Takeout design philosophy is based on keeping things simple, having minimal settings and customization, and taking the media you have anywhere, with the stated limitations and compromises. There are no add-ons, plugins, or tuning knobs. For those people that want to spend more time enjoying their media and less time fiddling around with stuff, Takeout may be an excellent choice for you.

The Takeout Project

Takeout is a media system that will scan S3-compatible buckets containing organized media files, obtain extensive media metadata using third-party services, and provide media browsing, search, and streaming services via S3-capatible APIs. There’s also support for podcasts and Internet radio to ideally meet all your media needs. Takeout is designed to minimize costs when run in the cloud and provide you with your own personal media cloud to take with you wherever you go. It’s all free and open source with an AGPLv3 license. You can learn more about Takeout here:

https://takeoutfm.com/

And the server GitHub repository is here:

https://github.com/takeoutfm/

Next I plan to write a series of posts highlighting many excellent open source projects and how they are used in Takeout, third-party service integration (with S3, MusicBrainz, Cover Art Archive, TMDB, Fanart.tv, Last.fm, RSS) and other system design topics including caching, security, and deployment. I hope you find this interesting and also consider using Takeout.

--

--