NGINX-based VOD Packager
nginx-vod-module 
Join the list of organizations using this video packager project.
Features
-
On-the-fly repackaging of MP4 files to DASH, HDS, HLS, MSS
-
Working modes:
- Local - serve locally accessible files (local disk/NFS mounted)
- Remote - serve files accessible via HTTP using range requests
- Mapped - serve files according to a specification encoded in JSON format. The JSON can pulled from a remote server, or read from a local file
-
Adaptive bitrate support
-
Playlist support (playing several different media files one after the other) - mapped mode only
-
Simulated live support (generating a live stream from MP4 files) - mapped mode only
-
Fallback support for file not found in local/mapped modes (useful in multi-datacenter environments)
-
Video codecs: H264, H265 (DASH/HLS), VP9 (DASH)
-
Audio codecs: AAC, MP3 (HLS/HDS/MSS), AC-3 (DASH/HLS), E-AC-3 (DASH/HLS), OPUS (DASH)
-
Captions support -
Input:
- WebVTT
- SRT
- DFXP/TTML
- CAP (Cheetah)
Output:
- DASH - served as a single WebVTT
- HLS - segmented WebVTT (m3u8)
- MSS - converted to TTML and packaged in fragmented MP4 (no support for styling)
-
Audio only/video only files
-
Alternative audio renditions - supporting both:
- Generation of manifest with different audio renditions, allowing selection on the client side
- Muxing together audio and video streams from separate files / tracks - provides the ability
to serve different audio renditions of a single video, without the need for any special support
on the client side.
-
Track selection for multi audio/video MP4 files
-
Playback rate change - 0.5x up to 2x (requires libavcodec and libavfilter)
-
Source file clipping (only from I-Frame to P-frame)
-
Support for variable segment lengths - enabling the player to select the optimal bitrate fast,
without the overhead of short segments for the whole duration of the video -
Clipping of MP4 files for progressive download playback
-
Thumbnail capture (requires libavcodec) and resize (requires libswscale)
-
Volume map (requires libavcodec) - returns a CSV containing the volume level in each interval
-
Decryption of CENC-encrypted MP4 files (it is possible to create such files with MP4Box)
-
DASH: common encryption (CENC) support
-
MSS: PlayReady encryption support
-
HLS: Generation of I-frames playlist (EXT-X-I-FRAMES-ONLY)
-
HLS: support for AES-128 / SAMPLE-AES encryption
Limitations
-
Track selection and playback rate change are not supported in progressive download
-
I-frames playlist generation is not supported when encryption is enabled
-
Tested on Linux only
Compilation
Dependencies
In general, if you have the dependencies that are required to build nginx, you should be able to build nginx-vod-module.
However, some optional features of this module depend on additional packages. The module detects these packages
during configure
- if a package is missing, the respective feature will be disabled.
The optional features are:
- Thumbnail capture & volume map - depend on ffmpeg (3.0 or newer)
- Audio filtering (for changing playback rate / gain) - depends on ffmpeg (3.0 or newer) and also on libfdk_aac.
Due to licensing issues, libfdk_aac is not built into kaltura ffmpeg packages - Encryption / decryption (DRM / HLS AES) - depends on openssl
- DFXP captions - depends on libxml2
- UTF-16 encoded SRT files - depends on iconv
Build
To link statically against nginx, cd to nginx source directory and execute:
./configure --add-module=/path/to/nginx-vod-module
make
make install
To compile as a dynamic module (nginx 1.9.11+), use:
./configure --add-dynamic-module=/path/to/nginx-vod-module
In this case, the load_module
directive should be used in nginx.conf in order to load the module.
Optional recommended settings:
--with-file-aio
- enable asynchronous I/O support, highly recommended, relevant only to local and mapped modes--with-threads
(nginx 1.7.11+) - enable asynchronous file open using thread pool (also requiresvod_open_file_thread_pool
in nginx.conf), relevant only to local and mapped modes--with-cc-opt="-O3"
- enable additional compiler optimizations (we saw about 8% reduction in the mp4 parse time
and frame processing time compared to the nginx default-O
)
Debug settings:
--with-debug
- enable debug messages (also requires passingdebug
in theerror_log
directive in nginx.conf).--with-cc-opt="-O0"
- disable compiler optimizations (for debugging with gdb)
Installation
RHEL/CentOS 6/7 RPM
# rpm -ihv http://installrepo.kaltura.org/releases/kaltura-release.noarch.rpm
# yum install kaltura-nginx
Debian/Ubuntu deb package
Ubuntu NOTE: before trying to install kaltura-nginx, you must also make sure the multiverse repo is enabled
For Debian Wheezy [7], Debian Jessie [8], Ubuntu 14.04 and 14.10, add this repo:
# wget -O - http://installrepo.kaltura.org/repo/apt/debian/kaltura-deb-curr.gpg.key