UP | HOME

Provide your own video channel via Freenet / Hyphanet

(dark mode)

Youtube now wants to block users of ad-blockers, so if you value your visitors’ time (who might be financing you via patronage), you need a sovereign platform — one that is immune to enshittification. Here I’ll show how to provide a video channel via Freenet / Hyphanet.


PDF (drucken)

Freenet / Hyphanet is a decentralized network that preserves your and your visitor’s privacy. You can upload websites that stay online without needing your own server, and you can use those to serve videos.

Limitations

  • Linux: This tutorial is written for GNU Linux users. It was tested locally and in a Debian docker image. If you use Windows, you might be able to use it via WSL2.
  • One at a time: Your channel will get created one video at a time, perfect for updating it as you record the videos, but no good match for uploading a full series at once. The maximum number of videos available in the channel is 24. You can change this, but it’s an optimization, so your site could become slower as a result.
  • No archive: Hyphanet provides communication: your channel will stay working as long as people access it. It is not meant for long-term storage.
  • Slower: Hyphanet isn’t fast. Its codecs are old. Your videos won’t be HD. But they will appear and you will have full sovereignty over your channel.
  • Local node: Watching your channel will need either a locally running Hyphanet node or an inproxy like SCGIPublisher. This makes it only viable for dedicated viewers for now, but it is a great fallback if your channel should drop off your current video hosting provider for some reason — or if the enshittification of the hosting provider becomes unbearable for your visitors. To have it as contingency plan later, it is essential to get some people to try it soon (now?), so they know where to find your channel if you need it.

Requirements

You need a running Freenet / Hyphanet node. The easiest way is to use the freenetbrowser.1 To get it on Debian:

sudo apt-get install git python3 python3-pip pipx guile-3.0 mplayer ffmpeg \
  curl wget make autoconf automake grep sed gnupg openjdk-17-jdk firefox-esr
git clone https://github.com/hyphanet/browser
(cd browser && ./bootstrap.sh --prefix=$HOME/.local && make install)

To see whether it worked, watch Sintel on Generate Media Site:

~/.local/bin/freenetbrowser --install \
  USK@rQnuHCVpf7BHcsZHBt911K3-iaELN1u1Vg0fzxDRq7k,I1vFYWONhGfECHr9XD-1lKxxstr64rF4dTykcMq9swY,AQACAAE/gms/28/
# --install: install Hyphanet if needed

You should see something like this:

video-channel-hyphanet-gms-sintel.png

Sintel is Free Culture and licensed under the Creative Commons Attribution 3.0 license.

You need to run freenetbrowser --install at least once to be set up for the next step.

If ~/.local/bin/freenetbrowser does not work, please report the error!

Prepare your channel

First prepare the structure by cloning generate-media-site:

git clone https://github.com/hyphanet/generate-media-site YOUR_CHANNEL_NAME

This gives you the subfolders entries, media, and site:

YOUR_CHANNEL_NAME/
  entries/
  media/
  site/

The site subfolder contains support scripts and templates.

YOUR_CHANNEL_NAME should contain no spaces (it will be part of the link).

To prepare your channel, just put the videos you want to share into the media/ folder. For example:

cd /path/to/YOUR_CHANNEL_NAME/media && \
  wget https://www.draketo.de/kreatives/ciao-chatcontrol-draft1-2023-08-16.mp4 && \
  echo "A song against Chatcontrol from https://www.draketo.de/kreatives/liederbuch" \
    > ciao-chatcontrol-draft1-2023-08-16.mp4.info

Create your streaming site

Assuming that you installed freenetbrowser and ran freenetbrowser --install (as shown above) you can setup your streaming site by installing and using the pyFreenet3 utilities:

pip3 install --user pyFreenet3 || pip install --user pyFreenet3
cd /path/to/YOUR_CHANNEL_NAME/site && ./gms.scm --rebuild-only
# create your site
# use YOUR_CHANNEL_NAME as name
# use the absolute path as path (i.e. /path/to/YOUR_CHANNEL_NAME/site)
# just leave the Site private URI empty
~/.local/bin/freesitemgr add
# get your site public key (the website address to give others)
~/.local/bin/freesitemgr list YOUR_CHANNEL_NAME

