Skip to content

videoDAC/streaming-back-end

Repository files navigation

Welcome to Streaming Back-End

This document provides a recipe for creating your own Streaming Back-End.

Shortcut: instructions for most basic setup.

Shortcut: skip to instructions for building from source

Or, to learn a little more first, read on :)

Introduction

A Streaming Back-End is all you need to stream Audio / Video (A/V) content.

It is optimised for streaming live content (e.g. from camera / microphone), and can also handle streaming pre-produced A/V content from disk.

Disclaimer: by design, the Streaming Back-End will not record content being streamed. If you are streaming live content, you must record at source in order to guarantee it will be recorded.

If you are a seasoned devOps professional, you may wish to use these instructions to build a Streaming Back-End. Also, you can used these systemd setup instructions, and these Streaming Back-End upgrade instructions.

What is a Streaming Back-End?

Streaming Back-End is an open-source, free-to-use, server-based digital Audio / Video (A/V) content streaming platform.

Anyone on the internet can:

  • publish A/V content to the Streaming Back-End
    • via RTMP
  • consume A/V content from the Streaming Back-End
    • via HLS over HTTP.

Accessibility

A Streaming Back-End will maximise the accessibility of streaming content. It does this by "shrinking" (= transcoding) A/V content into "lighter" formats. These "lighter" formats have the following advantages for consumers of A/V content:

  • Faster load time - the stream starts straight away, because less data is required (up to 900x less)
  • Works on slower internet connections - due to less data required to be received (e.g. can work on 2G, 3G, 3.5G)
  • Works on older devices - as it requires less power to play back content (e.g. on old smartphones)

Installation and Testing

What you will need

To operate a Streaming Back-End, you will need:

  • A Linux* server

    • 1 CPU and 2GB RAM is enough to start with. Can be on localhost or VPS.
    • Ports 22, 1935 and 8935 accepting inbound TCP connections from the internet
    • Install FFmpeg, screen and curl with sudo apt install ffmpeg screen curl
  • Some basic command line skills

    • SSH, screen, other general commands

If you don't have a Linux server, here is some advice about getting a server.

*can also work on a Mac, but these instructions are focussed towards Linux

Build the platform

This sections helps you to build the platform.

image

Build instructions

  • SSH to your server

  • Download and unzip Livepeer:

wget https://github.com/livepeer/go-livepeer/releases/download/v0.5.6/livepeer-linux-amd64.tar.gz
tar -xzf livepeer-linux-amd64.tar.gz

Note, if you are trying this on MacOS, use livepeer-darwin-amd64.tar.gz.

  • Run the following command to attach a new screen:
screen -DR O

(O is for "Orchestrator")

  • Run the following command in the O screen:
./livepeer-linux-amd64/livepeer \
     -orchestrator \
     -serviceAddr 127.0.0.1:8936 \
     -cliAddr 127.0.0.1:7936 \
     -httpAddr 127.0.0.1:8936 \
     -orchSecret secret \
     -v 99
  • Ctrl-A-D on your keyboard to exit the O screen

    • Hold down Ctrl then hold down A then hold down D, then release.
  • Run the following command to attach a new screen

screen -DR T

(T is for "Transcoder")

  • Run the following command in the T screen:
./livepeer-linux-amd64/livepeer \
     -transcoder \
     -orchAddr 127.0.0.1:8936 \
     -orchSecret secret -v 99 \
     -cliAddr 127.0.0.1:7937 \
     -httpAddr 127.0.0.1:8937 \
  • Hold ctrl-A-D to exit the T screen

  • Run the following command to attach a new screen

screen -DR B

(B is for "Broadcaster")

  • Run the following command in the B screen:
./livepeer-linux-amd64/livepeer \
     -broadcaster \
     -currentManifest \
     -rtmpAddr 0.0.0.0:1935 \
     -httpAddr 0.0.0.0:8935 \
     -orchAddr 127.0.0.1:8936 \
     -transcodingOptions P144p30fps16x9 \
     -cliAddr 127.0.0.1:7935 \
     -v 99

Note: you can remove access for publishing remotely by instead running the above command with -rtmpAddr 127.0.0.1:1935 instead of -rtmpAddr 0.0.0.0:1935.

  • ctrl-A-D to exit the B screen

  • Run the following command to attach a new screen

screen -DR P

(P is for "Publisher")

  • Run the following command in the P screen:
ffmpeg \
     -re \
     -f lavfi \
     -i testsrc=size=640x480:rate=30,format=yuv420p \
     -f lavfi \
     -i sine \
     -threads 1 \
     -c:v libx264 \
     -b:v 10000k \
     -preset ultrafast \
     -x264-params keyint=30 \
     -strict \
     -2 \
     -c:a aac \
     -f flv rtmp://127.0.0.1:1935/hello_world

Note: if the process in the B screen is stopped, this process will also stop and will need to be restarted. Note: you can change hello_world to your own choice of stream ID. Note: you can re-enter any screen by running e.g. screen -DR O to re-enter the Orchestrator screen.

Test suite

The test suite for this platform is to run the following command on the server.

curl http://127.0.0.1:8935/stream/hello_world/P144p30fps16x9.m3u8 Note: If you are using your own choice of stream ID, you must replace hello_world with your stream ID.

Test pass: if you see something like this, it will mean that your Streaming Back-End is running:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:119802
#EXT-X-TARGETDURATION:2
#EXTINF:1.980,
/stream/hello_world/P144p30fps16x9/119805.ts
#EXTINF:1.980,
/stream/hello_world/P144p30fps16x9/119806.ts
#EXTINF:1.980,
/stream/hello_world/P144p30fps16x9/119807.ts

Test fail: if you do not see something like that...

Further reading

You can now learn how to upgrade your Streaming Back-End to the latest version of Livepeer.

You can also learn how to set your Streaming Back-End to run on server startup

You can learn more about the architecture of a Streaming Back-End.

You can learn how to publish more interesting content onto a Streaming Back-End.

You can contribute to the current roadmap for evolving Streaming Back-End.

videoDAC Test Signal

Important Note

If you open this URL in a Desktop browser, it may prompt you to download a .m3u8 file if your browser does not support native .hls streams.

In this case, use a different option to play the test signal, from the options below.

Test Signal

There is a test signal maintained by the videoDAC community on Telegram at the following URL:

http://52.29.226.43:8935/stream/hello_world.m3u8

http://52.29.226.43:8935/stream/hello_world.m3u8

This URL is a stream of hls video segments (.hs files), packaged in a .m3u8 wrapper served over http over IPv4.

This video stream can be viewed at http://criticaltv.videodac.eth.link, which contains a hls.js javascript player, served as html from IPFS, using ENS namespace.

The URL can also be played back on any device with network access, using ffplay http://52.29.226.43:8935/stream/hello_world.m3u8, in VLC Player on Mobile and Desktop, or in Chromium-based and Firefox-based browsers on Mobile (alas not on Desktop, at least, not yet).

About Streaming Back-End

A Streaming Back-End is the backbone of Your Own Streaming Platform:

Screenshot from 2020-03-15 17-33-55

Streaming Back-End is a Video DAC project, part of Livepeer project on Ethereum.

You can donate to Streaming Back-End at 0xdac817294c0c87ca4fa1895ef4b972eade99f2fd.

About

A repository for storing information about building a Streaming Back-End

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages