NGINX-based VOD Packager

基于 NGINX 的 MP4 重新打包器。(NGINX-based MP4 Repackager)

Github stars Tracking Chart

NGINX-based VOD Packager

nginx-vod-module Build Status

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:

    1. Local - serve locally accessible files (local disk/NFS mounted)
    2. Remote - serve files accessible via HTTP using range requests
    3. 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:

    1. WebVTT
    2. SRT
    3. DFXP/TTML
    4. CAP (Cheetah)

    Output:

    1. DASH - served as a single WebVTT
    2. HLS - segmented WebVTT (m3u8)
    3. MSS - converted to TTML and packaged in fragmented MP4 (no support for styling)
  • Audio only/video only files

  • Alternative audio renditions - supporting both:

    1. Generation of manifest with different audio renditions, allowing selection on the client side
    2. 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:

  1. Thumbnail capture & volume map - depend on ffmpeg (3.0 or newer)
  2. 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
  3. Encryption / decryption (DRM / HLS AES) - depends on openssl
  4. DFXP captions - depends on libxml2
  5. 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:

  1. --with-file-aio - enable asynchronous I/O support, highly recommended, relevant only to local and mapped modes
  2. --with-threads (nginx 1.7.11+) - enable asynchronous file open using thread pool (also requires vod_open_file_thread_pool in nginx.conf), relevant only to local and mapped modes
  3. --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:

  1. --with-debug - enable debug messages (also requires passing debug in the error_log directive in nginx.conf).
  2. --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

Overview

Name With Ownerkaltura/nginx-vod-module
Primary LanguageC
Program languageC (Language Count: 7)
PlatformLinux
License:GNU Affero General Public License v3.0
Release Count38
Last Release Name1.33 (Posted on )
First Release Name1.0 (Posted on 2015-04-14 13:30:30)
Created At2014-07-13 15:31:08
Pushed At2024-05-05 14:54:57
Last Commit At2024-03-18 21:17:19
Stargazers Count1.9k
Watchers Count122
Fork Count430
Commits Count1.5k
Has Issues Enabled
Issues Count945
Issue Open Count259
Pull Requests Count531
Pull Requests Open Count12
Pull Requests Close Count34
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private
To the top