http-vod #
Join the list of organizations using this video packager project.
Source: upstream source
Directives
vod #
syntax: vod segmenter · default: n/a · context: location
Enables the nginx-vod module on the enclosing location. The allowed values for segmenter are: 1. none - serves the MP4 files as is / clipped 2. dash - Dynamic Adaptive Streaming over HTTP packager 3. hds - Adobe HTTP Dynamic Streaming packager 4. hls - Apple HTTP Live Streaming packager 5. mss - Microsoft Smooth Streaming packager
vod_align_segments_to_key_frames #
syntax: vod_align_segments_to_key_frames on/off · default: off · context: http, server, location
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).
vod_apply_dynamic_mapping #
syntax: vod_apply_dynamic_mapping mapping · default: none · context: http, server, location
Maps dynamic clips to concat clips using the given expression, previously generated by $vod_dynamic_mapping. The parameter value can contain variables.
vod_base_url #
syntax: vod_base_url url · default: see below · context: http, server, location
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.
vod_bootstrap_segment_durations #
syntax: vod_bootstrap_segment_durations duration · default: none · context: http, server, location
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.
vod_cache_buffer_size #
syntax: vod_cache_buffer_size size · default: 256K · context: http, server, location
Sets the size of the cache buffers used when reading MP4 frames.
vod_clip_from_param_name #
syntax: vod_clip_from_param_name name · default: clipFrom · context: http, server, location
The name of the clip from request parameter.
vod_clip_to_param_name #
syntax: vod_clip_to_param_name name · default: clipTo · context: http, server, location
The name of the clip to request parameter.
vod_drm_clear_lead_segment_count #
syntax: vod_drm_clear_lead_segment_count count · default: 1 · context: http, server, location
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.
vod_drm_enabled #
syntax: vod_drm_enabled on/off · default: off · context: http, server, location
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).
vod_drm_info_cache #
syntax: vod_drm_info_cache zone_name zone_size [expiration] · default: off · context: http, server, location
Configures the size and shared memory object name of the drm info cache.
vod_drm_max_info_length #
syntax: vod_drm_max_info_length length · default: 4K · context: http, server, location
Sets the maximum length of a drm info returned from upstream.
vod_drm_request_uri #
syntax: vod_drm_request_uri uri · default: $vod_suburi · context: http, server, location
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)
vod_drm_single_key #
syntax: vod_drm_single_key on/off · default: off · context: http, server, location
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.
vod_drm_upstream_location #
syntax: vod_drm_upstream_location location · default: none · context: http, server, location
Sets the nginx location that should be used for getting the DRM info for the file.
vod_dynamic_clip_map_uri #
syntax: vod_dynamic_clip_map_uri uri · default: none · context: http, server, location
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.
vod_dynamic_mapping_cache #
syntax: vod_dynamic_mapping_cache zone_name zone_size [expiration] · default: off · context: http, server, location
Configures the size and shared memory object name of the cache that stores the mapping of dynamic clips.
vod_encryption_iv_seed #
syntax: vod_encryption_iv_seed string · default: empty · context: http, server, location
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.
vod_expires #
syntax: vod_expires time · default: none · context: http, server, location
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)
vod_expires_live #
syntax: vod_expires_live time · default: none · context: http, server, location
Same as vod_expires (above) for live requests that are not time dependent and not segments (e.g. HLS - master.m3u8, HDS - manifest.f4m).
vod_expires_live_time_dependent #
syntax: vod_expires_live_time_dependent time · default: none · context: http, server, location
Same as vod_expires (above) for live requests that are time dependent (HLS - index.m3u8, HDS - bootstrap.abst, MSS - manifest, DASH - manifest.mpd).
vod_fallback_upstream_location #
syntax: vod_fallback_upstream_location location · default: none · context: http, server, location
Sets an nginx location to which the request is forwarded after encountering a file not found error (local/mapped modes only).
vod_force_continuous_timestamps #
syntax: vod_force_continuous_timestamps on/off · default: off · context: http, server, location
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.
vod_force_playlist_type_vod #
syntax: vod_force_playlist_type_vod on/off · default: off · context: http, server, location
Generate a vod stream even when the media set has playlistType=live. Enabling this setting has the following effects: 1. Frame timestamps will be continuous and start from zero 2. Segment indexes will start from one 3. In case of HLS, the returned manifest will have both #EXT-X-PLAYLIST-TYPE:VOD and #EXT-X-ENDLIST
vod_force_sequence_index #
syntax: vod_force_sequence_index on/off · default: off · context: http, server, location
Use sequence index in segment uris even if there is only one sequence
vod_gop_look_ahead #
syntax: vod_gop_look_ahead millis · default: 1000 · context: http, server, location
Sets the interval (in milliseconds) after the thumbnail offset that should be loaded.
vod_gop_look_behind #
syntax: vod_gop_look_behind millis · default: 10000 · context: http, server, location
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
vod_ignore_edit_list #
syntax: vod_ignore_edit_list on/off · default: off · context: http, server, location
When enabled, the module ignores any edit lists (elst) in the MP4 file.
vod_initial_read_size #
syntax: vod_initial_read_size size · default: 4K · context: http, server, location
Sets the size of the initial read operation of the MP4 file.
vod_lang_param_name #
syntax: vod_lang_param_name name · default: lang · context: http, server, location
The name of the language request parameter.
vod_last_modified #
syntax: vod_last_modified time · default: none · context: http, server, location
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. This makes nginx always reply as if the content changed (412 for If-Unmodified-Since / 200 for If-Modified-Since)
vod_last_modified_types #
syntax: vod_last_modified_types mime-type1 mime-type2 ... · default: none · context: http, server, location
Sets the MIME types for which the Last-Modified header should be set. The special value "*" matches any MIME type.
vod_live_mapping_cache #
syntax: vod_live_mapping_cache zone_name zone_size [expiration] · default: off · context: http, server, location
Configures the size and shared memory object name of the mapping cache for live (mapped mode only).
vod_live_response_cache #
syntax: vod_live_response_cache zone_name zone_size [expiration] · default: off · context: http, server, location
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.
vod_live_window_duration #
syntax: vod_live_window_duration duration · default: 30000 · context: http, server, location
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.
vod_manifest_duration_policy #
syntax: vod_manifest_duration_policy min/max · default: max · context: http, server, location
Configures the policy for calculating the duration of a manifest containing multiple streams:
vod_manifest_segment_durations_mode #
syntax: vod_manifest_segment_durations_mode estimate/accurate · default: estimate · context: http, server, location
Configures the calculation mode of segment durations within manifest requests: an HLS manifest will contain #EXTINF:10 frame rate of 29.97 and 10 second segments it will report the first segment as 10.01. accurate mode also takes into account the key frame alignment, in case vod_align_segments_to_key_frames is on
vod_mapping_cache #
syntax: vod_mapping_cache zone_name zone_size [expiration] · default: off · context: http, server, location
Configures the size and shared memory object name of the mapping cache for vod (mapped mode only).
vod_max_frame_count #
syntax: vod_max_frame_count count · default: 1048576 · context: http, server, location
Sets the limit on the total count of the frames read to serve non segment (e.g. playlist) request.
vod_max_frames_size #
syntax: vod_max_frames_size size · default: 16MB · context: http, server, location
Sets the limit on the total size of the frames of a single segment
vod_max_mapping_response_size #
syntax: vod_max_mapping_response_size length · default: 1K · context: http, server, location
Sets the maximum length of a path returned from upstream (mapped mode only).
vod_max_metadata_size #
syntax: vod_max_metadata_size size · default: 128MB · context: http, server, location
Sets the maximum supported video metadata size (for MP4 - moov atom size)
vod_max_upstream_headers_size #
syntax: vod_max_upstream_headers_size size · default: 4k · context: http, server, location
Sets the size that is allocated for holding the response headers when issuing upstream requests (to vod_xxx_upstream_location).
vod_media_set_map_uri #
syntax: vod_media_set_map_uri uri · default: $vod_suburi · context: http, server, location
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)
vod_media_set_override_json #
syntax: vod_media_set_override_json json · default: {} · context: http, server, location
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.
vod_metadata_cache #
syntax: vod_metadata_cache zone_name zone_size [expiration] · default: off · context: http, server, location
Configures the size and shared memory object name of the video metadata cache. For MP4 files, this cache holds the moov atom.
vod_min_single_nalu_per_frame_segment #
syntax: vod_min_single_nalu_per_frame_segment index · default: 0 · context: http, server, location
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. calculated in advance, allowing the module to:
vod_mode #
syntax: vod_mode mode · default: local · context: http, server, location
Sets the file access mode - local, remote or mapped (see the features section above for more details)
vod_multi_uri_suffix #
syntax: vod_multi_uri_suffix suffix · default: .urlset · context: http, server, location
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
vod_notification_uri #
syntax: vod_notification_uri uri · default: none · context: http, server, location
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.
vod_open_file_thread_pool #
syntax: vod_open_file_thread_pool pool_name · default: off · context: http, server, location
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.
vod_output_buffer_pool #
syntax: vod_output_buffer_pool size count · default: off · context: http, server, location
Pre-allocates buffers for generating response data, saving the need allocate/free the buffers on every request.
vod_parse_hdlr_name #
syntax: vod_parse_hdlr_name on/off · default: off · context: http, server, location
When enabled, the module parses the name field of the hdlr MP4 atom, and uses it as the stream label.
vod_parse_udta_name #
syntax: vod_parse_udta_name on/off · default: off · context: http, server, location
When enabled, the module parses the name atom child of the udta MP4 atom, and uses it as the stream label.
vod_path_response_postfix #
syntax: vod_path_response_postfix postfix · default: "}]}]} · context: http, server, location
Sets the postfix that is expected in URI mapping responses (mapped mode only).
vod_path_response_prefix #
syntax: vod_path_response_prefix prefix · default: {"sequences":[{"clips":[{"type":"source","path":" · context: http, server, location
Sets the prefix that is expected in URI mapping responses (mapped mode only).
vod_performance_counters #
syntax: vod_performance_counters zone_name · default: off · context: http, server, location
Configures the shared memory object name of the performance counters
vod_proxy_header_name #
syntax: vod_proxy_header_name name · default: X-Kaltura-Proxy · context: http, server, location
Sets the name of an HTTP header that is used to prevent fallback proxy loops (local/mapped modes only).
vod_proxy_header_value #
syntax: vod_proxy_header_value name · default: dumpApiRequest · context: http, server, location
Sets the value of an HTTP header that is used to prevent fallback proxy loops (local/mapped modes only).
vod_redirect_segments_url #
syntax: vod_redirect_segments_url url · default: none · context: http, server, location
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.
vod_remote_upstream_location #
syntax: vod_remote_upstream_location location · default: none · context: http, server, location
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)
vod_response_cache #
syntax: vod_response_cache zone_name zone_size [expiration] · default: off · context: http, server, location
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.
vod_secret_key #
syntax: vod_secret_key string · default: empty · context: http, server, location
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.
vod_segment_count_policy #
syntax: vod_segment_count_policy last_short/last_long/last_rounded · default: last_short · context: http, server, location
Configures the policy for calculating the segment count, for segment_duration = 10 seconds:
vod_segment_duration #
syntax: vod_segment_duration duration · default: 10s · context: http, server, location
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 the appearance of empty segments within the stream.
vod_segment_max_frame_count #
syntax: vod_segment_max_frame_count count · default: 65536 · context: http, server, location
Sets the limit on the total count of the frames read to serve segment request.
vod_segments_base_url #
syntax: vod_segments_base_url url · default: see below · context: http, server, location
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.
vod_source_clip_map_uri #
syntax: vod_source_clip_map_uri uri · default: none · context: http, server, location
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.
vod_speed_param_name #
syntax: vod_speed_param_name name · default: speed · context: http, server, location
The name of the speed request parameter.
vod_status #
syntax: vod_status · default: n/a · context: location
Enables the nginx-vod status page on the enclosing location. The following query params are supported:
vod_time_shift_param_name #
syntax: vod_time_shift_param_name name · default: shift · context: http, server, location
The name of the shift request parameter.
vod_tracks_param_name #
syntax: vod_tracks_param_name name · default: tracks · context: http, server, location
The name of the tracks request parameter.
vod_upstream_extra_args #
syntax: vod_upstream_extra_args "arg1=value1&arg2=value2&..." · default: empty · context: http, server, location
Extra query string arguments that should be added to the upstream request (remote/mapped modes only). The parameter value can contain variables.
vod_upstream_location #
syntax: vod_upstream_location location · default: none · context: http, server, location
Sets an nginx location that is used to read the MP4 file (remote mode) or mapping the request URI (mapped mode).
Example
worker_processes 1;
error_log /var/log/nginx/error.log debug;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $bytes_sent $request_time "$http_referer" '
'"$http_user_agent" "$http_x_kaltura_f5_https" $http_x_kaltura_f5_remote_addr '
'"$sent_http_x_kaltura" "$http_host" $pid $sent_http_x_kaltura_session - '
'$request_length "$sent_http_content_range" "$http_x_forwarded_for" '
'"$http_x_forwarded_server" "$http_x_forwarded_host" "$sent_http_cache_control" '
'$connection ';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
keepalive_requests 1000;
client_header_timeout 20;
client_body_timeout 20;
reset_timedout_connection on;
send_timeout 20;
add_header X-Me $hostname;
gzip on;
gzip_types application/vnd.apple.mpegurl;
# common vod settings
vod_metadata_cache metadata_cache 512m;
vod_mapping_cache mapping_cache 5m;
vod_response_cache response_cache 128m;
vod_drm_info_cache drm_cache 64m;
# common proxy settings
proxy_connect_timeout 5;
proxy_send_timeout 5;
proxy_read_timeout 5;
# common file caching / aio
open_file_cache max=100 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
aio on;
upstream kalapi {
server localhost:80 max_fails=0;
}
upstream self {
server localhost:8001 max_fails=0;
keepalive 32;
}
upstream testapi {
server localhost:8002 max_fails=0;
}
upstream fallback {
server localhost:8003 max_fails=0;
}
upstream drmservice {
server localhost:8004 max_fails=0;
}
server {
listen 8001 backlog=1024;
server_name localhost;
# location for testing keep-alive - any requests to /self/xxx get proxied to xxx with keepalive
# the tested module "sees" keepalive connections even though the test code is not using keepalive
location /self/ {
proxy_pass http://self/;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
}
# internal location for vod subrequests
location /kalapi_proxy/ {
internal;
proxy_pass http://kalapi/;
proxy_set_header Host $http_host;
}
location /testapi_proxy/ {
int
…