Be sure to include /site in the path of the site. That’s where the optimized files are created for every upload.

On Debian testing running in a container, pip may need the flag --break-system-packages to realize that –user is safe.

This will show something like

YOUR_CHANNEL_NAME:
    state: updating
    dir: /path/to/YOUR_CHANNEL_NAME/site
    uri: USK@SOME,KEY,AQACAAE/YOUR_CHANNEL_NAME/0/
    privkey: USK@OTHER,KEY,AQECAAE/YOUR_CHANNEL_NAME/0

uri is what you can give to others so they can test your site. state: updating means that your site is currently being uploaded.

Never share the privkey. It is what is used to update your site.

Aside: This is the perfect time to backup the folder ~/.freesitemgr. It contains these keys and additional metadata. As long as you have it, you can update your site from anywhere.

You can check the upload of your site by opening the uploads list:

~/.local/bin/freenetbrowser freenet.local/uploads

Once the upload is finished, you can see your site via

freenetbrowser USK@SOME,KEY,AQACAAE/YOUR_CHANNEL_NAME/0/

Make it your style

The default style is a simple video channel. To tweak it, just adapt the files template.html, video.html, and style.css.

Most importantly, change <a href="/?newbookmark=USK... to point to the uri of your site (the one you got via ~/.local/bin/freesitemgr list YOUR_CHANNEL_NAME).

To see a rough preview, just open template.html in the browser.

If you want to show a description below a video, just add a file next to your video with the same name but the extension .info.

Example: if you want to share the video welcome-to-my-channel.mp4 with some description text below it, your media/ folder would contain:

welcome-to-my-channel.mp4
welcome-to-my-channel.mp4.info

You can write arbitrary HTML in the .info file.

Prepare and insert a video

After setting everything up as above, with the videos in the folder /path/to/YOUR_CHANNEL_NAME/media, preparing and inserting the first of your videos just takes three shell commands:

cd /path/to/YOUR_CHANNEL_NAME/site && \
./gms.scm --sorted && \
~/.local/bin/freesitemgr update YOUR_CHANNEL_NAME

Again you can check the upload status with

~/.local/bin/freenetbrowser freenet.local/uploads

This can take an hour to spread your site through the Hyphanet. After the upload is finished, you can share your new video channel via the uri:

~/.local/bin/freesitemgr list YOUR_CHANNEL_NAME | grep "uri: "

People can then watch your video via

~/.local/bin/freenetbrowser USK@SOME,KEY,AQACAAE/YOUR_CHANNEL_NAME/0/

(replace USK@SOME,KEY,AQACAAE/YOUR_CHANNEL_NAME/0/ with the uri of your site)

Advanced options

Generate Media Site was originally written to create radio-like channels. To see all options, read the README and/or run

cd /path/to/YOUR_CHANNEL_NAME/site && \
  ./gms.scm --help

To keep your videos accessible when no one is watching them for a few weeks, you may want to look into the keepalive plugin (in Hyphanet → config → plugins) and add there the CHK-links you find in ~/.freesitemgr/YOUR_SITE_NAME.

Summary

If you follow this guide, Hyphanet provides you a completely decentralized, sovereign video channel that stays online as long as people watch your videos, even if your computer goes offline.

This makes it the perfect contingency plan if your current video hosting provider goes down or starts on the path to enshittification.

And while this article seems long, after you followed it once, creating one more channel is simple and quick:

git clone https://github.com/hyphanet/generate-media-site YOUR_CHANNEL_NAME
cd YOUR_CHANNEL_NAME/site && ./gms.scm --rebuild-only
freesitemgr add

Footnotes:

1

freenetbrowser creates and uses a highly secured browser profile for firefox or derived browsers like icecat.

ArneBab 2023-10-28 Sa 00:00 - Impressum - GPLv3 or later (code), cc by-sa (rest)