How you can help distribute my DTube videos

in #dtube6 years ago

As some of you probably know from my previous discussion about the platform, DTube uses IPFS for video storage. IPFS is a file system that essentially works like a torrent: You upload files to it using the command "ipfs add" in a console... whenever another IPFS node then accesses that file, it will also cache and seed it to other nodes for a limited amount of time. The more nodes a file is on, the closer those nodes are to your location geographically, and the faster their internet connection is... the greater your overall download speed will be when you're downloading this file through your local gateway.

Despite its beauty, this format of storage comes with one drawback: For a file to remain available in the network and downloadable at decent speeds, it needs a lot of people accessing it on a daily basis in order to reseed it periodically. When this isn't the case, it requires nodes to explicitly pin those files and seed them permanently like a server. If a file runs out of peers and there's no one left in the world to offer it, that file obviously disappears from the network until someone finds the original on their drive and uses "ipfs add" to bring it back.

I've already gone through the pinning process for my DTube videos to secure them: They are now pinned on my mother's go-ipfs daemon and of course my computer, meaning that when our machines are powered they serve those video files to viewers. Someone else further helped by pinning them on their own IPFS node, whereas DTube supposedly has a contract to pin site content themselves but only for a limited amount of time. For proper long-term distribution, I may have to rely on more nodes offering my creations to the world.

For that reason I decided to share the shell script I use to pin my videos. If anyone else runs a go-ipfs node or is interested in playing with IPFS, and has a few GB of drive space to spare plus a connection that handles roughly 500KB/s of idle transfer rates, you can execute this script to pin all videos and their dependencies to your node. This means that whenever someone watches them on the site, your server will also offer a few bits and pieces of the video.

Other than the fact that this makes my animations more accessible to others thus is of great help, pinning them will later give you an additional advantage: Whenever viewing my videos on the DTube website, they will load instantly for you as you're essentially reading them directly from your hard drive. This will however only work in practice once the player supports local IPFS gateway, which is currently being worked on but the feature is not yet available... right now the data still goes through gateway.ipfs.io as that's the only way people without IPFS installed on their machines can view content in the network.

https://pastebin.com/raw/afm7CnrZ

It's a Linux bash script which does nothing more than run a series of "ipfs pin" commands for each dependency of every video. As I create new animations this script will of course be updated to include their file hashes.

Bonus note: You can type any of the hashes in that script into the IPFS gateway URL to see that file in your browser. You can try messing around with these for fun or to easily access the videos! For instance, clicking the following URL will take you to the sprite image of Blue Vixen's Mall Trip (DTube uses those to show a thumbnail when positioning the mouse cursor over the play bar):