/SCION-TV

This project is about streaming a TV broadcast over the SCION-Network in a web browser

Primary LanguageShell

SCION-TV

This project enables video streaming inside a browser for a TV broadcast over the SCION-Network.
You can find the report of my project here.


Project-Overview:

Folders:
---------
evaluation -> contains the scripts that are used for evaluation and the data that was collected
mov           -> contains sample movie files and a ffmpeg script to create corresponding HLS files
hls_mov     -> contains playlist file and HLS video segments corresponding to a static movie file in mov
hls             -> contains playlist file and HLS video segments corresponding to the main ffmpeg script
html          -> contains website and its resources

Helper Scripts:
----------------
remove_old_segments.py -> time based maintainace script to remove segment files that will not be used anymore
webpage_generator.py     -> build script to modify the website file according to network setup
remove_old_segments.py & perf.sh -> are also used for collecting evaluation data

Website:
----------
index.html -> website uses Video JS as a Javascript based Videoplayer to enable the consumption of HLS content

Main Script:
-------------
ffmpeg_ultrafast_avc.sh -> mainly used script in the project that converts the video data stream into a true HLS.
ffmpeg_scripts -> this folder contains different scripts that can convert the video data stream into a true HLS.
                     -> the folder is split into subfolders that hold scripts for the respective encoding formats
                     -> each subfolder holds 3 scripts

The idea behind this setup is to provide 3 basic levels of encoding performance through these scripts. You can choose the base script depending on your machines performance and then tweak it to fit even better to your machine's transcoding power. The naming hints on the needed system performance => ultrafast & realtime scripts are the least demanding, veryslow & best are the most demanding. There are scripts ready for encoding with the following standards: avc, hevc, vp9 and av1.

Server Setup:
---------------
server.go contains the entire server setup and is implemented in Go

The setup includes the following components:
file server   -> file-server with content-header to access HTTP-Livestream files
                -> runs with default setup on port 8899
web server  -> server which serves website and its resources
                -> runs with default setup on port 8080
proxy          -> this server is part of the required SCION environment install
                -> runs with recommended setup on port 8890

There exists a peer in the SCION-network which is broadcasting video content. In this specific case the video content is a TV-Signal. The video stream can be received through the SCION network. In order to watch the stream you need to be connected to the stream with the SCION proxy. The proxy will make the SCION-network content accessible to your own network or machine. This project uses ffmpeg to convert the data stream into a modern and easily accessible video streaming format and than re-distributes the content via the web and file servers in the LAN or on your own machine.

Recommended Script Setup:

startServerSetup.sh

[PATH_to -> GO] run [PATH_to -> server.go]

This script will execute the server.go program with default values for all its parameters.
Feel free to run that script shortly after the start-up by crontab or a similar sheduling tool.
Just make sure that the Servers are started before the ffmpeg script, because of the dependency.
You can run the server.go program with your own values for all its parameters.
This is how the command would look like with all optional paramters:

[PATH_to -> GO] run [PATH_to -> server.go] --webServPort="[PORT of Webpage]" --webDir="[Directory of HTML-File]" \
                                           --fileServPort="[PORT of File Server]" --fileDir="[Directory of HLS content]" \
                                           --remote="[SCION-IP of Broadcast]" --local="[0.0.0.0:8890 or Device_LAN-IP:8890]"

Besides the server.go program you should simultaneously run the remove_old_segments.py and a ffmpeg script that transcodes the MuMuDVB-Stream to a HTTP-Livestream.

Project-Requirements:

You will need a machine that runs Linux, is connected to the Internet and was configured to be a SCION-AS. Here you can learn more about SCION, the team behind it and how to become part of the network.
Your machine's setup also has to include the required GO version installation and SCION apps installation. Please refer to the installation guide of the SCION apps repository.
You also need to install ffmpeg from the package manager.
If you want to follow my exact setup you will need to install VirtualBox, Vagrant and get the Vagrantfile from your SCION-AS configuartion. You definitely have to add some lines to your Vagrantfile regarding port forwarding. If you choose to use the default configuration you need to add these lines in the Vagrantfile:

config.vm.network "forwarded_port", guest: 8080, host: 80, protocol: "tcp"
config.vm.network "forwarded_port", guest: 8890, host: 8890, protocol: "tcp"
config.vm.network "forwarded_port", guest: 8899, host: 8899, protocol: "tcp"

In my setup I used a Ubuntu Bionic(18.04) 64-bit VM with ffmpeg version 3.4.8-0ubuntu0.2 and the following SCION apps installation:

sudo apt-get install apt-transport-https
echo "deb [trusted=yes] https://packages.netsec.inf.ethz.ch/debian all main" | sudo tee /etc/apt/sources.list.d/scionlab.list
sudo apt-get update
sudo apt install scion-apps-*

and the following Go(version 1.16) installation:

sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt install golang-1.16

If you mirrored my setup you will find your go application under /usr/lib/go-1.16/bin

Used Hardware

The evaluation data, that is referenced in the report can be found in the data_collection folder. This data was collected in latest test runs, where I used my Ultrabook from Razer as a client machine.
My machine has the following technical specifications:
-> CPU: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
-> GPU: Intel(R) Iris(R) Xe Graphics (integrated)
-> RAM: 16,0 GB 4267MHz
-> SSD: SSSTC CA5 M.2 2280 256GB
The VM was configured to use all 4 CPU cores and 4 GB of RAM while reserving about 40 GB of the SSD's capacity.

Used Rescources:

The Website uses a picture created by adapting these two pictures: Picture 1, Picture 2
The Website was created using this guide from Video JS as a baseline.
At the moment Video JS sadly only properly supports one of our encoding formats, which is advanced video coding(avc) or better known as H.264. An overview of supported encoding and stream formats can be found here.

Future Upgrade:

Use Google's Shakaplayer insetead of Video JS. The player from Google should support more encoding formats and should be more efficent since it is a local setup. However, this player requires an extensive setup of an additional server infrastructure.