Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.

CDN Transcode Sample Getting Started Guide

TangZhiZhen edited this page Jun 6, 2019 · 49 revisions

CDN Transcode Sample Getting Started Guide

This document describes how to run the CDN Transcode Sample step by step. Please refer to reference architecture to understand the sample reference architecture design and how the sample works.

The sample provides two kinds of services - live streaming and VOD, and this guide just shows how to use the services in a simplest and typical way which can be scaled out to more complex environment. E.g.: in this guide, the docker images for transcoder server and cdn edge server are hosted on the same physical server. In real case, they can be hosted on different servers located in different places in the CDN network.

Prerequisites

In this document, we'll use the simplest example to show how to build up the pipeline for different user scenarios. To simply the setup, we'll host docker nodes on the same physical server (named as "CDN-Transcode Server" in this document). One Streaming Server will be used as well to RTMP stream the source video content to CDN-Transcode Server, however you can omit Streaming Server if you want to just use local video content on CDN-Transcode Server. A client system is also needed to playback the transcoded video streams.

Below is the basic block diagram for the sample setup:

 +------------------+   +----------------------+   +------------+  
 |                  |   |                      |   |            |  
 | Streaming Server +---+ CDN-Transcode Server +---+   Client   |  
 |                  |   |                      |   |            |  
 +------------------+   +----------------------+   +------------+  
                                                                   

Note: for live streaming and VOD in this document, it refers the interaction between CDN-Transcode Server and Client, not refers interaction between Streaming Server and CDN-Transcode Server.

Setup CDN-Transcode Server

  • Install Ubuntu 18.04/CentOS 7.6 on CDN-Transcode Server, and configure the IP address & proxy properlly.
  • Install the third-party dependency Libraries and tools.
script/install_dependency.sh

Note: This script must be run as root.

  • Setup docker network proxy You may need to setup the docker proxy on CDN-Transcode Server. Below is an example to directly use the host proxy as the docker proxy.
sudo mkdir -p /etc/systemd/system/docker.service.d
printf "[Service]\nEnvironment=\"HTTPS_PROXY=$https_proxy\" \"NO_PROXY=$no_proxy\"\n" | sudo tee /etc/systemd/system/docker.service.d/proxy.conf
sudo systemctl daemon-reload
sudo systemctl restart docker

Setup Streaming Server (Optional)

As mentioned above, Streaing Server is not a must, you can skip this section if you do not want to stream the source via RTMP.

  • Install Ubuntu 18.04 on Streaming Server, and configure the IP address & proxy properlly.
  • Install FFmpeg
sudo apt-get install -y ffmpeg
  • Install Nginx and Nginx Rtmp Module
git clone https://github.com/arut/nginx-rtmp-module.git

wget http://nginx.org/download/nginx-1.14.2.tar.gz
tar -xvzf nginx-1.14.2.tar.gz
cd nginx-1.14.2
./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --add-module=/path/to/nginx-rtmp-module
make && sudo make install

Setup Client

In this document, we can use both VLC and web browser as the playback tool. To use VLC, it's recommended to use Windows VLC client. For web brower, in theory any web browser could be OK, like Chrome, Firefox, Microsoft Edge, IOS Safari, however HEVC playback is not well supported by web browsers, so if you want to playback HEVC stream, use VLC. Also AV1 playback is only supported by Firefox.

Build

On CDN-Transcode Server, run below command to build docker images:

mkdir build
cd build
cmake ..
make

Deploy

The sample supports both auto deployment and manual deployment. The auto deployment will help users to have quick try to use this sample while the manual deployment give more flexibility for customerization.

Auto deployment

The auto deploy supports both docker swarm and kubernetes. The auto deploy will deploy the live streaming and VOD services automatically using a default video stream "big buck bunny" as an example. To simply the setup, the original source video content are local content but not streamed from the RTMP streaming server.

Note: If you want to use other video clips to try the auto deployment, you can simply copy the clips into /volume/video/archive folder, then run below command to generate video clip thumbnails. The transcode service will perform 1:N transcoding for these video clips. It's recommended to use .mp4 video clip files.

ffmpeg -i <CDN-Transcode-Sample>/volume/video/archive/<clip_name> -vf "thumbnail,scale=640:360" -frames:v 1 -y <CDN-Transcode-Sample>/volume/video/archive/<clip_name>.png

Auto deployment using docker swarm

For details, please refer to Deploy on Xeon E5 using docker swarm

Auto deployment using kubernetes

  1. Setup kubernetes environment
    For details, please refer to Setup Kubernetes environment
  2. Auto deployment using kubernetes on E3
    For details, please refer to Deploy on Xeon E3 with Gen GFX server using Kubernetes
  3. Auto deployment using kubernetes on E5
    For details, please refer to Deploy on Xeon E5 server using Kubernetes
  4. Auto deployment using kubernetes on VCA2
    For details, please refer to Deploy on VCA2 using Kubernetes

Manual deployment

The manual deployment give an example to users who want to use this sample as a base to build up more complicated CDN transcode solution. For details, please refer to Manual Deploy

Clone this wiki locally