Install Nginx Vod Module on Ubuntu 20.04

Install Nginx Vod Module on Ubuntu 20.04

Nginx-vod-module is NGINX-based module developed by Kaltura. nginx-vod-module (included in Kaltura-Nginx) Enables On-the-fly repackaging of MP4 files to DASH, HDS, HLS, MSS. There are several other features like DRM, multi-bitrate, subtitles etc. supported by this module.

To check the detail about nginx-vod-module, you can visit kaltura nginx-vod-module github page here

In this tutorial, we will show you how to install nginx-vod-module using built-in Kaltura-Nginx for easy installation.

PREREQUISITES


  1. Ubuntu 20.04 LTS (Focal Fossa)
  2. NGINX version 18
  3. FFMPEG
  4. Kaltura-Nginx

Optional steps if ubuntu server running using root:

  • Regular user with sudo access

We need to create user with sudo access by running the following command:

Terminal window
1
adduser ubuntu --gecos "Ubuntu User"
2
usermod -aG sudo ubuntu

Change “ubuntu” with your username. You can skip this if you already have user with sudo access.

After that, switch to already created user by running the following command:

Terminal window
1
su - ubuntu

Update ubuntu repository and upgrade ubuntu system by running the following command:

Terminal window
1
sudo apt-get update && sudo apt-get upgrade -y

INSTALL NGINX


Before we can install nginx-vod-module, we need to install NGINX on ubuntu first, the default NGINX version for ubuntu 20.04 is NGINX 1.18.0. Install using the following command:

Terminal window
1
sudo apt-get install nginx -y

Verify installed NGINX version and compiled modules.

Terminal window
1
sudo apt-get install nginx -y

INSTALL FFMPEG


Kaltura-nginx use FFmpeg shared library, so we need to install FFmpeg first. Install FFmpeg using the following command:

Terminal window
1
sudo apt-get install ffmpeg -y

Verify installed FFmpeg version and compiled modules.

Terminal window
1
ffmpeg -version

INSTALL KALTURA-NGINX


Before we can install Kaltura-Nginx, we need to add Kaltura-nginx repo first. Use the following command to add repo for Ubuntu focal fossa:

Terminal window
1
sudo su
2
wget -O - http://installrepo.kaltura.org/repo/aptn/focal/kaltura-deb-256.gpg.key|apt-key add -
3
echo "deb [arch=amd64] http://installrepo.kaltura.org/repo/aptn/focal propus main" > etc/apt/sources.list.d/kaltura.list

Update ubuntu repo and install Kaltura-Nginx

Terminal window
1
sudo apt-get update
2
sudo apt-get install kaltura-nginx -y

On Package configuration window, type your desired name for Server name. For example : kaltura-nginx

For Vhost port to listen on, change to port 80, make sure the port is open or allow in firewall

For RTMP port to listen on, leave default

Config Nginx with SSL, choose No

Do you intend to use the Nginx VOD module against a Kaltura CE Server? chose No

For Kaltura-nginx Operation mode, choose Local

For base dir for your media files, you can create videos folder on user home directory. For example: /home/ubuntu/videos/

Verify Kaltura-nginx installation by checking the status of kaltura-nginx.

Terminal window
1
sudo systemctl status kaltura-nginx.service

TEST NGINX-VOD-MODULE


To test if nginx-vod-module, we need to add video to /home/ubuntu/videos/ where we have configured as base dir for media files used by kaltura-nginx.

But first, we need to change permission of videos folder to current user (ubuntu)

Terminal window
1
sudo chown -R ubuntu:ubuntu videos/

Lets download three sample videos from google storage bucket.

Terminal window
1
cd ~/videos/
2
wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
3
wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4
4
wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4

After you run the above command, there should be three video files named BigBuckBunny.mp4, ElephantsDream.mp4 and ForBiggerBlazes.mp4 on videos folder.

To test the video, you can visit this url:

http://SERVER-IP/hls/VIDEO-NAME.mp4/index.m3u8

For example : http://159.69.115.198/hls/BigBuckBunny.mp4/index.m3u8

Open VLC Media Player, click Media >> Open Network Stream (Ctrl+N) >> Paste video link and click Play button.

That’s how you can install nginx-vod-module for hls media streaming, you can also integrate media files from google cloud storage by mounting gcs to linux using our tutorial, Mount Google Cloud Storage on Compute Engine or Linux.