| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Join the list of organizations using this video packager project.
On-the-fly repackaging of MP4 files to DASH, HDS, HLS, MSS
Working modes:
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), VP8 (DASH), VP9 (DASH), AV1 (DASH)
Audio codecs: AAC, MP3 (HLS/HDS/MSS), AC-3 (DASH/HLS), E-AC-3 (DASH/HLS), VORBIS (DASH), OPUS (DASH), FLAC (HLS), DTS (HLS)
Captions support -
Input:
Output:
Audio only/video only files
Alternative audio renditions - supporting both:
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
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
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:
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:
Debug settings:
C Macro Configurations:
# rpm -ihv http://installrepo.kaltura.org/releases/kaltura-release.noarch.rpm # yum install kaltura-nginx
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|apt-key add - # echo "deb [arch=amd64] http://installrepo.kaltura.org/repo/apt/debian propus main" > /etc/apt/sources.list.d/kaltura.list
For Ubuntu 16.04, 16.10 add this repo:
# wget -O - http://installrepo.kaltura.org/repo/apt/xenial/kaltura-deb-curr-256.gpg.key|apt-key add - # echo "deb [arch=amd64] http://installrepo.kaltura.org/repo/apt/xenial propus main" > /etc/apt/sources.list.d/kaltura.list
For Ubuntu 20.04 add this repo:
# wget -O - http://installrepo.kaltura.org/repo/aptn/focal/kaltura-deb-256.gpg.key|apt-key add - # echo "deb [arch=amd64] http://installrepo.kaltura.org/repo/aptn/focal quasar main" > /etc/apt/sources.list.d/kaltura.list
Then install the kaltura-nginx package:
# apt-get update # apt-get install kaltura-nginx
If you wish to make use of the following features:
You will also need to install the kaltura-ffmpeg (>= 3.1) package.
The basic structure of an nginx-vod-module URL is: http://<domain>/<location>/<fileuri>/<filename>
Where:
Multi URLs are used to encode several URLs on a single URL. A multi URL can be used to specify the URLs of several different MP4 files that should be included together in a DASH MPD for example.
The structure of a multi URL is: http://<domain>/<location>/<prefix>,<middle1>,<middle2>,<middle3>,<postfix>.urlset/<filename>
The sample URL above represents 3 URLs:
The suffix .urlset (can be changed using vod_multi_uri_suffix) indicates that the URL should be treated as a multi URL. For example - the URL http://example.com/hls/videos/big_buck_bunny_,6,9,15,00k.mp4.urlset/master.m3u8 will return a manifest containing:
The following parameters are supported on the URL path:
The structure of filename is: <basename>[<seqparams>][<fileparams>][<trackparams>][<langparams>].<extension>
Where:
When configured to run in mapped mode, nginx-vod-module issues an HTTP request to a configured upstream server in order to receive the layout of media streams it should generate. The response has to be in JSON format.
This section contains a few simple examples followed by a reference of the supported objects and fields. But first, a couple of definitions:
The JSON below maps the request URI to a single MP4 file:
{
"sequences": [
{
"clips": [
{
"type": "source",
"path": "/path/to/video.mp4"
}
]
}
]
}
When using multi URLs, this is the only allowed JSON pattern. In other words, it is not possible to combine more complex JSONs using multi URL.
As an alternative to using multi URL, an adaptive set can be defined via JSON:
{
"sequences": [
{
"clips": [
{
"type": "source",
"path": "/path/to/bitrate1.mp4"
}
]
},
{
"clips": [
{
"type": "source",
"path": "/path/to/bitrate2.mp4"
}
]
}
]
}
The JSON below will play 35 seconds of video1 followed by 22 seconds of video2:
{
"durations": [ 35000, 22000 ],
"sequences": [
{
"clips": [
{
"type": "source",
"path": "/path/to/video1.mp4"
},
{
"type": "source",
"path": "/path/to/video2.mp4"
}
]
}
]
}
The JSON below takes video1, plays it at x1.5 and mixes the audio of the result with the audio of video2, after reducing it to 50% volume:
{
"sequences": [
{
"clips": [
{
"type": "mixFilter",
"sources": [
{
"type": "rateFilter",
"rate": 1.5,
"source": {
"type": "source",
"path": "/path/to/video1.mp4"
}
},
{
"type": "gainFilter",
"gain": 0.5,
"source": {
"type": "source",
"path": "/path/to/video2.mp4",
"tracks": "a1"
}
}
]
}
]
}
]
}
The JSON below is a sample of a continuous live stream (=a live stream in which all videos have exactly the same encoding parameters). In practice, this JSON will have to be generated by some script, since it is time dependent. (see test/playlist.php for a sample implementation)
{
"playlistType": "live",
"discontinuity": false,
"segmentBaseTime": 1451904060000,
"firstClipTime": 1451917506000,
"durations": [83000, 83000],
"sequences": [
{
"clips": [
{
"type": "source",
"path": "/path/to/video1.mp4"
},
{
"type": "source",
"path": "/path/to/video2.mp4"
}
]
}
]
}
The JSON below is a sample of a non-continuous live stream (=a live stream in which the videos have different encoding parameters). In practice, this JSON will have to be generated by some script, since it is time dependent (see test/playlist.php for a sample implementation)
{
"playlistType": "live",
"discontinuity": true,
"initialClipIndex": 171,
"initialSegmentIndex": 153,
"firstClipTime": 1451918170000,
"durations": [83000, 83000],
"sequences": [
{
"clips": [
{
"type": "source",
"path": "/path/to/video1.mp4"
},
{
"type": "source",
"path": "/path/to/video2.mp4"
}
]
}
]
}
Mandatory fields:
Optional fields:
Live fields:
Mandatory fields:
Optional fields:
Mandatory fields:
Optional fields:
Mandatory fields:
Optional fields:
Mandatory fields:
Mandatory fields:
Mandatory fields:
Mandatory fields:
Optional fields:
Mandatory fields:
Mandatory fields:
Mandatory fields:
Optional fields:
Media packaged by nginx-vod-module can be protected using CDN tokens, this works as follows:
In this setup it also highly recommended to block direct access to the origin server by authenticating the CDN requests. Without this protection, a user who somehow gets the address of the origin will be able to bypass the CDN token enforcement. If using Akamai, this can be accomplished using https://github.com/refractalize/nginx_mod_akamai_g2o. For other CDNs, it may be possible to configure the CDN to send a secret header to the origin and then simply enforce the header using an nginx if statement:
if ($http_x_secret_origin_header != "secret value") {
return 403;
}
In addition to the above, most CDNs support other access control settings, such as geo-location. These restrictions are completely transparent to the origin and should work well.
Deployments in which the media is pulled directly from nginx-vod-module can protect the media using nginx access control directives, such allow, deny, or access_by_lua (for more complex scenarios).
In addition, it is possible to build a token based solution (as detailed in the previous section) without a CDN, by having the nginx server validate the token. The module https://github.com/kaltura/nginx-akamai-token-validate-module can be used to validate Akamai tokens. Locations on which the module is enabled will return 403 unless the request contains a valid Akamai token. See the readme of this module for more details.
As an alternative to tokenization, URL encryption can be used to prevent an attacker from being able to craft a playable URL. URL encryption can be implemented with https://github.com/kaltura/nginx-secure-token-module, and is supported for HLS and DASH (with manifest format set to segmentlist).
In terms of security, the main advantage of CDN tokens over URL encryption is that CDN tokens usually expire, while encrypted URLs do not (someone who obtains a playable URL will be able to use it indefinitely)
Nginx-vod-module supports AES-128 and SAMPLE-AES HLS encryption schemes. The main difference between media encryption and DRM (detailed below) is the mechanism used to transfer the encryption key to the client. With media encryption the key is fetched by the client by performing a simple GET request to nginx-vod-module, while with DRM the key is returned inside a vendor specific license response.
Media encryption reduces the problem of securing the media to the need to secure the encryption key. The media segment URLs (which compose the vast majority of the traffic) can be completely unprotected, and easily cacheable by any proxies between the client and servers (unlike tokenization). The encryption key request can then be protected using one of the methods mentioned above (CDN tokens, nginx access rules etc.).
In addition, it is possible to configure nginx-vod-module to return the encryption key over HTTPS while having the segments delivered over HTTP. The way to configure this is to set vod_segments_base_url to http://nginx-vod-host and set vod_base_url to https://nginx-vod-host.
Nginx-vod-module has the ability to perform on-the-fly encryption for MPEG DASH (CENC), MSS Play Ready and FairPlay HLS. As in the case of media encryption, the encryption is performed while serving a video/audio segment to the client, therefore, when working with DRM it is recommended not to serve the content directly from nginx-vod-module to end-users. A more scalable architecture would be to use proxy servers or a CDN in order to cache the encrypted segments.
In order to perform the encryption, nginx-vod-module needs several parameters, including key & key_id, these parameters are fetched from an external server via HTTP GET requests. The vod_drm_upstream_location parameter specifies an nginx location that is used to access the DRM server, and the request uri is configured using vod_drm_request_uri (this parameter can include nginx variables). The response of the DRM server is a JSON, with the following format:
[{
"pssh": [{
"data": "CAESEGMyZjg2MTczN2NjNGYzODIaB2thbHR1cmEiCjBfbmptaWlwbXAqBVNEX0hE",
"uuid": "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
}],
"key": "GzoNU9Dfwc//Iq3/zbzMUw==",
"key_id": "YzJmODYxNzM3Y2M0ZjM4Mg=="
}]
Apple FairPlay HLS:
location ~ ^/fpshls/p/\d+/(sp/\d+/)?serveFlavor/entryId/([^/]+)/(.*) {
vod hls;
vod_hls_encryption_method sample-aes;
vod_hls_encryption_key_uri "skd://entry-$2";
vod_hls_encryption_key_format "com.apple.streamingkeydelivery";
vod_hls_encryption_key_format_versions "1";
vod_drm_enabled on;
vod_drm_request_uri "/udrm/system/ovp/$vod_suburi";
vod_last_modified_types *;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
expires 100d;
}
Common Encryption HLS:
location ~ ^/cenchls/p/\d+/(sp/\d+/)?serveFlavor/entryId/([^/]+)/(.*) {
vod hls;
vod_hls_encryption_method sample-aes-cenc;
vod_hls_encryption_key_format "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";
vod_hls_encryption_key_format_versions "1";
vod_drm_enabled on;
vod_drm_request_uri "/udrm/system/ovp/$vod_suburi";
vod_last_modified_types *;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
expires 100d;
}
Following is a list of configurations that were tested and found working:
For medium/large scale deployments, don't have users play the videos directly from nginx-vod-module. Since all the different streaming protocols supported by nginx vod are HTTP based, they can be cached by standard HTTP proxies / CDNs. For medium scale add a layer of caching proxies between the vod module and the end users (can use standard nginx servers with proxy_pass & proxy_cache). For large scale deployments, it is recommended to use a CDN (such as Akamai, Level3 etc.).
In general, it's best to have nginx vod as close as possible to where the mp4 files are stored, and have the caching proxies as close as possible to the end users.
Enable nginx-vod-module caches:
The hit/miss ratios of these caches can be tracked by enabling performance counters (vod_performance_counters) and setting up a status page for nginx vod (vod_status)
In local & mapped modes, enable aio. - nginx has to be compiled with aio support, and it has to be enabled in nginx conf (aio on). You can verify it works by looking at the performance counters on the vod status page - read_file (aio off) vs. async_read_file (aio on)
In local & mapped modes, enable asynchronous file open - nginx has to be compiled with threads support, and vod_open_file_thread_pool has to be specified in nginx.conf. You can verify it works by looking at the performance counters on the vod status page - open_file vs. async_open_file. Note that open_file may be nonzero with vod_open_file_thread_pool enabled, due to the open file cache - open requests that are served from cache will be counted as synchronous open_file.
When using DRM enabled DASH/MSS, if the video files have a single nalu per frame, set vod_min_single_nalu_per_frame_segment to non-zero.
The muxing overhead of the streams generated by this module can be reduced by changing the following parameters:
Enable gzip compression on manifest responses -
gzip_types application/vnd.apple.mpegurl video/f4m application/dash+xml text/xml
Apply common nginx performance best practices, such as tcp_nodelay=on, client_header_timeout etc.
Enables the nginx-vod module on the enclosing location. The allowed values for segmenter are:
Sets the file access mode - local, remote or mapped (see the features section above for more details)
Enables the nginx-vod status page on the enclosing location. The following query params are supported:
Sets the segment duration in milliseconds. It is highly recommended to use a segment duration that is a multiple of the GOP duration. If the segment duration is not a multiple of GOP duration, and vod_align_segments_to_key_frames is enabled, there could be significant differences between the segment duration that is reported in the manifest and the actual segment duration. This could also lead to the appearance of empty segments within the stream.
Sets the total duration in milliseconds of the segments that should be returned in a live manifest. If the value is positive, nginx vod returns a range of maximum vod_live_window_duration milliseconds, ending at the current server time. If the value is negative, nginx vod returns a range of maximum -vod_live_window_duration milliseconds from the end of the mapping json. If the value is set to zero, the live manifest will contain all the segments that are fully contained in the mapping json time frame.
Generate a vod stream even when the media set has playlistType=live. Enabling this setting has the following effects:
This can be useful for clipping vod sections out of a live stream.
Generate continuous timestamps even when the media set has gaps (gaps can created by the use of clipTimes) If ID3 timestamps are enabled (vod_hls_mpegts_output_id3_timestamps), they contain the original timestamps that were set in clipTimes.
Adds a bootstrap segment duration in milliseconds. This setting can be used to make the first few segments shorter than the default segment duration, thus making the adaptive bitrate selection kick-in earlier without the overhead of short segments throughout the video.
When enabled, the module forces all segments to start with a key frame. Enabling this setting can lead to differences between the actual segment durations and the durations reported in the manifest (unless vod_manifest_segment_durations_mode is set to accurate).
Configures the policy for calculating the segment count, for segment_duration = 10 seconds:
Configures the policy for calculating the duration of a manifest containing multiple streams:
Configures the calculation mode of segment durations within manifest requests:
This parameter provides a way to override portions of the media set JSON (mapped mode only). For example, vod_media_set_override_json '{"clipTo":20000}' clips the media set to 20 sec. The parameter value can contain variables.
Sets an nginx location that is used to read the MP4 file (remote mode) or mapping the request URI (mapped mode).
Sets an nginx location that is used to read the MP4 file on remote or mapped mode. If this directive is set on mapped mode, the module reads the MP4 files over HTTP, treating the paths in the mapping JSON as URIs (the default behavior is to read from local files)
Sets the size that is allocated for holding the response headers when issuing upstream requests (to vod_xxx_upstream_location).
Extra query string arguments that should be added to the upstream request (remote/mapped modes only). The parameter value can contain variables.
Sets the uri of media set mapping requests, the parameter value can contain variables. In case of multi url, $vod_suburi will be the current sub uri (a separate request is issued per sub URL)
Sets the prefix that is expected in URI mapping responses (mapped mode only).
Sets the postfix that is expected in URI mapping responses (mapped mode only).
Sets the maximum length of a path returned from upstream (mapped mode only).
Sets an nginx location to which the request is forwarded after encountering a file not found error (local/mapped modes only).
Sets the name of an HTTP header that is used to prevent fallback proxy loops (local/mapped modes only).
Sets the value of an HTTP header that is used to prevent fallback proxy loops (local/mapped modes only).
Configures the size and shared memory object name of the video metadata cache. For MP4 files, this cache holds the moov atom.
Configures the size and shared memory object name of the mapping cache for vod (mapped mode only).
Configures the size and shared memory object name of the mapping cache for live (mapped mode only).
Configures the size and shared memory object name of the response cache. The response cache holds manifests and other non-video content (like DASH init segment, HLS encryption key etc.). Video segments are not cached.
Configures the size and shared memory object name of the response cache for time changing live responses. This cache holds the following types of responses for live: DASH MPD, HLS index M3U8, HDS bootstrap, MSS manifest.
Sets the size of the initial read operation of the MP4 file.
Sets the maximum supported video metadata size (for MP4 - moov atom size)
Sets the limit on the total size of the frames of a single segment
Sets the limit on the total count of the frames read to serve non segment (e.g. playlist) request.
Sets the limit on the total count of the frames read to serve segment request.
Sets the size of the cache buffers used when reading MP4 frames.
Enables the use of asynchronous file open via thread pool. The thread pool must be defined with a thread_pool directive, if no pool name is specified the default pool is used. This directive is supported only on nginx 1.7.11 or newer when compiling with --add-threads. Note: this directive currently disables the use of nginx's open_file_cache by nginx-vod-module
Pre-allocates buffers for generating response data, saving the need allocate/free the buffers on every request.
Configures the shared memory object name of the performance counters
Sets the base URL (scheme + domain) that should be returned in manifest responses. The parameter value can contain variables, if the parameter evaluates to an empty string, relative URLs will be used. If the parameter evaluates to a string ending with /, it is assumed to be a full URL - the module only appends the file name to it, instead of a full URI. If not set, the base URL is determined as follows:
Sets the base URL (scheme + domain) that should be used for delivering video segments. The parameter value can contain variables, if the parameter evaluates to an empty string, relative URLs will be used. If not set, vod_base_url will be used. The setting currently affects only HLS.
A URL suffix that is used to identify multi URLs. A multi URL is a way to encode several different URLs that should be played together as an adaptive streaming set, under a single URL. When the default suffix is used, an HLS set URL may look like: http://host/hls/common-prefix,bitrate1,bitrate2,common-suffix.urlset/master.m3u8
The name of the clip to request parameter.
The name of the clip from request parameter.
The name of the tracks request parameter.
The name of the shift request parameter.
The name of the speed request parameter.
The name of the language request parameter.
Use sequence index in segment uris even if there is only one sequence
Sets the value of the "Expires" and "Cache-Control" response headers for successful requests. This directive is similar to nginx's built-in expires directive, except that it only supports the expiration interval scenario (epoch, max, off, day time are not supported) Main motivation for using this directive instead of the built-in expires is to have different expiration for VOD and dynamic live content. If this directive is not specified, nginx-vod-module will not set the "Expires" / "Cache-Control" headers. This setting affects all types of requests in VOD playlists and segment requests in live playlists.
Same as vod_expires (above) for live requests that are not time dependent and not segments (e.g. HLS - master.m3u8, HDS - manifest.f4m).
Same as vod_expires (above) for live requests that are time dependent (HLS - index.m3u8, HDS - bootstrap.abst, MSS - manifest, DASH - manifest.mpd).
Sets the value of the Last-Modified header returned on the response, by default the module does not return a Last-Modified header. The reason for having this parameter here is in order to support If-Modified-Since / If-Unmodified-Since. Since nginx's builtin ngx_http_not_modified_filter_module runs before any other header filter module, it will not see any headers set by add_headers / more_set_headers. This makes nginx always reply as if the content changed (412 for If-Unmodified-Since / 200 for If-Modified-Since) For live requests that are not segments (e.g. live DASH MPD), Last-Modified is set to the current server time.
Sets the MIME types for which the Last-Modified header should be set. The special value "*" matches any MIME type.
Configures the size and shared memory object name of the cache that stores the mapping of dynamic clips.
Sets the uri that should be used to map dynamic clips. The parameter value can contain variables, specifically, $vod_clip_id contains the id of the clip that should be mapped. The expected response from this uri is a JSON containing a concat clip object.
Sets the uri that should be used to map source clips defined using the clipIds property of concat. The parameter value can contain variables, specifically, $vod_clip_id contains the id of the clip that should be mapped. The expected response from this uri is a JSON containing a source clip object.
Sets a url to which requests for segments should be redirected. The parameter value can contain variables, specifically, $vod_dynamic_mapping contains a serialized representation of the mapping of dynamic clips.
Maps dynamic clips to concat clips using the given expression, previously generated by $vod_dynamic_mapping. The parameter value can contain variables.
Sets the uri that should be used to issue notifications. The parameter value can contain variables, specifically, $vod_notification_id contains the id of the notification that is being fired. The response from this uri is ignored.
Sets the seed that is used to generate the TS encryption key and DASH/MSS encryption IVs. The parameter value can contain variables, and will usually have the structure "secret-$vod_filepath". See the list of nginx variables added by this module below.
Sets the seed that is used to generate the encryption IV, currently applies only to HLS/fMP4 with AES-128 encryption. The parameter value can contain variables.
When enabled, the module encrypts the media segments according to the response it gets from the drm upstream. Currently supported only for dash and mss (play ready).
When enabled, the module requests the drm info only for the first sequence and applies it to all sequences. When disabled, the drm info is requested for each sequence separately. In addition, in DASH, enabling this setting makes the module place the ContentProtection tag under AdaptationSet, otherwise, it is placed under Representation.
Sets the number of clear (unencrypted) segments in the beginning of the stream. A clear lead enables the player to start playing without having to wait for the license response.
Sets the maximum length of a drm info returned from upstream.
Sets the nginx location that should be used for getting the DRM info for the file.
Configures the size and shared memory object name of the drm info cache.
Sets the uri of drm info requests, the parameter value can contain variables. In case of multi url, $vod_suburi will be the current sub uri (a separate drm info request is issued per sub URL)
Sets the minimum segment index (1-based) that should be assumed to have a single h264 nalu per frame. If the value is 0, no assumption is being made on the number of nal units per frame. This setting only affects DASH and MSS configurations that have DRM enabled.
When transcoding videos using libx264, by default, all frames have a single nal unit, except the first frame that contains an additional nalu with the libx264 copyright information. Setting this parameter to a value greater than 0 can provide a significant performance improvement, since the layout of the segment can be calculated in advance, allowing the module to:
When enabled the server returns absolute URLs in MPD requests
The name of the MPD file (an mpd extension is implied).
Sets the profiles that are returned in the MPD tag in manifest responses.
The name of the MP4 initialization file (an mp4 extension is implied).
The name of the fragment files (an m4s extension is implied).
Sets the MPD format, available options are:
Sets the format of the subtitles returned in the MPD, available options are:
When enabled, the DRM pssh boxes are returned in the DASH init segment and in the manifest. When disabled, the pssh boxes are returned only in the manifest.
The bitrate threshold for removing identical bitrates, streams whose bitrate differences are less than this value will be considered identical.
When enabled, a BaseURL tag will be used to specify the fragments/init segment base url. Otherwise, the media/initialization attributes under SegmentTemplate will contain absolute URLs.
When enabled the server returns the base URL in the F4M manifest
The name of the HDS manifest file (an f4m extension is implied).
The prefix of fragment file names, the actual file name is frag-f<file-index>-v<video-track-index>-a<audio-track-index>-Seg1-Frag<index>.
When enabled the module generates a moof atom in the HDS fragments, when disabled only an mdat atom is generated. Turning this parameter off reduces the packaging overhead, however the default is on since Adobe tools are generating this atom.
Sets the encryption method of HLS segments, allowed values are: none (default), aes-128, sample-aes, sample-aes-cenc.
When enabled the server returns the audio stream in separate segments than the ones used by the video stream (using EXT-X-MEDIA)
Sets the container format of the HLS segments. The default behavior is to use fmp4 for HEVC, and mpegts otherwise (Apple does not support HEVC over MPEG TS).
When enabled the server returns absolute playlist URLs in master playlist requests
When enabled the server returns absolute segment URLs in media playlist requests
When enabled the server returns absolute segment URLs in iframe playlist requests
When disabled iframe playlists are not returned as part of master playlists
The name of the HLS master playlist file (an m3u8 extension is implied).
The name of the HLS media playlist file (an m3u8 extension is implied).
The name of the HLS I-frames playlist file (an m3u8 extension is implied).
The prefix of segment file names, the actual file name is seg-<index>-v<video-track-index>-a<audio-track-index>.ts.
The name of the init segment file name, only relevant when using fmp4 container.
The name of the encryption key file name, only relevant when encryption method is not none.
Sets the value of the URI attribute of EXT-X-KEY, only relevant when encryption method is not none. The parameter value can contain variables.
Sets the value of the KEYFORMAT attribute of EXT-X-KEY, only relevant when encryption method is not none.
Sets the value of the KEYFORMATVERSIONS attribute of EXT-X-KEY, only relevant when encryption method is not none.
When enabled, the HLS muxer interleaves frames of different streams (audio / video). When disabled, on every switch between audio / video the muxer flushes the MPEG TS packet.
When enabled, every video / audio frame is aligned to MPEG TS packet boundary, padding is added as needed.
When enabled, an ID3 TEXT frame will be outputted in each TS segment, containing a JSON with the absolute segment timestamp. The timestamp is measured in milliseconds since the epoch (unixtime x 1000), the JSON structure is: {"timestamp":1459779115000}
When enabled, the module will shift back the dts timestamps by the pts delay of the initial frame. This can help keep the pts timestamps aligned across multiple renditions.
The name of the manifest file (has no extension).
The bitrate threshold for removing identical bitrates, streams whose bitrate differences are less than this value will be considered identical.
The name of the thumbnail file (a jpg extension is implied).
When enabled, the module grabs the frame that is closest to the requested offset. When disabled, the module uses the keyframe that is closest to the requested offset. Setting this parameter to off can result in faster thumbnail capture, since the module always decodes a single video frame per request.
Sets the interval (in milliseconds) before the thumbnail offset that should be loaded. This setting should be set to the maximum GOP size, setting it to a lower value may result in capture failure. Note that the metadata of all frames between offset - vod_gop_look_behind and offset + vod_gop_look_ahead is loaded, however only the frames of the minimum GOP containing offset will be read and decoded.
Sets the interval (in milliseconds) after the thumbnail offset that should be loaded.
The name of the volume map file (a csv extension is implied).
Sets the interval/resolution (in milliseconds) of the volume map.
When enabled, the module ignores any edit lists (elst) in the MP4 file.
When enabled, the module parses the name field of the hdlr MP4 atom, and uses it as the stream label.
When enabled, the module parses the name atom child of the udta MP4 atom, and uses it as the stream label.
The module adds the following nginx variables:
Note: Configuration directives that can accept variables are explicitly marked as such.
http {
upstream fallback {
server fallback.kaltura.com:80;
}
server {
# vod settings
vod_mode local;
vod_fallback_upstream_location /fallback;
vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
vod_last_modified_types *;
# vod caches
vod_metadata_cache metadata_cache 512m;
vod_response_cache response_cache 128m;
# gzip manifests
gzip on;
gzip_types application/vnd.apple.mpegurl;
# file handle caching / aio
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
aio on;
location ^~ /fallback/ {
internal;
proxy_pass http://fallback/;
proxy_set_header Host $http_host;
}
location /content/ {
root /web/;
vod hls;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
expires 100d;
}
}
}
http {
upstream kalapi {
server www.kaltura.com:80;
}
upstream fallback {
server fallback.kaltura.com:80;
}
server {
# vod settings
vod_mode mapped;
vod_upstream_location /kalapi;
vod_upstream_extra_args "pathOnly=1";
vod_fallback_upstream_location /fallback;
vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
vod_last_modified_types *;
# vod caches
vod_metadata_cache metadata_cache 512m;
vod_response_cache response_cache 128m;
vod_mapping_cache mapping_cache 5m;
# gzip manifests
gzip on;
gzip_types application/vnd.apple.mpegurl;
# file handle caching / aio
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
aio on;
location ^~ /fallback/ {
internal;
proxy_pass http://fallback/;
proxy_set_header Host $http_host;
}
location ^~ /kalapi/ {
internal;
proxy_pass http://kalapi/;
proxy_set_header Host $http_host;
}
location ~ ^/p/\d+/(sp/\d+/)?serveFlavor/ {
# encrypted hls
vod hls;
vod_secret_key "mukkaukk$vod_filepath";
vod_hls_encryption_method aes-128;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
expires 100d;
}
}
}
http {
upstream jsonupstream {
server jsonserver:80;
}
server {
# vod settings
vod_mode mapped;
vod_upstream_location /json;
vod_remote_upstream_location /proxy;
vod_upstream_extra_args "pathOnly=1";
vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
vod_last_modified_types *;
# vod caches
vod_metadata_cache metadata_cache 512m;
vod_response_cache response_cache 128m;
vod_mapping_cache mapping_cache 5m;
# gzip manifests
gzip on;
gzip_types application/vnd.apple.mpegurl;
# file handle caching / aio
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
aio on;
location ^~ /json/hls/ {
internal;
proxy_pass http://jsonupstream/;
proxy_set_header Host $http_host;
}
location ~ /proxy/([^/]+)/(.*) {
internal;
proxy_pass $1://$2;
resolver 8.8.8.8;
}
location ~ ^/hls/ {
vod hls;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
expires 100d;
}
}
}
Set it up so that http://jsonserver:80/test.json returns the following JSON:
{
"sequences": [{
"clips": [{
"type": "source",
"path": "/http/commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
}]
}]
}
And use this stream URL - http://nginx-vod-server/hls/test.json/master.m3u8
http {
upstream kalapi {
server www.kaltura.com:80;
}
server {
# vod settings
vod_mode remote;
vod_upstream_location /kalapi;
vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
vod_last_modified_types *;
# vod caches
vod_metadata_cache metadata_cache 512m;
vod_response_cache response_cache 128m;
# gzip manifests
gzip on;
gzip_types application/vnd.apple.mpegurl;
location ^~ /kalapi/ {
internal;
proxy_pass http://kalapi/;
proxy_set_header Host $http_host;
}
location ~ ^/p/\d+/(sp/\d+/)?serveFlavor/ {
vod hls;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
expires 100d;
}
}
}
All code in this project is released under the AGPLv3 license unless a different license for a particular library is specified in the applicable library path.
Copyright © Kaltura Inc. All rights reserved.
| Back | FazBrowse Home | New Git URL |