The Developer's Guide to Getting Started with Livepeer

The Developer's Guide to Getting Started with Livepeer

Web3 infrastructure and what it means for video creators.

Getting Started with Livepeer

TL;DR: Livepeer is a decentralized video processing network and developer platform which you can use to build video applications at a rate of up to 10x cheaper than web2 service providers. The network of distributed Orchestrators provides transcoding, the process of formatting your video to be optimal for all devices and network speeds, and enabling applications like Glass.xyz, a creator-owned video platform.

Livepeer has a Livestreaming API where a broadcaster can start a stream with a simple POST request, and has a hosted service where you can mint video NFTs.

Developer Resources For Building with Livepeer:

A step-by-step walk-through guide on getting started with the Livestream API can be found here.

A step-by-step workshop on minting a video NFT and creating your own smart contract can be found here.

Livepeer’s open source media server- a powerful video software that allows anyone to build scaled video infrastructure that can be found here.

Web3 is For Creators

Web3 is all about empowering creators. In a world where we all are owners of our data and content, creators need the tools that make this possible. Web3 is all about trustless, permissionless systems that create a world where creators don't have to trust platforms to protect our personal data, uphold their terms of use, etc.

As more and more builders are stepping into the decentralized world of web3, it's important to understand what the qualifications are for something to be "web3." One of the best and most straight-forward explanations is this tweet by Nader:

Another thing I would add to this: Any process which goes through an entity that could, at any time, "turn it off," or take it down, then it's not web3.

As a TikTok creator, I've seen a lot of videos complaining about TikTok's practice of shadowbanning creators, suppressing their views, and taking down videos.

IMG_B6B4BF04F0BB-1.jpeg

I don't own my content, TikTok can (and has) taken down videos of mine for no reason, it's impossible to download or export my TikTok videos once they have been posted without the TikTok watermark. If TikTok gets bought out or shut down, I would lose all of my content and community on the platform- you see what I'm getting at here. Although TikTok does have a creator program, they are notorious for suppressing your views once inside the program to avoid having to pay you.

I've been playing around with Livepeer for the last few weeks and learned about their goal to enable creators to make uncensorable, permissionless video infrastructure to enable creator-first video content platforms like Glass.

Screen Shot 2022-03-28 at 12.09.25 PM.png

I've been hacking around with Livepeer for the last few weeks and in this post, I'm hoping to answer the following questions:

  1. What is Livepeer?
  2. What does Livepeer mean for a video creator?
  3. How can I use Livepeer to build a decentralized streaming app?

Why Web3 Matters for Video Creators

I was at ETH Rio a couple of weeks ago and saw a slide by Shannon that explained the why of web3 really simply:

Agency: Own your identity, data, and reputation

Interoperability: Seamlessly switch between applications

Permissionless: Anyone can participate without approval from a centralized entity (infinite scale)

Reliability: Guaranteed to run forever on reliable public infrastructure

Incentives: Built in money and financial contracts

Security: Safe, secure, and private

Governance: participants are owners and decision-makers in the networks

Screen Shot 2022-03-27 at 8.16.23 PM.png

Up until recently, video creators were largely at the mercy of the giants like YouTube, TikTok, and Twitch and had virtually no other platform to create content on. These giants sell ad space, push products onto viewers, and take 45% of the revenue generated from the ad. YouTube made $15.15B in ad revenue in 2019 alone.

What is Livepeer?

Livepeer is a transcoding protocol and is the video layer of web3. Livepeer provides a decentralized network of transcoding providers around the globe, incentivized by their native token, $LPT. Livepeer provides the infrastructure needed to incorporate live streams and videos into your dapp in a decentralized way. Livepeer is chain-agnostic and lets developers handle live streams with just a few API calls. Livepeer started off on Ethereum but has recently migrated to a Layer 2, resulting in extremely low gas costs.

Video transcoding is a process that ensures that viewers with varying levels of internet speeds and devices can stream content at the highest possible quality. Proper transcoding ensures that your video is viewable by anyone in the world regardless of location, viewing device, and circumstances.

Running an app like Twitch with 1000 concurrent streams for one month would cost ~$300K on a web2 stack, compared to ~$45k using Livepeer (Source: Livepeer). Companies in this space face high costs related to these services and end up turning to selling user data to help pay for the costs associated with the infrastructure required to have multiple streams. These high infrastructure costs are a barrier for builders in the live video space and make it impossible to compete with giants like YouTube and Twitch. The industry needed a cost-effective solution without compromising on scalability or quality.

