Install Nginx Vod Module on Ubuntu 20.04

Cat Administrator

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
- Ubuntu 20.04 LTS (Focal Fossa)
- NGINX version 18
- FFMPEG
- 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:
1adduser ubuntu --gecos "Ubuntu User"2usermod -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:
1su - ubuntu
Update ubuntu repository and upgrade ubuntu system by running the following command:
1sudo 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:
1sudo apt-get install nginx -y
Verify installed NGINX version and compiled modules.
1sudo 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:
1sudo apt-get install ffmpeg -y
Verify installed FFmpeg version and compiled modules.
1ffmpeg -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:
1sudo su2wget -O - http://installrepo.kaltura.org/repo/aptn/focal/kaltura-deb-256.gpg.key|apt-key add -3echo "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
1sudo apt-get update2sudo 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.
1sudo 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)
1sudo chown -R ubuntu:ubuntu videos/
Lets download three sample videos from google storage bucket.
1cd ~/videos/2wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp43wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp44wget 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.