Streambuilder modules description¶
Base parameters¶
Option |
Description |
|---|---|
keyfile |
path to license file |
license_server |
URI to license server requests |
AACWriter¶
Description¶
Modure for audio media fragments writing.
Configuration¶
Option |
Description |
|---|---|
id |
Media fragment id |
segment_length |
Media fragment duration. Default - 4 seconds |
root |
Directory to save media fragments |
stream |
Stream name |
group_id |
Group identity to which media fragments belong. Required parameter. |
language |
Language |
name |
Readable name. If language is present this description must be in that language. Required parameter. |
default |
Default value |
autoselect |
Autoselect |
Example of usage¶
aac_writer_eng {
SyncGop
AACWriter#eng {
id audio_eng
segment_length 4
stream a_eng
root /tmp/streambuilder/khl_1
group_id aac
language eng
name eng_khl
default NO
autoselect NO
}
FragmentsMapSaver#eng {
fragmap /mnt/mediaroot/live_hls/khl_1/a_eng
}
}
ADecoder¶
Description¶
Module for audio packets decoding. Returns raw audio packets.
Example of usage¶
preaudio {
@source
FilterStream#Demuxer.a.0
ADecoder#Demuxer.a.0 {
codec "libfaac"
}
FillGap#audio {
timeout 2000
}
AudioResampler {
options {
nc 2
samplerate 44100
}
}
}
AEncoder¶
Description¶
Module for raw audio packets encoding.
Configuration¶
Option |
Description |
|---|---|
codec |
Codec name as in libavcodec |
options |
Encode options as in libavcodec |
Example of usage¶
aenc_mono {
@preaudio_mono
a_mono {
class AEncoder
codec "libmp3lame"
options {
b 96000
}
}
@downstream
}
AesHls¶
Description¶
Module to AES encript HLS media fragments with Verimatrix key server.
Configuration¶
Option |
Description |
|---|---|
segment_count |
Amount of segments |
Example of usage¶
verimatrix {
HlsKeyFeed {
type VOD
keyserver "127.0.0.1:14684"
resource_id 3231
}
AesHls
}
downstream {
AVRenum
Logger
SyncGop
HlsWriter {
segment_length 4
miss_allowed 2
quality {
id 480p
video AVRenum.v_480p
audio AVRenum.a_b128000
}
}
AesHls {
segment_count 5
}
...
}
AudioFilters¶
Description¶
The module implements ffmpeg audio filters thus combining the syntax adopted in ffmpeg and options in the streambuilder configuration files.
Configuration¶
Option |
Description |
|---|---|
layout |
channels layout (defaults to input stream) |
nc |
number of channels, has less priority than layout (defaults to input stream) |
samplerate |
sampling frequency, the average number of samples obtained in one second (defaults to input stream) |
sample_format |
audio sample format, the number of bits used to describe each sample (defaults to input stream) |
pan |
audio channels mapping description string |
volume |
the volume of audio signal |
filter |
string describing audio filters (defaults to empty string) |
Example of usage¶
AudioFilters {
options {
nc 5
pan "c0=c1|c1=c0|c2=c1|c3=c0|c4=c1"
samplerate 48000
volume 3
}
}
AudioGain¶
Description¶
AudioGain module
Configuration¶
Option |
Description |
|---|---|
noise |
noise threshold (usually 10) |
limit |
the maximum volume in relative units is 0..1 |
step |
the size of the window, measured in packets (1000 by default) |
HTTP interface¶
State request
GET http://127.0.0.1:2222/module/AudioGain%231/status
echo -e "GET /module/AudioGain%231/status HTTP/1.0\r\n" | sudo socat - unix:/var/run/streambuilder/sb_test.sock
Example answer
gain=1.000000 max_value=1.000000 max_value_average=1.000000 volume_max=19660.200000
Example of usage¶
aenc_main {
@preaudio
AudioResampler#audio_main {
options {
nc 1
}
}
AudioGain#main {
options {
noise 5
limit 0.25
step 1000
}
}
a_b128000 {
class AEncoder
codec "libfaac"
options {
b 128000
}
}
@downstream
}
AudioResampler¶
Description¶
AudioResampler module
Configuration¶
Option |
Description |
|---|---|
layout |
output audio stream layout: “mono”, “stereo”, “2.1”, “3.0”, “3.0(back)”, “4.0”, “quad”, “quad(side)”, “3.1”, “5.0”, “5.0(side)”, “4.1”, “5.1”, “5.1(side)”, “6.0”, “6.0(front)”, “hexagonal”, “6.1”, “6.1(front)”, “7.0”, “7.0(front)”, “7.1”, “7.1(wide)”, “7.1(wide-side)”, “octagonal”, “downmix”. Defaults to siurce audio stream layout. If the number of input audio channels is less than the output, the additional channels will be empty (silence). |
nc |
the number of channels for output stream |
samplerate |
sampling frequency, the average number of samples obtained in one second (defaults to input stream) |
in_sample_rate |
sampling frequency for rtmp input audio |
Example of usage¶
AudioResampler {
options {
nc 2
layout stereo ; mono
samplerate 44100
in_sample_rate 48000
}
}
AudioTrackSelector¶
Description¶
From the incoming 16-channel raw sound, selects two channels and generates stereo packets for transmission.
Configuration¶
Option |
Description |
|---|---|
left |
left channel number |
right |
right channel number |
HTTP interface¶
Getting value:
http://khl1:23078/module/AudioTrackSelector%23main/showtrack
http://khl1:23078/module/AudioTrackSelector%23main/gettrack
Setting new value:
http://khl1:23078/module/AudioTrackSelector%23main/settrack?left=0&right=1
Example of usage¶
preaudio_eng {
@source
FilterStream#audio
AudioTrackSelector#eng {
left 0
right 4
}
}
AVMuxer¶
Description¶
Module for reading media streams and writing them to specified uri.
Configuration¶
Option |
Description |
|---|---|
uri |
output media uri in libavformat standard (required parameter) |
format |
output media format (default - flv) |
streams |
list of streams for muxing (default - writes first audio and first video streams received) |
options |
options list for AVFormatContext |
Note on AVMuxer rtmp uri¶
For RTMP connection URL syntax has to be (RTMPS is also supported):
rtmp://server[:port][/app][/playpath][ keyword=value]...
where ‘app’ is first one or two directories in the path (e.g. /ondemand/, /flash/live/, etc.) and ‘playpath’ is a file name (the rest of the path, may be prefixed with “mp4:”)
Additional RTMP library options may be appended as space-separated key-value pairs. Valid RTMP options are:
Option |
Type |
Description |
|---|---|---|
socks |
string |
Use the specified SOCKS proxy |
app |
string |
Name of target app on server |
tcUrl |
string |
URL to played stream |
pageUrl |
string |
URL of played media’s web page |
swfUrl |
string |
URL to player SWF file |
flashver |
string |
Flash version string (default LNX 10,0,32,18) |
conn |
AMF |
Append arbitrary AMF data to Connect message |
playpath |
string |
Path to target media on server |
playlist |
boolean |
Set playlist before play command |
live |
boolean |
Stream is live, no seeking possible |
subscribe |
string |
Stream to subscribe to |
jtv |
string |
Justin.tv authentication token |
token |
string |
Key for SecureToken response |
swfVfy |
boolean |
Perform SWF Verification |
swfAge |
integer |
Number of days to use cached SWF hash |
start |
integer |
Stream start position in milliseconds |
stop |
integer |
Stream stop position in milliseconds |
buffer |
integer |
Buffer time in milliseconds |
timeout |
integer |
Session timeout in seconds |
pubUser |
string |
Publisher username |
pubPasswd |
string |
Publisher password |
Example of usage¶
AVMuxer {
uri "/home/user/out.mp4"
format mp4
streams {
audio_stream_1
audio_stream_2
video_stream
}
options {
max_delay 1
probesize 10000000
fflags genpts
fdebug ts
output_ts_offset 300
}
}
example with rtmp authentication
AVMuxer {
uri "rtmp://XXXXXXXXX.akamai.net/Entry/XXXXXXXXXX@XXXXXX flashver=FMLE/3.0\\20(compatible;\\20FMSc/1.0) live=true pubUser=XXXXXX pubPasswd=XXXXXXXX"
}
example parameters for udp
AVMuxer {
uri "udp://192.168.0.4:1234?buffer_size=3000000&fifo_size=3000000&pkt_size=1316"
format mpegts
streams {
a_b96000
a_b128000
venc_360p
venc_480p
venc_720p
}
options {
muxrate 5000000
pcr_period 20
}
}
AVRenum¶
Description¶
Module for incoming packets timestamps normalization. From every input packet’s PTS/DTS this module subtracts some value for normalization and for solving the problem of PTS/DTS (int64) values overflow.
Example of usage¶
hls_writer {
@downstream
AVRenum
Logger
SyncGop
HlsWriter {
segment_length 4
...
BSFilters¶
Description¶
Module for coded packets filtering. List of Bitstream Filters is specified in the parameters. Filters are applied in the order specified in the configuration.
Configuration¶
Option |
Description |
|---|---|
format |
output format (default - mpegts) |
video |
list of video filters |
audio |
list of audio filters |
If these parameters are absent, then it’s assumed that the list of video filters is used in the configuration
Example of usage¶
BSFilters {
format flv
audio {
aac_adtstoasc
}
}
BSFilters {
h264_mp4toannexb
}
CueBlackout¶
Description¶
Module to streams blackouts by markers
Configuration¶
Option |
Description |
|---|---|
plug |
path to the file to be used instead of the stream (default is black screen) |
max_blackout_duration |
maximum blackout duration in seconds (default 600) |
Example of usage¶
CueBlackout {
plug "/home/ksavkov/testfiles/bread.ts"
max_blackout_duration 180
}
HTTP interface¶
Request to get blackout state
*GET /module/CueBlackout/status*
Manual blackout start
*GET /module/CueBlackout/start_blackout*
*GET /module/CueBlackout/on*
Manual blackout stop
*GET /module/CueBlackout/stop_blackout*
*GET /module/CueBlackout/off*
DashServer¶
Description¶
Module to give out media presentation description (MPD) and dash-segments by HTTP
Configuration¶
Option |
Description |
|---|---|
ip |
http-address of dash server |
listen |
number of incoming connections, supported in backlog queue |
rootdir |
directory where MPD and dash-segments located |
url_offset |
how many url path elements to skip (new in v10.12) |
no_timeline |
do not display SegmentTimeline in MPD (new in v21.5) |
segment_duration |
segment duration in seconds to calculate duration parameter of SegmentTemplate in MPD (default: 6 sec.) (new in v21.8) |
HTTP-request to get MPD¶
curl http://192.168.21.132:23002/module/DashServer/live.mpd
Example of usage¶
DashServer {
listen 20
ip 0.0.0.0:22010
url_offset 2
rootdir /mnt/dash/
no_timeline 1
segment_duration 6
}
}
DDecoder¶
Description¶
Module for data packets decoding.
Configuration¶
Option |
Description |
|---|---|
scte_out |
path to file to save scte35 cue messages in nase64 format |
Example of usage¶
filterdata {
@source
FilterStream#Demuxer.d.0
DDecoder#Demuxer.d.0 {
scte_out "/var/streambuilder/sb_sts/scte.dat"
}
}
Demuxer¶
Description¶
Reads the media stream from the source specified in the uri. Generates media messages and sends them further through the streambuilder graph.
Configuration¶
Option |
Description |
|---|---|
uri |
media source in libavformat standard |
loop |
boolean value to cycle the stream |
programs |
list of programs to select for mpts |
channel_name |
channel name to send through the graph |
streamname |
parameter to set format of graph streams |
Example of usage¶
Demuxer {
channel_name some_channel
uri "udp://127.0.0.1:14080?buffer_size=3000000&fifo_size=3000000&timeout=3000000"
}
Demuxer {
channel_name some_channel
uri "udp://127.0.0.1:14080?buffer_size=3000000&fifo_size=3000000&timeout=3000000"
streamname "{{name}}.{{type}}.{{program_id}}"
}
to select all streams from program with id 1020 from mpts
source {
Demuxer {
channel_name some_channel
streamname "{{name}}.{{type}}.{{program_id}}"
uri "http://example.people.tv:8080/channel"
}
}
filtervideo {
@source
FilterStream#Demuxer.v.1020
VDecoder#Demuxer.v.1020 {
codec libx264
check_metadata_changing 0
}
}
to select streams by id from mpts
source {
Demuxer {
channel_name some_channel
streamname "{{name}}.{{type}}.{{stream_id}}"
uri "http://example.people.tv:8080/channel"
}
}
filtervideo {
@source
FilterStream#Demuxer.v.200
VDecoder#Demuxer.v.200 {
codec libx264
check_metadata_changing 0
}
}
filteraudio {
@source
FilterStream#Demuxer.a.201
ADecoder#Demuxer.a.201
}
DropCache¶
Description¶
The module for the delayed drop of the cache of recorded fragments. Must be included in the configuration after FileHlsSaver module.
Configuration¶
Option |
Description |
|---|---|
timeout |
for every media fragment cache will be dropped in timeout to 2 * timeout (milliseconds) |
Example of usage¶
FileHlsSaver {
docroot /tmp/streambuilder/some_channel
fragmap /mnt/mediaroot/live_hls/some_channel
}
Timeout#saver {
start 10000
timeout 20000
}
DropCache {
timeout 10000
}
DtmfDetector¶
Description¶
A module to detect DTMF tags in an audio stream.
Configuration¶
Option |
Description |
|---|---|
out_sequence |
opening sequence of characters |
in_sequence |
closing sequence of characters |
volume_threshold |
threshold volume for determining valid tones (default 25) |
tone_duration |
tone duration in milliseconds (default 40ms) |
pause_duration |
pause time between tones in milliseconds (default tone_duration) |
out_delay |
after how many milliseconds to report the opening dtmf arrival (default 1000ms) |
in_delay |
after how many milliseconds to report the closing dtmf arrival (default 1000ms) |
log |
the path to the file into which information about found dtmf is logged |
Example of usage¶
DtmfDetector {
out_sequence "D5A7"
in_sequence "7A5D"
volume_threshold 30
log "/var/streambuilder/channel/dtmf.dat"
}
EncoderMetrics¶
Description¶
A module to estimate the quality of signal coding. The module must get as input encoded packages and raw packages that were used for encoding.
Configuration¶
Option |
Description |
|---|---|
num_frames |
how many frames to estimate on |
sampling_period_s |
how many seconds to consider the metric to be actual |
metric |
metric to estimate (values: psnr, vmaf), default: PSNR |
options |
metric options |
VMAF options
Option |
Description |
|---|---|
model_path |
path to estimation model (default: /usr/local/share/model/vmaf_v0.6.1.pkl) |
phone_model |
use model for mobile phone |
log_path |
path to log results |
log_fmt |
log file format (values: xml, json, csv) |
psnr |
estimate psnr |
ssim |
estimate ssim |
ms_ssim |
estimate ms_ssim |
n_thread |
number of threds for calculations (default: 0 - maximum available) |
Example of usage¶
metrics {
@prevideo_576|venc_576p
EncoderMetrics {
sampling_period_s 30
num_frames 25
metric vmaf
options {
log_path vmaf.json
log_fmt json
psnr
ssim
ms_ssim
}
}
}
HTTP-interface¶
To prepare metric
GET module/EncoderMetrics/prepare_report
To get metric value
GET module/EncoderMetrics/get_report
Evergreen¶
Description¶
Module to send a dummy signal in the absence of a source signal. When a real stream appears, it begins to be transcoded instead of dummy. It is important that its parameters coincide with those specified in the module, so that they must either be known in advance or lead to the same.
Configuration¶
Option |
Description |
|---|---|
channel_name |
channel name (default “evergreen”) |
time_base |
stream time base (default 1/90000) |
plug_uri |
path to file from which to create a dummy stream (default is black image) |
fps |
stream framerate (default 25 frames per second) |
width |
video width (default 640) |
height |
video height (default 480) |
sar |
storage aspect ratio (default 1/1) |
pix_fmt |
video pixel format (default yuv420p) |
sample_rate |
audio sample rate (default 44100 Hz) |
nb_samples |
number of audio samples in output stream (default 1024) |
channel_layout |
audio channel layout (default stereo) |
sample_fmt |
audio sample format (default s16) |
start_ms |
time in milliseconds to wait for source signal (default 5000) |
Example of usage¶
filtervideo {
VideoFilters#pre_evergreen {
options {
width 640
height 360
fps 30
}
}
}
...
filteraudio {
AudioResampler#pre_evergreen {
options {
samplerate 44100
layout stereo
}
}
}
...
evergreen {
@filtervideo|filteraudio
Evergreen {
channel_name "evergreen"
time_base 1/1000
plug_uri "/home/ksavkov/testfiles/secam-for-dv.png"
width 640
height 360
fps 30
sample_rate 44100
channel_layout stereo
}
FillGap {
allow_backward_shift
png_uri "/home/ksavkov/testfiles/black.png"
}
OrderPacket
FillGap#evergreen {
timeout 10000
}
}
FileHlsSaver¶
Description¶
Module to get the HlsBundle packets from the HlsWriter module and to store them on disk as HLS segments.
Configuration¶
Option |
Description |
|---|---|
docroot |
root directory to save HLS media fragments in differents media streams |
fragmap |
root directory to save fragments.map files |
localtime |
generate file names based on current astronomic time not on internal timestamps |
nocache |
do not cache HLS media fragments in the OS system cache |
user |
owner of written HLS media segments (in user or user:group format) with 644 rights (docroot and log directories must be writable for this user) |
Example of usage¶
FileHlsSaver {
docroot /tmp/streambuilder/sb_test
fragmap /mnt/media/sb_test
user video
}
FileReader¶
Description¶
Module to read data from file (or stdandard input fd=0) and to send it further to streambuilder graph.
Configuration¶
Option |
Description |
|---|---|
filename |
file name from where to read input data |
fd |
int - number of opened file descriptor to write ouptup data |
Example of usage¶
source {
FileReader
PbReader
}
FileWriter¶
Description¶
Module to read data from file (or stdandard input fd=0) and to send it further to streambuilder graph.
Configuration¶
Option |
Description |
|---|---|
filename |
file name to write output data |
fd |
int - opened file descriptor number to write ouptup data |
Example of usage¶
writer {
@downstream
PbWriter
FileWriter
}
FillGap¶
Description¶
Module to receive decoded audio and video packets. When the input signal is lost it fills the gaps in the stream with an imitation: for the video - a blank picture, for audio - silence.
Configuration¶
Option |
Description |
|---|---|
png_uri |
path to stub image. By default - the last received video frame |
timeout |
time interval in milliseconds. If during the specified timeout the packets do not arrive at the module input, the signal is considered to be lost, and stub packets are generated to fill the pass. The default is 1000 ms. |
Example of usage¶
To implement a stub in the StreamBuider configuration, you need to add two FillGap modules after the audio and video decoders
FillGap#video {
png_uri "/usr/local/images/apng.png"
timeout 1000
}
FillGap#audio {
timeout 1000
}
HTTP-interface¶
Counting the number of errors in the input stream
GET /module/FillGap/lost
Requests are made separately to each FillGap configuration module.
Request to video stream
curl http://127.0.0.1:22081/module/FillGap%23video/lost
echo -e "GET /module/FillGap%23video/status HTTP/1.0\r\n" |sudo socat - unix:/var/run/streambuilder/sb_test.sock
Answer
{
"name": "VDecoder#Demuxer.v.0",
"lost": "26",
"time": "2016-Nov-25 10:40:04"
}
Request to audeo stream
curl http://127.0.0.1:22081/module/FillGap%23audio/lost
echo -e "GET /module/FillGap%23audio/status HTTP/1.0\r\n" |sudo socat - unix:/var/run/streambuilder/sb_test.sock
Answer
{
"name": "ADecoder#Demuxer.a.0",
"lost": "1",
"time": "2016-Nov-25 10:40:28"
}
FixSubTimestamp¶
Description¶
The module receives a stream of raw subtitles on the input and causes their timestamps to match the timestamps of the packets. In the case of ASS subtitters, it also changes the times in the event string. It is assumed that the module will be placed after the OrderPacket.
FragmentsMapSaver¶
Description¶
Module to save pathes of saved HLS media fragments in fragments.map file.
Configuration¶
Option |
Description |
|---|---|
fragmap |
root directory for saving fragments.map files |
Example of usage¶
writer {
FragmentsMapSaver {
fragmap /mnt/hls/example/path
}
}
HWEncoder¶
Description¶
Gets raw video packets on the input and encodes them using Quick Sync technology and passes encoded packets further on the graph
Configuration¶
Coding options
Option |
Description |
|---|---|
b |
bitrate |
g |
GOP size |
CodecProfile |
profile (baseline, main, extended, high, constrained_baseline, constrained_high, progressive_high) |
CodecLevel |
h264 codec level (avc1, avc1b, avc11, avc12, avc13, avc2, avc21, avc22, avc3, avc31, avc32, avc4, avc41, avc42, avc5, avc51, avc52, avc_set0, avc_set1, avc_set2, avc_set3, avc_set4, avc_set5) |
TargetUsage |
encoding preset, affects performance (quality, balanced, speed, targetusage1, targetusage2, targetusage3, targetusage4, targetusage5, targetusage6, targetusage7) |
GopRefDist |
distance between I or P keyframes. If 0, then the GOP structure is not defined. If 1, then B-frames are not used (the default is 1) |
RateControlMethod |
bitrate control (cbr, vbr, cqp, avbr, la, icq, vcm, laicq) |
For a more detailed description of these parameters, see the Intel Media Server Studio SDK documentation
Example of usage¶
profile {
class HWEncoder
codec "libx264"
options {
b 750000
g 100
CodecProfile "main"
CodecLevel "avc3"
TargetUsage "balanced"
}
}
HlsControl¶
Description¶
The module to terminate the streambuilder, if the media fragments are recorded at a time that differs from current
Configuration¶
Option |
Description |
|---|---|
threshold |
the threshold value of the time difference between the media fragment and current time |
Example of usage¶
HlsControl must be used in configuration between HlsWriter and FileHlsSaver modules
HlsWriter {
segment_length 4
miss_allowed 2
...
}
HlsControl {
treshold 20
}
FileHlsSaver {
docroot /mnt/media/hls/channel
user video
}
HlsKeyFeed¶
Description¶
Module to feed keys from Verimatrix server for AES encryption in AesHls module.
Configuration¶
Option |
Description |
|---|---|
realtime |
use real or relative timestamps in requests to Verimatrix key server |
type |
type of request to key server (VOD) |
keyserver |
URI of Verimatrix key server |
resource_id |
resource id on Verimatrix key server |
Example request to Verimatrix key server
http://127.0.0.1:22684/CAB/keyfile?r=gladiator1&t=VOD&p=125
Example of usage¶
verimatrix {
HlsKeyFeed {
type VOD
keyserver "127.0.0.1:14684"
resource_id 3231
}
AesHls
}
downstream {
AVRenum
Logger
SyncGop
HlsWriter {
segment_length 4
miss_allowed 2
quality {
id 480p
video AVRenum.v_480p
audio AVRenum.a_b128000
}
}
AesHls {
segment_count 5
}
...
}
HlsServer¶
Description¶
The module receives HlsBundle messages and sends MPEGTS stream over HTTP
Configuration¶
Option |
Description |
|---|---|
window |
playlist size in seconds (60) |
outdated |
time to store outdated media fragments in seconds (120) |
ip |
ip-address of HTTP-server |
listen |
number of incoming connections supported by the backlog queue (5) |
maxclients |
max clients to connect (500) |
crossdomain |
path to crossdomain.xml |
abspath |
whether to generate absolute or relative paths to HLS media fragments. 1 - absolute, 0 (default) - relative |
use_fts |
whether to insert #EXT-X-MEDIA-FTS tag in playlist (0) |
datetime_tag |
whether to output #EXT-X-PROGRAM-DATE-TIME tag in playlist (0) |
scte_end_date |
whether to output END-DATE in palylist #EXT-X-DATERANGE tag (0) |
Example of usage¶
hls_server {
@downstream
HlsServer {
ip 0.0.0.0:8081
listen 20
abspath 1
}
}
HlsTable¶
Description¶
Module to set parameters of Digital Video Recorder (DVR) server to send information about written media fragments.
Configuration¶
Option |
Description |
|---|---|
host_name |
host name or ip-address of host with DVR-server |
host_address |
ip-address:port of DVR-server |
Example of usage¶
database { ; DSN of PostgreSQL database to connect
dsn "host=127.0.0.1 dbname=dvr user=streambuilder password=streambuilder"
}
...
hlswriter {
...
}
dvr {
@hlswriter
HlsTable {
host_address "127.0.0.1:23082"
host_name 127.0.0.1
}
}
HlsWriter¶
Description¶
The module receives GopSlice messages containing all the packets belonging to the same GOP and forms a HlsBundle object containing synchronized fragments in the MPEGTS format, for further graph processing.
Configuration¶
Option |
Description |
|---|---|
segment_length |
segment duration (default 4 seconds) |
segment_count |
segments counter for AES encryption (default 1) |
options |
MPEG TS parameters |
service_provider |
metadata to set service_provider field in SDT |
miss_allowed |
integer - the maximum number of cases when there is at least one stream is absent in the input packet. When this amount is reached, the process aborts. In the absence of a parameter, such cases are ignored. |
drm |
sign of digital restrictions management (DRM) usage (boolean, default false) |
drmkey |
key used in Advanced Encryption Standard (AES) encryption (16-byte hex-encoded value) |
iv |
initialization vector used in AES encryption (16-byte hex-encoded value) |
drmuri |
URI used in playlists to request DRM key for AES decryption |
SDT - Service Description Table
Quality parameters
Option |
Description |
|---|---|
id |
identifier for this stream/quality |
video |
this quality video stream name (from encoder) |
audio |
this quality audio stream name (from encoder) |
muxrate |
combined rate of all video and audio elementary stream packets common to one program |
Example of usage¶
HlsWriter {
segment_length 4
miss_allowed 2
quality {
id hdp
video v_hdp
audio a_high
}
quality {
id i1
video v_hdp
audio a_low
}
}
with mpegts parameters
HlsWriter {
segment_length 4
miss_allowed 2
service_provider "Streambuilder.pro"
options {
mpegts_flags system_b
pcr_period 20
mpegts_service_id 0x0001
mpegts_service_type advanced_codec_digital_sdtv
flush_packets 0
sdt_period 1
mpegts_original_network_id 0x0001
tables_version 10
pat_period 0.25
mpegts_transport_stream_id 0x0001
}
quality {
audio AVRenum.a_b128000
video AVRenum.v_480p
id 480p
muxrate 2900000
}
quality {
audio AVRenum.a_b128000
video AVRenum.v_360p
id 360p
muxrate 2100000
}
}
Use AES HLS
HlsWriter {
drm 1
drmuri "http://127.0.0.1:23001/aes/test_aes_hls"
drmkey 662ac8814b30178485961610d6640e17
segment_length 4
miss_allowed 2
quality {
audio AVRenum.a_b128000
video AVRenum.v_480p
id 480p
}
quality {
audio AVRenum.a_b128000
video AVRenum.v_360p
id 360p
}
}
Media playlist for above configuration
#EXTM3U
#EXT-X-MEDIA-SEQUENCE:5
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:7
#EXT-X-KEY:METHOD=AES-128,URI="http://127.0.0.1:23001/aes/test_aes_hls",IV=0x00000000000000000000000000000006
#EXTINF:4.000,
/channel/test_aes_hls/360p/1555932977408.ts
#EXT-X-KEY:METHOD=AES-128,URI="http://127.0.0.1:23001/aes/test_aes_hls",IV=0x00000000000000000000000000000007
#EXTINF:4.000,
/channel/test_aes_hls/360p/1555932981408.ts
#EXT-X-KEY:METHOD=AES-128,URI="http://127.0.0.1:23001/aes/test_aes_hls",IV=0x00000000000000000000000000000008
#EXTINF:6.240,
/channel/test_aes_hls/360p/1555932985408.ts
...
ImageResampler¶
Description¶
The module changes the color space, size, deinterlaces and trims the incoming video signal
Configuration¶
Option |
Description |
|---|---|
width |
width of output image (defaults to input width) |
height |
height of output image (defaults to input height) |
width16 |
width of output image (is automatically rounded down to a smaller integer with a multiplicity of 16 for hardware encoding) |
crop_left |
how many pixels to crop left (default is 0) |
crop_right |
how many pixels to crop right (default is 0) |
crop_top |
how many pixels to crop top (default is 0) |
crop_bottom |
how many pixels to crop botoom (default is 0) |
keep_dar |
keep DAR of input signal (default is 0, DAR will be recalculated taking into account the crop) |
try_delegate |
(no arguments) if there is no crop, and the parameters of the input image (height and aspect ratio) equal to the desired ones, it transfers the incoming packets further along the pipeline without changing. If this option is not specified, forcibly sets the square pixel |
deinterlace |
perform the elimination of interlace (default 0, linear interpolation, for better quality use the deinterlace option from the video filters) |
Example of usage¶
ImageResampler#resize_hd {
options {
deinterlace 1
width 768
height 576
keep_dar 0
crop_bottom 72
crop_top 72
crop_right 0
crop_left 0
}
}
If one of the width/height parameters is not specified, the second will be calculated automatically. For example, to remove black bars from a 4:3 format video, can be used the following configuration:
ImageResampler {
options {
height 576
crop_bottom 72
crop_top 72
}
}
If there’s need to slightly crop the video, saving the DAR of the incoming video, then can be used such configuration:
ImageResampler {
options {
height 576
crop_bottom 16
crop_top 16
crop_left 16
crop_right 16
keep_dar 1
}
}
Logger¶
Description¶
It outputs to the log of the program in text form a dump of all the MessageBase packages that it receives. The module is transparent, sends the same output as the input. It can be connected both as a transparent filter (which does nothing with the packets), and as a separate branch of the graph.
Configuration¶
Option |
Description |
|---|---|
tag |
The text string shown in the log line as the identifier of the logger |
module |
If there is no tag parameter, the suffix is used |
Example of usage¶
Logging module with the name Logger and encoder tag:
Logger {
tag encoder
}
Logging module with the name Logger#encoder and encoder tag:
Logger#encoder
Logging module with the name mylogger and encoder tag:
mylogger {
class Logger
tag encoder
}
M3U8Maker¶
Description¶
Generates master and media playlists for HTTP Live Streaming protocol. Must be placed after FileHlsSaver module in configuration.
Master playlist (manifest.m3u8) will be placed in FileHlsSaver docroot directory. Media playlists (manifest.m3u8) will be placed in the appropriate variant streams directories.
- test_channel (docroot directory)
|- manifest.m3u8 (master playlist)
|- 360p (directory for 360p variant stream)
|- |- manifest.m3u8 (media playlist for 360p media segments)
|- 480p (directory for 480p variant stream)
|- |- manifest.m3u8 (media playlist for 480p media segments)
Configuration¶
Option |
Description |
|---|---|
window_ms |
The size of the manifest window is limited to this value in ms (default are 30 seconds) |
delete_segments |
Boolean parameter to delete HLS media fragments from disk (default value is false) |
Example of usage¶
Simple usage
hlswriter {
...
FileHlsSaver {
fragmap "..."
docroot "..."
}
M3U8Maker {
window_ms 50000
delete_segments true
}
}
Usage with HlsWriter module
hlswriter {
...
}
hlsserver {
@hlswriter
HlsServer {
ip "0.0.0.0:22037"
listen 20
outdated 3600
}
}
playlist {
@hlswriter
M3U8Maker {
window_ms 50000
}
}
MpegTsServer¶
Description¶
The module receives HlsBundle messages and returns MPEG TS stream over HTTP.
Configuration¶
Option |
Description |
|---|---|
addr |
address of HTTP server |
listen |
Number of incoming connections supported in the backlog queue |
Example of usage¶
downstream {
Logger
SyncGop
HlsWriter {
segment_length 4
miss_allowed 2
quality {
id stream_480p
video v_stream_480p
audio a_b128000
}
}
}
mpegts {
HlsWriter
MpegTsServer {
addr 192.168.1.20:8058
}
}
Example of request to server
ffprobe http://192.168.1.20:8058/stream/stream_480p/
The query string to the server
http://<server address>/stream/<quality id>/
OrderPacket¶
Description¶
The module to synchronize the input streams for the timestamps jumps, taking into account the possible presence of gaps in them and random mixing of packets. The module guarantees the output of the ordering of media packets by DTS.
Configuration¶
OrderPacket {
region 1000 ; The size of the time neighborhood in ms in which random
; mixing of packets will be corrected (by default 1000)
}
Notes¶
The module uses a probabilistic shift detector: if n + 1 packets come with dts less than the last sent, then there was a shift back; n is the number of packets in the region interval. Streams on which the shift was detected is not transmitted further along the graph without synchronization. The synchronization process itself is started when shifts are detected on ALL input streams. Since there is left not a zero probability of wrong operation of the shift and lock detector then before FillGap there must be Timeout module in the streambuilder configuration
To prevent wrong operations from the stub it is recommended timeout parameter in FillGap it is recommended to do twice as much as the region parameter
Overlay¶
Description¶
A module for overlaying multiple video streams to a common bitmap. It allows to set the color of the raster and the offset of each video stream relative to the raster. Displacements can be specified as an integer or as a percentage of the size of the raster. If the value is negative, the offset is counted from the right lower edge. It is assumed that the video streams have the same framerate.
Configuration¶
Option |
Description |
|---|---|
width |
image width (rounds to 8) |
height |
image height (rounds to 8) |
background |
background color (default is black) |
streams |
names of video streams |
The overlaying occurs in the order specified in the configuration.
Example of usage¶
Overlay {
width 1200
height 752
background {
color 504060 ; rgb background color
}
streams {
first_videostream { ; name of first video stream
x 80 ; offset from the left edge of the image
y 10 ; offset from the top edge of the image
}
second_videostream {
x 18%
y 31%
}
; other streams
}
}
HTTP interface¶
set background color to RRGGBB (for example #FFFFFF)
GET /module/<module name>/setbackground?color=FFFFFF
get background color
GET /module/<module name>/getbgcolor
add video stream overlay
GET /module/<module name>/add?stream=<name>&x=<N>&y=<N>
change the video stream shifts
GET /module/<module name>/setshifts?stream=<name>&x=<N>&y=<N>
get the video stream shifts
GET /module/<module name>/getshifts?stream=<name>&x=<N>&y=<N>
delete video stream
GET /module/<module name>/remove?stream=<name>
PNGOverlay¶
Description¶
Module for applying png-pictures (including animated) to video packets. Supports image overlay with transparency. Allows to change the original size of the overlay image, if necessary. The module can be used, for example, when overlaying a logo.
Configuration¶
Option |
Description |
|---|---|
png_uri |
path to png file (required parameter) |
png_width |
image with (default is the original width) |
png_height |
image height (default is the original height) |
x_shift |
image x shift (default is 0). With a negative value, the shift is counted from the right edge. When specified in percentages, the shift will be made by a specified percentage of the width |
y_shift |
is similar to x_shift |
transparent |
overlay transparency flag (default is 1). 1 - with transparency, 0 - without |
animate |
the animation flag (default is 0). Indicates whether the picture is animated |
state |
overlay state on/off (default is on) |
If only one of the png_width or png_height parameters is specified, the second one will be calculated automatically so that the aspect ratio of the picture does not change. The values of x_shift/y_shift is recommended to be specified in percents, since shifts are made taking into account video SAR.
All dimensions and shifts are indicated in pixels (integer) or percents
Example of usage¶
PNGOverlay {
png_uri "/home/user/apng.png"
animate 1
png_width 100
png_height 100
x_shift 10.5%
y_shift -10%
}
To keep the proportions of the png picture, one of the parameters (png_width or png_height) can be set to negative value
HTTP interface¶
discard overlaying
GET /module/<module name>/off
swith on overlaying
GET /module/<module name>/on
get the state
GET /module/<module name>/getstate
change position
GET /module/<module name>/setshifts?x=<N>&y=<N>
get current position
GET /module/<module name>/getshifts
change sizes
GET /module/<module name>/setsize?x=<N>&y=<N>
get sizes
GET /module/<module name>/getsize
PbReader¶
Description¶
Receives messages with raw byte blocks in the google protobuf format, decodes them and sends further to graph media messages.
Configuration¶
no
PbWriter¶
Description¶
Receives the media objects, serializes them to the google protobuf format and sends them further to graph as byte arrays (messages).
Configuration¶
no
PicDemuxer¶
Description¶
The module generates a video stream from the specified image.
Configuration¶
Option |
Description |
|---|---|
uri |
source image in the standard libavformat (required parameter) |
fpsnum |
numerator of fraction fps (default is 25) |
fpsden |
denominator of fractions fps (default 1) |
time |
videostream time (default - infinity) |
Example of usage¶
PicDemuxer {
uri "/home/user/Yoda.png"
fpsnum 30000
fpsden 1001
time 30
}
SceneDetector¶
Description¶
Scene change detection module.
Configuration¶
Option |
Description |
|---|---|
al |
determination algorithm |
k |
threshold value [0..255] |
min |
threshold for detecting a static (slowly varying picture) |
width |
the height of the picture that can be requested from the server (reflects the current scene) |
height |
the width of the picture that can be requested from the server (reflects the current scene) |
Height and width can be omitted, in which case the dimensions of the incoming frame will be used.
Example of usage¶
SceneDetect {
@prevideo
SceneDetector#1 {
options {
al "mafd"
k 10
min 0.01
width 320
height 240
}
}
}
HTTP interface¶
*GET /module/SceneDetector/status*
Status request
curl http://127.0.0.1:2222/module/SceneDetector%231/status
The results are:
“Ok” - is a normal signal (the picture changes),
“static” - is a static scene (slowly changing, for example a stadium),
“freeze” - the image is frozen on the screen with a static background
*GET /module/SceneDetector/pic*
Request an image of the current scene in JPG format:
curl http://127.0.0.1:2222/module/SceneDetector%231/pic
*GET /module/SceneDetector/channel*
Request channel name:
curl http://127.0.0.1:2222/module/SceneDetector%231/channel
ScheduledBlackout¶
Description¶
Module for stream blackout on a schedule in XML-TV format.
Configuration¶
Option |
Description |
|---|---|
plug |
path to the file to be used instead of the stream (default is black screen) |
xml_url |
uri to get schedule in XML-TV format |
request_freq |
time interval to request schedule in XML-TV format (seconds) |
Example of usage¶
ScheduledBlackout {
request_freq 300 ; 5 minutes
xml "https://0.0.0.0:4443/xmltv_blackout.xml"
plug "/usr/local/etc/bread.ts"
}
HTTP interface¶
Request to get blackout state
*GET /module/ScheduledBlackout/status*
Manual blackout start
*GET /module/ScheduledBlackout/on*
Manual blackout stop
*GET /module/ScheduledBlackout/off*
SDecoder¶
Description¶
The subtitles decoding module. Receives the encoded subtitles and gives out the decoded ones.
Configuration¶
Option |
Description |
|---|---|
lang |
the subtitles language for decoding in the lng#N format, where lng is the ISO 639-2 language entry, N is the language number (all languages are by default decoded). |
txt_duration |
the duration of the subtitles in milliseconds (default is 5000, for teletext) |
txt_format |
decode subtitles into text or image, possible values are text and bitmap (by default bitmap, for teletext) |
txt_transparent |
transparency of the subtitles background (default is false, for teletext) |
Example of usage¶
SDecoder {
lang swe#1
txt_format text
txt_duration 2000
txt_transparent 1
}
Shaper¶
Description¶
Module to ensure that media packets do not pass through faster than in real time.
Configuration¶
Option |
Description |
|---|---|
period |
correction period in seconds |
ShiftTimestamps¶
Description¶
Shifts timestamps in the stream to the specified value.
Configuration¶
Option |
Description |
|---|---|
offset |
The amount of time-shifts in microseconds, if not specified, will be calculated so that the timestamps start from zero |
SocketReader¶
Description¶
Establishes a connection to the tcp server at the specified address and receives data from there, which then in the form of DumbData packages transfers further on the graph.
Configuration¶
Option |
Description |
|---|---|
address |
tcp-server address to connect to. In the absence of this parameter, reading is performed from the file descriptor 0, and all the parameters listed below do not matter. Added the ability to connect to the http server. |
bind |
from which interface and port to connect |
timeout |
specifies the timeout for inactivity of incoming data, after which the connection is broken and the object is destroyed |
SubOverlay¶
Description¶
Module for overlaying subtitles on the video stream. Supports subtitles in the form of text and pictures. Allows to change the position, size and style.
Configuration¶
Option |
Description |
|---|---|
shift_x |
move the subtitles by x pixels up, can take negative values |
shift_y |
move the subtitles by y pixels left, can take negative values |
scale_w |
stretch the width of the subtitles |
scale_h |
stretch the height of the subtitles |
force_style |
forced string style in ASS format |
teletext |
flag, sets the correct location of the subtitles in the case of a teletext overlay picture |
Example of usage¶
filtervideo {
@source
FilterStream#Demuxer.v.0
VDecoder#Demuxer.v.0
@overlay
}
filtersub {
@source
FilterStream#Demuxer.s.0 {
lang rus#2
txt_format text
}
@overlay
}
overlay {
SubOverlay {
force_style "Fontname=Comic Sans MS,Fontsize=28,Italic=1,Angle=10"
scale_w 1.5
scale_h 1.5
shift_x -50
shift_y -200
}
}
SyncGop¶
Description¶
The module is designed to receive input MediaPkt and merge them from all incoming media streams into the combined GopSlice object. The combined object contains a set of all media packets within a single GOP. Includes audio with times that are within the given GOP. The GopSlice object is passed to graph for further saving in HLS or HDS format.
Configuration¶
Example of usage¶
downstream {
SyncGop
HlsWriter {
...
}
FileHlsSaver {
...
}
M3U8Maker
}
SyncStreams¶
Description¶
The module for synchronization of media packets passing through it.
Configuration¶
Option |
Description |
|---|---|
state |
the state of the module “on” or “off” (default is “off”) |
HTTP interface¶
Module state request
*GET /module/SyncStreams/status*
Set module state to “on”
*GET /module/SyncStreams/on*
Set module state to “off”
*GET /module/SyncStreams/off*
Timeout¶
VDecoder¶
Description¶
Module to decode incoming encoded video packets. Outputs the raw video packets.
Configuration¶
no
VEncoder¶
Description¶
Gets raw video packets on the input and encodes them, transmitting encoded packets further on the graph.
Configuration¶
Option |
Description |
|---|---|
codec |
the codec name as in the libavcodec |
options |
enccoding options in the libavcodec standard |
VideoFilters¶
Description¶
The module implements ffmpeg video filters, while combining the syntax accepted in ffmpeg and configuration file options.
Configuration¶
Option |
Description |
|---|---|
sar |
aspect ratio of the output image pixels, a line of the form “X:Y” (default is 1:1), the original aspect can be saved by specifying “source” |
width |
the width of the output image (by default equals to the width of the incoming image) |
height |
the height of the output image (by default equals to the height of the incoming image) |
interl |
produces a resize, counting the incoming signal as interlaced (by default it depends on the properties of incoming frames) |
algorithm |
what algorithm to use for resizing (by default bicubic) |
width16 |
(no args) the width of the output image (after recalculation) will be automatically rounded down to a smaller integer with a multiplicity of 16 (hardware encoding limitation) |
crop_left |
how many pixels to crop left (default 0) |
crop_right |
how many pixels to crop right (default 0) |
crop_top |
how many pixels to crop top (default 0) |
crop_bottom |
how many pixels to crop bottom (default 0) |
keep_dar |
save the DAR of the original signal (default is 0, DAR will be recalculated taking the crops into account) |
deinterlace |
description of the deinterlacing filter (default is an empty string) |
fps |
change the frame rate of the stream (default is an empty string) |
colorspace |
change the color space of the stream (by default yuv420p) |
filter |
a string with a filters description (by default, an empty string) |
Example of usage¶
VideoFilters {
options {
deinterlace yadif
sar 16:11
crop_bottom 72
crop_top 72
height 576
algorithm fast_bilinear
keep_dar
filter "hue=h=90:s=1, histeq=strength=0.5:intensity=0.5"
fps 25
}
}