Screen Shot 2022-03-27 at 7.57.49 PM.png(Source: Livepeer).

What Livepeer is NOT

Livepeer is not a content distribution network. Livepeer doesn't actually broadcast videos and livestreams to viewers...yet. A P2P CDN has been proposed and is in the roadmap for Livepeer. Livepeer's transcoding infrastructure is compatible with any CDN, and it's video streaming API contains a default CDN integration to make development easy.

Livepeer is not the "Twitch of Web3." Livepeer provides the infrastructure and developer tooling to build the YouTube of Web3. Glass.xyz is a product built with Livepeer that is a decentralized video content platform similar to YouTube.

How Does Livepeer Work?

Decentralized transcoding is achieved through Orchestraotrs who run software that allows them to contribute their computing power and resources for broadcasters using the service. These orchestrators are incentivized with crypto and earn money for their roles. Delegators are $LPT holders who participate and earn rewards by staking their tokens to Orchestrators.

Screen Shot 2022-03-27 at 7.57.54 PM.png(Source: Livepeer).

A broadcaster will send a request to the Livepeer API to start a stream, you must pay a set amount of Ether to one of the Orchestrators in the network who will pick up the job of transcoding your video.

The Problem with Existing Video Streaming Infrastructure

In addition to the lack of low-cost transcoding providers, the same problems of centralization exist- your stream can be taken down if it breaks the provider's terms of service, your stream can become unavailable if your provider's servers go down, and more. Because Livepeer provides a decentralized and distributed network of transcoders, there is no governing entity that can dictate whether or not your stream is "allowed."

Another problem with the existing infrastructure is the delay between a user clicking the "live stream" button and the stream actually starting, known as "boot up" time. Other transcoding providers that use Google Cloud, AWS, or any other centralized service to run the encoding process start only when an API request comes in. This boot-up time can last anywhere from a couple of seconds up to forty seconds.

Livepeer takes advantage of existing cryptocurrency mining equipment infrastructure to be "always-on" with no boot-up time. These mining farms have a video encoder card that isn't typically used. Livepeer incentivizes the operators of these farms to join the network and lend their processing power to accept requests to transcode live video.

Developer Tools

Livepeer currently offers two products: Video on Demand and Stream API.

Screen Shot 2022-03-09 at 5.56.07 PM.png

The Stream API allows developers to configure details for a live broadcast, generate a playback URL where viewers can access your stream, get data about the stream session, configure multiple targets for your stream, and more. You should understand how HTTP requests work before moving on. For a crash course on HTTP requests and client-server architecture, check out this post I wrote for Free Code Camp.

Using the API is as simple as creating a POST request. In a Next.js app, you create an API route to handle requests and define how to grab the values needed to start a stream when a POST request comes in:

export default async (req, res) => {
  if (req.method === "POST") {
    const authorizationHeader = req.headers && req.headers["authorization"];
    const streamName = req.body && req.body.name;
    const streamProfiles = req.body && req.body.profiles;

Then you make a request to the Livepeer Livestreaming API and pass in the parameters like stream name, profiles, and the API key which you can gather from your user in the front-end:

try {
      const createStreamResponse = await axios.post(
        "https://livepeer.com/api/stream",
        {
          name: streamName,
          profiles: streamProfiles,
        },
        {
          headers: {
            "content-type": "application/json",
            authorization: authorizationHeader, // API Key needs to be passed as a header
          },
        }
      );

For a guide on how to get started with Livepeer's Demo App, check out this workshop.

The Video on Demand API allows creators to upload prerecorded videos and store their metadata on IPFS, enabling creators with the tools to easily mint video NFTs.

mint video.png

For a step-by-step guide on how to mint a video NFT and create your own smart contract, check out this workshop.

Projects Built with Livepeer

Imbue is a decentralized streaming platform that is owned and operated by the community.

Glitch is a decentralized video streaming platform with built-in token-gated functionalities and offers a live and on-demand video option.

NFT Arcade is an NFT marketplace where creators of all kind can upload short videos and turn them into NFTs.

Web3 Infrastructure FTW

I'm particularly interested in infrastructure protocols that stay true to the values of decentralization to enable a truly permissionless, trustless world where the power is concentrated in the hands of the creators, and not the institutions.

To learn about other Web3 infrastructure protocols, check out The Web3 Index, an index that ranks protocols by usage rather than total value locked.

Screen Shot 2022-03-27 at 9.05.04 PM.png

I recently published "The Developer's Guide to Getting Started with The Graph", walking developers through building with the API layer of web3 which you can read here.

You can find me on TikTok and Twitter @camiinthisthang