Upload
voxuyen
View
226
Download
2
Embed Size (px)
Citation preview
© Copyright 2015 All Rights Reserved
Subject to Change without prior notice www.evostream.com
EvoStream Media Server
HOW TO V1.00
EvoStream Media Server
+1 858-454-9393
Page 1 of 27
www.acs.com.hk
Table Of Contents
I. Document Definitions ....................................................................... 3
II. Purpose .............................................................................................. 5
III. Recommended Players ..................................................................... 6
IV. Using the API ..................................................................................... 7
1. ASCII ..................................................................................................................................... 7
2. ASCII CLI ............................................................................................................................... 8
3. HTTP ..................................................................................................................................... 9
V. Adding Live Streams to EvoStream Media Server....................... 11
1. Pull Stream .......................................................................................................................... 11
2. Push In ................................................................................................................................ 12
VI. Playing/Retrieving Live Streams.................................................... 15
1. RTMP .................................................................................................................................. 15
2. RTSP ................................................................................................................................... 15
VII. Adaptive Bitrate Streaming ............................................................ 16
1. HTTP Live Streaming (HLS) ................................................................................................. 16
2. HTTP Dynamic Streaming (HDS) ......................................................................................... 17
3. Microsoft Smooth Streaming (MSS) ..................................................................................... 17
4. Dynamic Adaptive Streaming over HTTP (DASH) ................................................................. 18
5. Web Sockets ........................................................................................................................ 19
6. webRTC (Real Time Communication) .................................................................................. 21
VIII. Video On Demand ....................................................................... 22
1. RTMP .................................................................................................................................. 22
2. RTSP with RTP or MPEG-TS ............................................................................................... 23
3. HLS VOD Work Around........................................................................................................ 23
IX. Recording Streams .......................................................................... 25
X. Stopping Streams ............................................................................ 26
1. Stopping a Stream ............................................................................................................... 26
2. Stopping a Recording ........................................................................................................... 26
XI. Transcoding ..................................................................................... 27
EvoStream Media Server
+1 858-454-9393
Page 2 of 27
www.acs.com.hk
List of Figures
Figure 1 : Turning Telnet Feature On.............................................................................................. 7
Figure 2 : EMS WebSocket Demo Page ....................................................................................... 20
Figure 3 : Streaming via EMS WebSocket .................................................................................... 20
Figure 4 : Streaming via EMS webRTC ........................................................................................ 21
List of Tables
Table 1. Definition of Terms ......................................................................................................... 4
Table 2. Recommended Players .................................................................................................. 6
Table 3. VOD File Type to URI Value ......................................................................................... 22
EvoStream Media Server
+1 858-454-9393
Page 3 of 27
www.acs.com.hk
I. Document Definitions
TERM DEFINITION
API Application Programming Interface
ASCII American Standard Code for Information Interchange
DASH Dynamic Adaptive Streaming over HTTP
EMS EvoStream Media Server
ERS EvoStream Rendezvous Server
EWS EvoStream Web Server
FLV Flash Video
HDS HTTP Dynamic Streaming
HLS HTTP Live Streaming
HTTP Hypertext Transfer Protocol
IDR
Instantaneous Decoding Refresh - This is a specific packet in the H.264 video encoding specification. It is a full snapshot of the video at a specific instance (one full frame). Video players require an IDR frame to start playing any video. “Frames” that occur between IDR Frames are simply offsets/differences from the first IDR.
IIS Internet Information Services
JSON JavaScript Object Notation
lua A lightweight multi-paradigm programming language
MOV MPEG 4 video container file format used in Apple's QuickTime program
MPEG Moving Picture Experts Group
MPEG-TS MPEG Transport Stream
MP4 A digital multimedia format most commonly used to store video and audio
MSS Microsoft Smooth Streaming
OSMF Open Source Media Framework
RTCP Real Time Control Protocol - An protocol that is typically used with RTSP to synchronize two RTP streams, often audio and video streams
RTMP Real Time Messaging Protocol - Used with Adobe Flash players
RTMPT Real Time Messaging Protocol Tunneled - Essentially RTMP over HTTP
EvoStream Media Server
+1 858-454-9393
Page 4 of 27
www.acs.com.hk
RTP Real Time Protocol - A simple protocol used to stream data, typically audio or video data.
RTSP
Real Time Streaming Protocol - Used with Android devices and live streaming clients like VLC or QuickTime. RTSP does not actually transport the audio/video data; it is simply a negotiation protocol. It is normally paired with a protocol like RTP, which will handle the actual data transport.
swfURL Used in the RTMP protocol, this field is used to designate the URL/address of the Adobe Flash Applet being used to generate the stream (if any).
tcURL Used in the RTMP protocol, this field is used to designate the URL/address of the originating stream server.
URI Universal Resource Identifier. The generic form of a “URL”. URI’s are used to specify the location and type of streams.
VOD Video On Demand
Table 1. Definition of Terms
EvoStream Media Server
+1 858-454-9393
Page 5 of 27
www.acs.com.hk
II. Purpose
This document is intended for Engineers and System Integrators. It provides descriptions of common EvoStream Media Server (EMS) functionality as well as example commands to achieve that functionality.
It augments the EMS Application Programming Interface (API) Definition document. Familiarization with EMS API is recommended before proceeding with this How To document.
The sample commands provided in this document refer to API calls that can be made to either the ASCII (telnet) or the HTTP interfaces. These example commands can be copied and modified to meet the project’s needs.
Please see the EMS API Definition document for instructions on using the ASCII or HTTP interfaces, further descriptions of these commands and for optional function parameters not used in the preceding examples.
EvoStream Media Server
+1 858-454-9393
Page 6 of 27
www.acs.com.hk
III. Recommended Players
Any players that natively support the target protocol will work with EMS.
Below are the recommend players for the following protocols and delivery formats that are compatible with EMS.
Protocol / Delivery Format Recommended Players
RTMP Any Flash Based Player (JW Player, Flow player) or Flash Media
Player
RTSP QuickTime, VLC and Android native players
HLS Safari
HDS OSMF based players (Strobe Media)
DASH Any DASH player (bitdash)
MSS Smooth Streaming Health Monitor
(http://smf.cloudapp.net/Healthmonitor)
MPEG-TS QuickTime, VLC
Table 2. Recommended Players
EvoStream Media Server
+1 858-454-9393
Page 7 of 27
www.acs.com.hk
telnet localhost 1112
IV. Using the API
The EMS API provides return responses from most of the API functions. These responses are formatted in JSON so that they can be easily parsed and used by third party systems and applications. These responses will be identical, regardless of what interface is used.
The EMS API functions parameters are NOT case sensitive.
The EMS API can be accessed in three ways:
1. ASCII
The ASCII interface is often the first interface used by users. It can be accessed easily through the telnet application (available on all operating systems) or through common scripting languages.
To access the API via the telnet interface, a telnet application will need to be launched on the same computer that the EMS is running on. The command to open telnet from a command prompt should look something like the following:
Note:
Telnet may need to be enabled using Windows® operating systems. To do this, go to the Control Panel -> Programs -> Turn Windows Features on and off. Turn the Telnet Client program on.
Figure 1 : Turning Telnet Feature On
Please also note that on Windows®, the default telnet behavior will need to be changed. The local echo and new line mode should be set for proper behavior. Once telnet is launched, exit the telnet session by typing “ctrl+]”. Then enter the following commands:
set localecho
set crlf
EvoStream Media Server
+1 858-454-9393
Page 8 of 27
www.acs.com.hk
telnet localhost 1222
To return to the Windows® telnet session, press Enter/Return key.
Once the telnet session is established, type out the desired commands which will be immediately executed on the server after the Enter/Return key is pressed.
An example of a command request and response from a telnet session would be the following:
Request version
Response ☺«{"data":{"banner":"EvoStream Media Server (www.evostream.com) version 1.7.0. build 4153 with hash: c50ee04ec98886ed1f54d599355e04346bf50df0 on branch: develop - PacMan|m|-(built on 2015-11-03T01:50:37.000)","branchName":"develop","buildDate":1446515437,"buildNumber":"4153","codeName":"PacMan|m|","hash":"c50ee04ec98886ed1f54d599355e04346bf50df0","releaseNumber":"1.7.0."},"description":"Version","status":"SUCCESS"}
JSON
When using the regular ASCII interface, it may be necessary to use a JSON interpreter so that responses can be more human-readable. JSON parsers are available online.
2. ASCII CLI
This is the user friendly version of the ASCII telnet interface. It offers a readable response without having to parse the JSON results. To access this interface from the command prompt, execute the following:
However, since the objective of this interface is simplicity, there are some parameters that are not included on the display. Thus, for advanced usages and/or configurations, it is better to use the regular ASCII telnet interface.
An example of a command request and response from an ASCLII CLI telnet session would be the following:
Request version
Response Command entered successfully! Version banner: EvoStream Media Server (www.evostream.com) version 1.7.0. build 4153 with hash: 4ab5d9145ae3b4b3dfeb3af5ce6890f015824974 on branch: develop - PacMan|m| - (built on 2015-11-06T08:24:32.000) buildDate: 2015-11-03T01:50:37.000 buildNumber: 4153 codeName: PacMan|m| releaseNumber: 1.7.0.
EvoStream Media Server
+1 858-454-9393
Page 9 of 27
www.acs.com.hk
http://IP:7777/[API]?params=([base64 encoded parameters])
(firstParam=XXX secondParam=YYY…)
(uri=rtsp://localhost:5544/vod/mp4.bunny.mp4 localStreamName=bunny)
http://[EMS IP]:7777/[API]
3. HTTP
To access the API via the HTTP interface, simply make an HTTP request on the server using any browser with the command to be executed. By default, the port used for these HTTP requests is 7777. The HTTP interface port can be changed in the main configuration file used by the EMS (config.lua).
A general http format request would be the following:
An example of a command request and response from an HTTP session would be the following:
All of the API functions are available via HTTP, but the request must be formatted slightly different if parameters are included. To make an API call over HTTP, the parameters to be used should be in base64 format.
Sampling a pullstream command:
1. Type in the parameters first:
2. Convert the parameters using a base64 encoder:
Converted parameter: dXJpPXJ0c3A6Ly9sb2NhbGhvc3Q6NTU0NC92b2QvbXA0LmJ1bm55Lm1wNCBsb2NhbHN0cmVhbW5hbWU9YnVubnkp
3. The corresponding request in HTTP format would be:
Base64
A group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. There are available base64 encoders online to get the encoded result.
Request http://localhost:7777/version
Response {"data":{"banner":"EvoStream Media Server (www.evostream.com) version 1.7.0. build 4153 with hash: 4ab5d9145ae3b4b3dfeb3af5ce6890f015824974 on branch: develop - PacMan|m| - (built on 2015-11-06T08:24:32.000)","branchName":"develop","buildDate":"2015-11-06T08:24:32.000","buildNumber":"4176","codeName":"PacMan|m|","hash":"4ab5d9145ae3b4b3dfeb3af5ce6890f015824974","releaseNumber":"1.7.0."},"description":"Version","status":"SUCCESS"}
http://localhost:7777/pullstream?params= dXJpPXJ0c3A6Ly9sb2NhbGhvc3Q6NTU0NC92b2QvbXA0LmJ1bm55Lm1wNCBsb2NhbHN0cmVhbW5hbWU9YnVubnkp
EvoStream Media Server
+1 858-454-9393
Page 10 of 27
www.acs.com.hk
PHP and JavaScript
PHP and JavaScript functions are also provided. These functions simply wrap the HTTP interface calls and can be found in the EMS Web UI directory.
EvoStream Media Server
+1 858-454-9393
Page 11 of 27
www.acs.com.hk
V. Adding Live Streams to EvoStream Media Server
The EMS provides an extremely robust platform for stream protocol re-encapsulation. That is, the EMS will allow the translation from one streaming protocol to another protocol, allowing the reach to a wide range of video/audio clients, regardless of how the video/audio source is configured.
The first step to achieve protocol re-encapsulation is to get the original stream into the EMS. The most common method for doing this is by using the “Pull Stream” mechanism, but other systems can also push a stream into the EMS.
1. Pull Stream
The pullStream API provides a way to tell the EMS to retrieve an existing stream.
RTMP
RTSP
RTP - UDP
MPEG-TS
For UDP MPEG-TS streams, use:
This can be used for multicast streams as well. If the address of the stream is in the IP Multicast range, the EMS will automatically join the multicast group so that it can pull the stream.
For TCP MPEG-TS streams, use:
Note:
The “d” in front of mpegts (dmpegts) in the URIs above refers to “deep parsing”. Using the URI, the inbound MPEG-TS stream can be re-encapsulated into other protocols such RTMP or RTSP. If the only output format will be MPEG-TS (e.g. EMS is used as an MPEG-TS pass-through), then mpegtsudp and mpegtstcp can be used as the URI protocol specifier. This will speed the transfer of the MPEG-TS streams since no parsing will occur.
pullStream uri=rtmp://Adddress/Of/Stream localStreamName=RTMPTest
pullStream uri=rtsp://Adddress/Of/Stream localStreamName=RTSPTest
pullStream uri=rtp://Adddress/Of/Stream localStreamName=RTPTest isAudio=0 spsBytes=Z0LAHpZiA2P8vCAAAAMAIAAABgHixck= ppsBytes=aMuMsg==
pullStream uri=dmpegtsudp://Adddress.Of.Stream:Port localStreamName=TSTest
pullStream uri=dmpegtstcp://Adddress.Of.Stream:Port localStreamName=TSTest
EvoStream Media Server
+1 858-454-9393
Page 12 of 27
www.acs.com.hk
2. Push In
EMS is capable of receiving streams that are pushed to it from other servers. An RTMP listener is available on port 1935, an RTSP listener on 5544 and a LiveFLV listener on port 6666.
Steps on how to do the actual stream push needs to be consulted with the stream source, as every system has different ways of accomplishing this.
General format of pushStream command in EMS:
RTMP
RTSP
MPEG-TS
MPEG-TS streams, in general, don’t have the concept of a stream identifier (name). The EMS will assign a name to an inbound MPEG-TS stream for internal uses, but outside of the EMS, that name is not used. To obtain an MPEG-TS stream from the EMS, it must be first pushed out to the network.
An example command to do this are:
If the UDP destination address is in the multicast range, the pushed stream will be a multicast stream.
Push-In Authentication
For security, EMS has an option to require all streams which are pushed into the server be authenticated using authentication details that are specified in config.lua and users.lua. By default, the authentication configuration is disabled.
To enable authentication in the EMS the following should be set:
Note:
All documents can be found inside the ../config folder
1. Set the boolean value in auth.xml to true
pushStream uri=rtmp://DestinationAddress localStreamName=SomeLocalStreamName
pushStream uri=rtsp://DestinationAddress:port localStreamName=SomeLocalStreamName
pushStream uri=mpegtsudp://DestinationAddr localStreamName=SomeLocalStream
pushStream uri=mpegtstcp://DestinationAddr localStreamName=SomeStream
<?xml version="1.0" ?>
<BOOL name="">true</BOOL>
EvoStream Media Server
+1 858-454-9393
Page 13 of 27
www.acs.com.hk
2. Remove comments (--[[ ]]--) in authentication in config.lua
Play authentication
The authenticatePlay functionality works only with RTSP sources. If set to true, it will prompt for a username and password window when stream is requested for playback.
3. Add users in users.lua
The configurations in the users.lua will serve as the username and password that needs to be inputted in the authentication window if authenticatePlay is set to true.
Note:
Multiple users may add in this section. Just add entries under each user entry.
--[[ //remove authentication = {
rtmp= {
type="adobe", encoderAgents= { "FMLE/3.0 (compatible; FMSc/1.0)", "Wirecast/FM 1.0 (compatible; FMSc/1.0)", "EvoStream Media Server (www.evostream.com)" }, usersFile="..\\config\\users.lua" }, rtsp= { usersFile="..\\config\\users.lua", --authenticatePlay=false, } ]]-- //remove },
users= { USER_A="12345678", } realms= { { name="EVOSTREAM stream router", method="Digest", users={ "USER_A", }, }, }},
EvoStream Media Server
+1 858-454-9393
Page 14 of 27
www.acs.com.hk
users= { USER_A="12345678", USER_B="87654321", } realms= { { name="EVOSTREAM stream router", method="Digest", users={ "USER_A", "USER_B", }, }, }},
EvoStream Media Server
+1 858-454-9393
Page 15 of 27
www.acs.com.hk
VI. Playing/Retrieving Live Streams
Once a stream has been added to EMS, it can be accessed in a variety of ways. Through the streaming protocol translation offered by EMS, it is just a matter of requesting the stream in the format that the target player can accept, and the EMS will take care of the rest.
The localStreamName that was provided in the pullStream command (or that was pushed to the EMS) is used to identify the stream that will be played or retrieved.
The basic commands in playing streams in EMS are the following:
1. RTMP
The format of the RTMP URI is as follows:
As an example, to play an RTMP stream, use the following URI in the Flash enabled player:
2. RTSP
The format of the RTSP URI is as follows:
Note:
The command is very similar to RTMP, except for the absence of the “appName” field.
As an example, to play an RTSP stream, the following URI in an RTSP enabled player can be used:
By default, the EMS will send the video/audio payload data via RTP. If MPEG-TS is needed instead, simply specify it in the request URI:
rtmp[t|s]://[username[:password]@]ip[:port]/<appName>/<stream_name>
rtmp://Address.Of.EMS/live/localStreamName
rtsp://[username[:password]@]ip[:port]/[ts|vod|vodts]/<stream_name or MP4 file name>
rtsp://Address.Of.EMS:5544/localStreamName
rtsp://Address.Of.EMS:5544/ts/localStreamName
EvoStream Media Server
+1 858-454-9393
Page 16 of 27
www.acs.com.hk
VII. Adaptive Bitrate Streaming
Adaptive bitrate streaming requires files to be generated from a live stream. Because of this, HLS, HDS, MSS, DASH streams must be started within the EMS before they can be accessed.
These files must be written into the ..//evo-webroot folder which is the native webserver of EMS.
Note:
User may still opt to use other web root such as Apache or Internet Information Services (IIS).
1. HTTP Live Streaming (HLS)
Creating HLS Stream
From the local streams in EMS, issue the createHLSStream command:
To use multiple localStreamNames using one createHLSStream command do the following:
The created files will automatically save in the targetFolder path.
Playing HLS Playlist File
The corresponding link to use on Safari to pull this stream would then be:
This URL breaks down to: http:// My Web Server/HLS Group Name/Subfolder/playlist file name
createHLSStream localstreamnames=localStreamName targetfolder=[../webroot/path] groupname=[groupName_hls]
createHLSStream localstreamnames=localStreamNameA,localStreamNameB,localStreamNameC targetFolder=[../webroot/path] groupName=[groupName_hls]
..//evo-webroot
groupName_hls
-localStreamName
-segmentxx.ts
-playlist.m3u8 (childplaylist)
-playlist.m3u8 (masterplaylist)
http://Address.Of.EWS:8888/groupName_hls/playlist.m3u8
EvoStream Media Server
+1 858-454-9393
Page 17 of 27
www.acs.com.hk
2. HTTP Dynamic Streaming (HDS)
Creating HDS Stream
From the local streams in EMS, issue the createHDSStream command:
To use multiple localStreamNames using one createHDSStream command do the following:
The created files will automatically save in the targetFolder path.
Playing HDS Manifest File
The corresponding link to pull this stream would then be:
This URL breaks down to: http:// My Web Server/HDS Group Name/Subfolder/manifest file name
3. Microsoft Smooth Streaming (MSS)
Creating MSS Stream
From the local streams in EMS, issue the createMSSStream command:
createHDSStream localstreamnames=localStreamName targetfolder=[../webroot/path] groupname=[groupName_hds]
createHDSStream localstreamnames=localStreamNameA,localStreamNameB,localStreamNameC targetFolder=[../webroot/path] groupName=[groupName_hds]
..//evo-webroot
groupName_hds
-localStreamName
-bootstrap
-localStreamName.f4m
- f4vSegxx-Fragxx
- manifest.f4m
- manifest_v1.f4m
http://Address.Of.EWS:8888/groupName_hds/manifest.f4m
createMSSStream localstreamnames=localStreamName targetfolder=[../webroot/path] groupname=[groupName_mss]
EvoStream Media Server
+1 858-454-9393
Page 18 of 27
www.acs.com.hk
To use multiple localStreamNames using one createMSSStream command do the following:
The created files will automatically save in the targetFolder path.
Playing MSS Manifest File
The corresponding link to pull this stream would then be:
This URL breaks down to: http:// My Web Server / MSS Group Name / manifest file name
4. Dynamic Adaptive Streaming over HTTP (DASH)
Creating DASH Stream
From the local streams in EMS, issue the createDASHStream command:
To use multiple localStreamNames using one createDASHStream command do the following:
createMSSStream localstreamnames=localStreamNameA, localStreamNameB, localStreamNameC targetFolder=[../webroot/path] groupName=[groupName_mss]
..//evo-webroot
-groupName_mss
-0 (bitrate)
-audio
-xxxxxxxxxxxxx.fmp4
-video
-xxxxxxxxxxxxx.fmp4
-manifest.ismc
http://Address.Of.EWS:8888/groupName_mss/manifest.ismc
createDASHStream localstreamnames=localStreamName targetfolder=[../webroot/path] groupname=[groupName_dash]
createDASHStream localstreamnames=localStreamNameA, localStreamNameB, localStreamNameC targetFolder=[../webroot/path] groupName=[groupName_dash]
EvoStream Media Server
+1 858-454-9393
Page 19 of 27
www.acs.com.hk
The created files will automatically save in the targetFolder path.
Playing DASH Manifest File
The corresponding link to pull this stream would then be:
This URL breaks down to: http:// My Web Server / MSS Group Name / manifest file name
5. Web Sockets
By default, EMS accepts stream requests through web sockets and can be customized or disabled through the config.lua file.
A test page is included on the demo folder of the EMS to demonstrate this feature. Access the file demo/evowsvideo.html and adjust the URI address to the EWS port and stream name fields respectively:
Playing Videos Using Web Sockets
1. Open EMS WebSocket page in browser:
Parts of EvoStream WebSocket Video Demo Page:
WS URI: EMS IP Address : WebSocket port
Stream Name: localStreamName to be played
Play: Will start playback
Stop: Will stop playback
Show debug messages: Shows logs messages
..//evo-webroot
groupName_dash
-localStreamName
-audio
-0 (bitrate)
-seg_init.mp4
-segment_xx.m4s
-video
-0 (bitrate)
-seg_init.mp4
-segment_xx.m4s
-manifest.mpd
http://Address.Of.EWS:8888/groupName_dash/manifest.mpd
http://<web server IP>:port/demo/evowsvideo.html
EvoStream Media Server
+1 858-454-9393
Page 20 of 27
www.acs.com.hk
Figure 2 : EMS WebSocket Demo Page
2. Enter the EMS IP address and port where web socket is configured
3. Enter the localStreamName to be played
4. Press Play button
Figure 3 : Streaming via EMS WebSocket
EvoStream Media Server
+1 858-454-9393
Page 21 of 27
www.acs.com.hk
6. webRTC (Real Time Communication)
Playing Videos Using webRTC
1. To request streams from EMS using webRTC, the following command needs to be executed first on EMS:
Note:
Room name should be unique as possible when using the public ERS to prevent possible room name conflicts. If the room name is already taken, EMS would return an error on the console logs to indicate such scenario.
2. Access the test page demo/evowrtcclient.html and use the matching room ID and existing stream name on EMS as parameter to the request:
The video will play automatically once it has successfully connected with EMS.
Figure 4 : Streaming via EMS webRTC
startwebrtc ersip=52.6.14.61 ersport=3535 roomid=ThisIsATestRoomName
http://<web server IP>/demo/evowrtcclient.html?room= ThisIsATestRoomName&stream=test1
EvoStream Media Server
+1 858-454-9393
Page 22 of 27
www.acs.com.hk
VIII. Video On Demand
The first critical step to getting Video on Demand (VOD) working is to place all of the media files into the appropriate directory. By default that directory is the “media” folder in the main EMS folder. If a different folder is to be used for the media files, simply modify the config.lua file and change the “mediaPath” parameter with the new path.
1. RTMP
VOD to RTMP is handled automatically by EMS, simply provide the target player with the appropriate URI.
For Example:
The only trick is in the name of the file. The URI needs to be formatted depending on the file type. The following rules will need to be followed:
File Type URI Value
*.flv NameOfFile
*.mp4 mp4:NameOfFile.mp4
*.mov mp4:NameOfFile.mov
*.m4v mp4:NameOfFile.m4v
Table 3. VOD File Type to URI Value
Therefore, if the target file is “video1.flv”, the connection URI would be:
And if the target file is “video2.mov”, the connection URI would be:
It is also possible to have the media files in subdirectories of the main media file:
mediaStorage = {
recordedStreamsStorage="../media",
{
description="Default media storage",
mediaFolder="../media", (media folder directory)
},
rtmp://AdddressOfServer/vod/NameOfFile
rtmp://AdddressOfServer/vod/video1
rtmp://AdddressOfServer/vod/mp4:video2.mov
EvoStream Media Server
+1 858-454-9393
Page 23 of 27
www.acs.com.hk
rtsp://AdddressOfServer:5544/vodts/video2.mov
The EMS dynamically generates “Seek” and “Meta” which allow the client to “click around” in the video and play from any time-point in the video. Please note that if the original video file on the server is moved, the Seek and Meta files cannot be moved along with it. They use absolute file paths and must be deleted so that they can be regenerated for the video file again.
2. RTSP with RTP or MPEG-TS
VOD to RTSP is also handled automatically by the EMS, simply provide the target player with the appropriate URI.
For Example:
Since the FLV format is specifically designed for RTMP, FLV file playback for RTSP is not supported. Any MP4 file, however, can be played with RTSP. This simplifies the format for the VOD request:
It is also possible to have the media files in subdirectories of the main media file:
By default, the EMS will send the video/audio payload data via RTP. If MPEG-TS is needed instead, simply specify it in the request URI:
The EMS dynamically generates “Seek” and “Meta” which allow the client to “click around” in the video and play from any time-point in the video. Please note that if the original video file on the server is moved, the Seek and Meta files cannot be moved along with it. They use absolute file paths and must be deleted so that they can be regenerated for the video file again.
3. HLS VOD Work Around
HLS is not explicitly designed for traditional VOD. It is designed to take a live stream, convert it to small files, and then serve those files to iOS devices. iOS devices (such as iPhones and iPads) can already handle the download and play many audio and video files directly from online sources.
There is, however, a way to do VOD with HLS using the EMS. The trick is to create a live stream using RTMP first, and then use the new live stream for the HLS stream.
Following is an example set of commands:
rtmp://AdddressOfServer/vod/mp4:subFolder1/subFolder2/video2.mov
rtsp://AdddressOfServer:5544/vod/NameOfFile
rtsp://AdddressOfServer:5544/vod/video1.mp4
rtsp://AdddressOfServer:5544/vod/video2.mov
rtsp://AdddressOfServer:5544/vod/subFolder1/subFolder2/video2.mov
EvoStream Media Server
+1 858-454-9393
Page 24 of 27
www.acs.com.hk
The corresponding link to access this HLS stream would then be:
pullStream uri=rtmp://AdddressOfServer/vod/mp4:video2.mov keepAlive=1 localstreamname=DummyLive
createhlsstream localstreamnames=DummyLive bandwidths=128 targetfolder=/var/www/ groupname=hls playlisttype=rolling playlistLength=10 chunkLength=5
http://WebServer/hls/DummyLive/playlist.m3u8
EvoStream Media Server
+1 858-454-9393
Page 25 of 27
www.acs.com.hk
IX. Recording Streams
The EMS is able to record streams as MP4, FLV or MPEG Transport Stream (TS) files. Any incoming stream type can be recorded. Recording a stream can be done using the following steps:
1. Bring a new stream into the EMS. In this case we are pulling a new RTSP stream:
We now have a stream named RTSPTest in the server.
2. To record it, we issue the record command:
This will cause the EMS to record the source RTSP stream into an MP4 file. The file will be placed in the media folder of the EMS installation (as per the “../media” parameter value). The file will be named as: RTSPTest.mp4
Or in general, the format being followed is: localStreamName.type
Users may issue the record command before the desired stream is actually available, essentially queuing the recording. In other words, the previous two commands (pullstream, record) can be issued in reverse order and still achieve the same result.
pullStream uri=rtsp://Adddress/Of/Stream localStreamName=RTSPTest
record localstreamname=RTSPTest pathtofile=../media/ type=mp4
EvoStream Media Server
+1 858-454-9393
Page 26 of 27
www.acs.com.hk
X. Stopping Streams
There will likely come a time where stopping a stream is needed. There are two general types of streams: Inbound Streams and Outbound Streams. The convention being used for the direction is always from the perspective of the EMS. So therefore an Inbound Stream can also be considered a source stream.
Notes:
- Inbound Streams have both a localStreamName and an ID, whereas Outbound Streams have only an ID.
- Stopping an Inbound Stream will automatically shut down all associated Outbound Streams.
1. Stopping a Stream
There are two functions provided for stopping streams: shutdownStream and removeConfig
shutdownStream is intended for doing just what it says, shutting down a stream. By setting the permanently parameter to true, shutdownStream will also remove the configuration entry (if one exists) in the pullPushConfig.xml file.
removeConfig is intended to remove the entry in pullPushConfig.xml, but it will also stop the associated stream.
2. Stopping a Recording
A recorded stream is just like any other stream in the EMS, it is simply directed to a file instead of towards the network. Users may therefore use either of the normal shutdown stream commands to stop a recording. This will cause the recording of this stream to stop, which will close the file that is being written to. All data that had previously been recorded will remain stored in that file. If the stream had not yet been recorded (because a stream with that name was not yet available) then the recording will be canceled.
shutdownStream localstreamname=RTSPTest
shutdownStream id=5 permanently=0
removeConfig id=5
EvoStream Media Server
+1 858-454-9393
Page 27 of 27
www.acs.com.hk
XI. Transcoding
Transcoding with the EMS allows changing the resolution of a source stream, change the bitrate of a stream, change a VP8 or MPEG2 stream into H.264 and much more. It will also allow users to create overlays on the final stream as well as crop streams.
Note:
Transcoding requires SIGNIFICANT computing resources and will severely impact performance. A general conservative guideline is that to accomplish one transcoding job per CPU core for HD streams.
To transcode an RTMP source into different video bitrates and send back to EMS:
To transcode an existing EMS stream into a different audio channel count and send to an RTMP server:
To use files as input and/or output:
To stop a running transcoding process(es):
To force TCP for inbound RTSP:
transcode source=rtmp://<RTMP server>/live/streamname groupName=group videoBitrates=100k,200k,300k destinations=stream100,stream200,stream300
removeConfig groupName=group
transcode source=rtsp://<RTSP server>/live/streamname groupName=group videoBitrates=copy videoSizes=360x200 $EMS_RTSP_TRANSPORT=tcp
transcode source=stream1 groupName=group audioBitrates=copy audioChannelsCounts=1 destinations=rtmp://<RTMP server 2> targetStreamNames=streamMono
transcode source=file://C:\videos\test.mp4 groupName=group videoBitrates=100k audioBitrates=copy destinations=file://C:\videos\out.mp4