PeerTube extended

This article describes the Extending PeerTube project which was executed by the Netherlands Institute for Sound and Vision in the context of the PublicSpaces initiative. This project was funded through the NGI Zero Discovery Fund, a fund established by NLnet with financial support from the European Commission’s Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 82532.2

What is the project about?

Extending Peertube aims to extend PeerTube to support the availability, accessibility, and discoverability of large-scale public media collections on the next generation internet.

As a national audiovisual heritage institute, we share thousands of collection items as open video content, which is free and open for everyone to reuse. In the past we’ve developed a custom solution to distribute this content, according to these open principles:

Since, our custom solution has aged, while we see that sister organisations and partners in our international network have similar requirements to what we seek: open source technology, state-of-the-art video distribution and play-out and the ability to self host.

In this project we extend the open source video platform PeerTube to fit our use case, while sharing our code and insight upstream, for other users with a similar use case to also benefit from our efforts. All this to contribute to a vibrant open video sharing ecosystem.

All this fits with our long term vision to federate multiple large scale open video collections to build an international community to share and reuse our audiovisual heritage on the next generation internet.

What problem does your project solve?

Although PeerTube is technically capable of supporting the distribution of large public media collections, the platform currently lacks practical examples and extensive documentation to achieve this in a timely and cost-efficient way. This project will function as a proof-of-concept that will showcase several compelling improvements to the PeerTube software by:

  • developing and demonstrating the means needed for this end by migrating a large corpus of open video content
  • implementing trustworthy open licensing metadata standards for video publication through PeerTube
  • emphasizing the importance of accompanying subtitle files by recommending ways to generate them


Since the original aim of PeerTube was to provide an alternative solution to YouTube as the dominant video sharing platform, it is optimized for the single user who wants to periodically upload their user generated content and share this as a single video within their own channel. Since our use case involves migrating multiple thousands of videos to a PeerTube instance, we worked on a toolkit and instructions to programmatically import large numbers of videos from a legacy video platform to PeerTube:

This also included instructions on implementing URL redirection in PeerTube, after migrating from a large video streaming platform:

Creative Commons

In the cultural heritage domain, the standard for free and open sharing of resources on the web has been Creative Commons licenses for over a decade now. Although PeerTube already implemented an option for their users to attribute a ‘license’ to their contributions to a PeerTube instance, this solution wasn’t (fully) compliant with Creative Commons.

As Sound and Vision values transparent and legally sound communication about the extent to which the collection items it shares on the web can be shared and reused by the public, it took upon itself the task of developing a Creative Commons compliant licensing plugin for PeerTube.

This plugin extends PeerTube with the needed user interface elements to select and display the licenses, but also inserts the correct micro formats into the video item page, making the license also machine readable:


The final strand of work in the project looked at improving the accessibility and discoverability of videos within large collections hosted on a PeerTube instance. It provided a guide on using the PeerTube API to - at scale - add subtitles to an instance, and also suggested ways for existing video content to be enriched with subtitles, using open source Automatic Speech Recognition software:

For more information

We documented our progress here on this website and published our tools at:

Sound and Vision runs a self-hosted PeerTube instance at:

The Creative Commons plugin for PeerTube is maintained in a separate repository at:

and published on NPM:

URL redirection in PeerTube

With a setup for redirecting a lot of URLs in Nginx by creating several configuration files, in this article we will recommend how to integrate these files in an existing Nginx HTTP server and specifically in PeerTube, which only supports Nginx as a reverse proxy for performance and security.

The reverse proxy will receive client HTTP requests, and:

  • Proxy them to the API server
  • Serve requested static files (Video files, stylesheets, javascript, fonts…)

So we extend this with another functionality:

  • redirect old URls from a video website to the PeerTube URLs
More …

URL mapping with Nginx

Nginx’s map module lets you create variables in Nginx’s configuration file whose values are conditional — that is, they depend on other variables’ values. In this guide, we will look at how to use Nginx’s map module to implement redirects from old website URLs to new ones.

More …

URL redirection on the server

URL redirection, also called URL forwarding, is a World Wide Web technique for making a web page available under more than one URL address. When a web browser attempts to open a URL that has been redirected, a page with a different URL is opened.

URL redirection is done for various reasons:

  • for URL shortening;
  • to prevent broken links when web pages are moved;
  • to allow multiple domain names belonging to the same owner to refer to a single web site;
  • to guide navigation into and out of a website;
  • for privacy protection; and
  • for hostile purposes such as phishing attacks or malware distribution.

from Wikipedia: URL redirection

In our case we focus on the second reason: to prevent broken links after migrating a video streaming website to PeerTube.

More …

Adding subtitles with the API

Adding subtitles or captions to a video in PeerTube is done after uploading/importing a video. As the subtitles of the video need to be in a text-based file (either a .srt or .vtt file) it will be uploaded separately and transformed in a WebVTT (.vtt) format so it can be used in the video player. In this article we will show how to bulk upload existing subtitle files with the PeerTube API.

More …