# pull rtmp://cdn.example.com/live/ch?id=1234 name=channel_a; # This is an example. Visit above url for more info.
# session_relay off; # on|off. On=relay is destroyed when connection is closed. Off=relay is destroyed when stream is closed. Default=off.
## PUSHING STREAMS ##
## Push has the same syntax as pull. Unlike pull, push directive publishes stream to remote server. ##
## This will push the stream from incoming /live application to these below to create HLS and/or Dash streams, or to record or transcode automatically. ##
## Only enable HLS push if you are not using ABS options earlier or by using the encoder application ##
pushrtmp://localhost/hls;# Remember to enable an app called HLS! Disable it if you use transcoding using variable bitrates.
## YOUTUBE PUSH OPTIONS ##
# push rmtp://localhost/youtube; # Uncomment this to use application on localhost (MUST BE SPECIFIED). OR simply use the following line:
# push rtmp://a.rtmp.youtube.com/live2 /YOUR-LIVE-STREAM-KEY; # Your RTMP stream will be pushed as it is to Youtube as an RTMP stream.
## TWITCH PUSH OPTIONS ##
# push rmtp://localhost/twitch; # Uncomment this to use application on localhost (MUST BE SPECIFIED). OR simply use the following line:
# push rtmp://live-ams.twitch.tv/app /live_YOUR-LIVE-STREAM-KEY; # Your RTMP stream will be pushed as it is to Twitch as an RTMP stream.
}
applicationhls{# We enabled pushing stream from 'live' application to 'hls' we need to define it of course.
allowpublish127.0.0.1;
denypublishall;
liveon;# on|off. Enables this application and allowing live streaming to it. Default=on.
hlson;# on|off. Toggles HLS on or off for this application.
hls_typelive;# live|event. Live plays from the current live position. Event plays from the start of the playlist. Default=live.
hls_path/tmp/hls;# Location to store the video fragment files. Will be created if it doesn't exist.
hls_fragment10s;# Sets HLS fragment length in seconds or minutes. Default=5s.
hls_playlist_length5m;# Sets HLS playlist length in seconds or minutes. Default=30s.
hls_sync2ms;# Timestamp sync threshold. Prevents crackling noise after conversion from low-res (1KHz) to high-res(90KHz). Default=2ms.
hls_continuousoff;# on|off. In this mode HLS sequence number is started from where it stopped last time. Old fragments are kept. Default=off.
hls_nestedon;# on|off. In this mode a subdirectory of hls_path is created for each stream. Default=off.
hls_cleanupon;# on|off. Nginx cache manager process removes old HLS fragments and playlist files from hls_path. Default=on.
hls_fragment_namingsystem;# system = use system time. sequential = use increasing integers. timestamp = use stream timestamp. Default=sequential.
hls_fragment_slicingplain;# plain|aligned. Plain: switch fragment when target duration is reached. Aligned: switch fragment when incoming timestamp is a
# multiple of fragment duration. Makes it possible to generate identical fragments on different nginx instances. Default=plain.
## ENCRYPTION KEYS ## !! Only works if you have certificates defined in your HTTP server block (Usually a seperate file in /sites-available/yourfile.conf)
# hls_keys on; # on|off. Enables HLS encryption. AES-128 method is used to encrypt the HLS fragments. Requires ssl module. Default=off.
# hls_key_path /tmp/keys; # Sets the directory where auto-generated HLS keys are saved. Default= hls_path.
# hls_key_url https://foo.bar/keys; # Sets url for HLS key file entries. When empty it assumes hls_path. Default= empty.
# hls_fragments_per_key 100; # Sets the number of HLS fragments encrypted with the same key. 0 means only one key is created at the publish start and
# all fragments within the session are encrypted with this key. Default=0.
## HLS_VARIANT - Used for variable bitrate streaming. Please read: https://github.com/arut/nginx-rtmp-module/wiki/Directives#hls_variant ##
## When hls_variant suffix is matched on stream name then variant playlist is created for the current stream with all entries specified by hls_variant
## directives in current application. Stripped name without suffix is used as variant stream name. The original stream is processed as usual.
## Optional parameters following the suffix are appended to EXT-X-STREAM-INF in m3u8 playlist. See HLS spec 3.3.10. EXT-X-STREAM-INF for full list.