Live Streams Recording
Prepare the source streams
The streams in the MPEG2-TS container delivered by one of the following protocols can be used as the source streams for the SmartMEDIA server:
- UDP over IP Multicast (without RTP encapsulation);
- HTTP Stream (SmartMEDIA acts as an HTTP client);
- HLS according to draft-pantos-http-live-streaming-07, without encryption.
If you do not have streams that meet these requirements, you can create test streams in any available way:
- Broadcast an existing TS file using the tsplay utility (included in the tstools package).
For example: tsplay -loop test.ts 239.65.9.1:5000 - Broadcast a static image using ffmpeg.
For example: ffmpeg -loop 1 -i teaser_1920x1080.jpg -f lavfi -i “sine=frequency=1000” -c:v libx264 -pix_fmt yuv420p -b:v 1000k -g 75 -r 25 -c:a aac -ac 2 -ar 48000 -ab 128k -f mpegts “udp://@239.65.9.13:5000?pkt_size=1316&buffer_size=131070&reuse=1&ttl=10” - Broadcast existent TS file using the service smartMPicker.
- Any other way you prefer.
Ways to Configure the Channel Recording
Channel recording with the SmartMEDIA Conveyor service can be set up in two ways: via JSON configuration files or web-based console. This article explains the simple setup of recording via configuration files. For a description of the configuration via the console, see here.
Determine the storage type and make the appropriate settings
Local POSIX Storage
POSIX storage should be available on the SmartMEDIA Conveyor server as a local mount point. The /video directory is a standard directory for the SmartMEDIA Conveyor server used in the basic configuration.
In the main Conveyor service configuration file, add the POSIX storage section (the configuration for /video is already present in the basic configuration) to the data_storages section:
{ “data_storages”: [ { “id”:“fs_hdd”, “fs”: { “path”:“/video” } }, { “id”:“fs_tmpfs”, “fs”: { “path”:“/video-tmpfs” } } ] } |
Object Storage with Access Using S3 protocol
You will need to find out the following information for configuration:
- storage HTTP URL,
- bucket identifier,
- the access key,
- the access key identifier.
In the main Conveyor service configuration file, add the S3 storage section to the data_storages section:
{ “data_storages”: [ { “id”:“s3”, “s3”: { “host”:“192.168.2.12:8080”, “bucket”:“test”, “access_key_id”:“60ZXGDH7Z8L2K86L6AJ3”, “access_key”:“Bnc19iicY61Lc8Y9x3zbqB7FmW89EokGCJ3p9FrO”, “authorization_version”:“v4”, “max_connections”:50 } } ] } |
Make other settings for the service
If you plan to use the encryption, add the drms section with the DRM-specific configurations in the main Conveyor configuration file:
{ “drms”: [ { “id”:“verimatrix”, “verimatrix”: { “address”:“192.168.32.32”, “port”:12684, “key_update_period_sec”:1800 } }, { “id”:“widevine_test”, “cenc”: { “url”:“http://10.10.10.10/cenc/getkey”, “signer_name”:“conveyor”, “signer_key”:“1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9”, “signer_iv”:“d58ce954203b7c9a9a9d467f59839249”, “crypto_period_length”:0, “crypto_period_count”:0, “key_server_type”:“udrm” } } ] } |
Define a channel and configure the basic properties of the channel
In the Conveyor channel configuration file, in the channels section, add the channel element:
{ “id”:“CH_TEST1”, “container_type”:“mp4”, “index_storage”:“mongo_local”, “data_storages”: [ “fs_hdd” ], “recording_window”:“1d” } |
Set the source for the recording channel
In the Conveyor channel configuration file, add the sources and demuxers sections to the configuration of the created channel:
{ “sources”: [ { “id”:“ts_multicast_1”, “url”:“udp://239.255.0.55:1136” } ], “demuxers”: [ { “id”:“dmx1”, “source”:“ts_multicast_1”, “tracks”: [ “vid0”, “aud0”, “aud1” ] } ] } |
Set the transcoding of incoming streams (if necessary)
To support transcoding, the Conveyor or SmartTranscoder services must be installed on equipment supporting the Intel QSV technology, and the Nvidia NVENC technology for the SmartNvidiaTranscoder service. For details, see “Requirements for transcoding servers“. |
In the Conveyor channel configuration file , add video_transcoders and audio_transcoders sections to the channel:
{ “video_transcoders”: [ { “id”:“vtrc”, “source”:“dmx1:vid0”, “use_qsv”:true, “out”: [ { “bitrate”:“2800K”, “gop_size”:“60”, “width”:“1280”, “height”:“720” }, { “bitrate”:“2200k”, “gop_size”:“60”, “width”:“1280”, “height”:“720” }, { “bitrate”:“1300k”, “gop_size”:“60”, “width”:“720”, “height”:“576” } ] } ], “audio_transcoders”: [ { “id”:“atrc_eng”, “source”:“dmx1:aud0”, “out”: [ { “bitrate”:“384k” } ] }, { “id”:“atrc_afr”, “source”:“dmx1:aud1”, “out”: [ { “bitrate”:“128k” } ] } ] } |
To use the SmartTranscoder service add its configuration to the network_transcoders section of the channel. Afterwards set the appropriate transcoder ID with the net_trc option:
{ “network_transcoders”: [ { “id”:“QSV_SERVER_1_56”, “host”:“192.168.1.56”, “port”:7783 } ], “video_transcoders”: [ { “id”:“vtrc”, “source”:“dmx1:vid0”, “use_qsv”:true, “net_trc”:“QSV_SERVER_1_56”, “out”: [ { “bitrate”:“2800K”, “gop_size”:“60”, “width”:“1280”, “height”:“720” }, { “bitrate”:“2200k”, “gop_size”:“60”, “width”:“1280”, “height”:“720” }, { “bitrate”:“1300k”, “gop_size”:“60”, “width”:“720”, “height”:“576” } ] } ] } |
Configure the stream recording
In the Conveyor channel configuration file, add the muxers section to the channel:
{ “muxers”: [ { “bw”:“3000000”, “dir”:“video/bw3000000”, “sources”: [ { “master”:“true”, “source”:“vtrc:vid0” } ] }, { “bw”:“2200000”, “dir”:“video/bw2200000”, “sources”: [ { “source”:“vtrc:vid1” } ] }, { “bw”:“1300000”, “dir”:“video/bw1300000”, “sources”: [ { “source”:“vtrc:vid2” } ] }, { “bw”:“384000”, “dir”:“audio/eng/aac”, “lang”:“en”, “sources”: [ { “source”:“atrc_eng:aud0” } ] }, { “bw”:“128000”, “dir”:“audio/afr/aac”, “lang”:“af”, “sources”: [ { “source”:“atrc_afr:aud0” } ] } ] } |
Configure the encryption (if necessary)
In the Conveyor channel configuration file in the channel muxers section, add the encryptor section:
{ “encryptor”: { “drm”:“widevine_test” } } |
Check out the result
If you use the MP4 container, the recorded content will be available as DASH and as HLS with the mp4 container. The URL for the channel playback in this case will look like:
- for DASH: http://streamer1.example.com/dash/CH_TEST1/playlist.mpd
- for HLS: http://streamer1.example.com/hls/CH_TEST1/master.m3u8
When using the MPEG2 TS container, the recorded content will be available only as HLS: http://streamer1.example.com/hls/CH_TEST_TS/variant.m3u8
You can check the playback on any player supporting the corresponding protocol. For example:
- for DASH — Shaka Player (https://shaka-player-demo.appspot.com/demo/). Please note that the security settings of modern browsers do not allow the use of HTTP and HTTPS on the same page at the same time, therefore, the channel playback via HTTP or with an untrusted / expired certificate may not be available without additional browser settings;
- for HLS — http://osmfhls.kutu.ru/ or any Apple device (iPad, iPhone, Mac). To play a channel on Apple devices, just open its URL in the Safari browser.