This repo contains a set of utilities to start streaming with Ace Stream.
Utilities themselves are wrappers (written in Python) around Ace Stream app which can be downloaded here: http://wiki.acestream.org/wiki/index.php/Download#Linux
You should be familiar with this info to understand what's happening:
- http://wiki.acestream.org/wiki/index.php/Streaming
- http://wiki.acestream.org/wiki/index.php/Create_HLS_Broadcast
Features currently available:
- start a set of source/support nodes based on config
- local (JSON file) and remote (URL which return JSON) configs are supported
- stop nodes
- collect info about running nodes and send it to monitoring server
# Start all source nodes
$ python src/start_streamers.py
# Start all support nodes:
$ python src/start_support_nodes.py
# Start single source node by port:
$ python src/start_streamers.py --port <port>
# Start single support node by port:
$ python src/start_support_nodes.py --port <port>
# Stop all running nodes:
$ python src/stop_nodes all
# Stop single node by its port:
$ python src/stop_nodes <port>
When all source/support nodes are started app always tries to match running nodes with config. This means that:
- all nodes from config are started if they were not already started
- when there are running nodes which are not present in config they are stopped
Send monitoring data and metadata to configured endpoints (usually you run this periodically from cron job):
$ python src/monitor_nodes.py --node-type <source|support>
$ python src/update_metadata.py
App config describes environment and sets some global options.
It should be placed in config/config.json
file.
Options:
engine_path
: path to engine executable (usually it'sstart-engine
shell script). You can specify path to three engine versions. Which one is used is set in the config for each stream.stable
: path to stable versionbeta
: path to beta versionalpha
: path to alpha version
root
: root folder (all other dirs are described relatively to root)controller
: list of endpoints used by app to communicate with other apps. Some endpoints can be both local or remote. Local endpoint is set as path to local file (either absolute or relatively toroot
) Remote endpoint is set as an URL (it must start with http: or https:)source_node
: path to source node config (local or remote)support_node
: path to support node config (local or remote)monitor
: URL which will receive monitoring data (remote only)metadata_receiver
: URL which will receive nodes' metadata (remote only)
dirs
: path to dirs which are used by this apptrackers
: list of trackers (you must add at least one tracker)provider_key
: optional provider keynode_access_token
: optional node access token
Preferred tracker is XBT (https://github.com/OlafvdSpek/xbt)
You should add tracker's announce URL to the config (e.g. udp://tracker1.example.com:2710/announce
)
It's a string which identifies you as a broadcaster. It's written to transport file and used by clients when they send statistics to P2P network.
It's a string which prevents unauthorized access to node's API interface (see http://wiki.acestream.org/wiki/index.php/AceStream_3.0/en#Node.27s_web-interface)
See examples/source_node_config.json
stream_uid
: internal unique stream id; your should use only latin chars, digits and underscorestitle
: title of stream (this is what users see when they watch this stream)url
: URL of the original streambitrate
: stream bitrate in bytes/s (Used only when input stream is TS)categories
: list of categories (for allowed values seeALLOWED_CATEGORIES
incommon.py
)quality
: SD|HDtype
: type of input stream: ts|hls (currently acestream supports two types of input streams: MPEG-TS over HTTP and HLS)force_monotonic_sequence
: (0|1, optional, default=0) Used only when input stream is HLS
See examples/support_node_config.json
source_ip
: source node which to download data fromsource_port
: port of the source node
(for both source and support node)
port
: node portengine_version
: stable|beta|alpha (it can be used to run several streams on the newest alpha/beta engine before going to productions)extended_logging
: 0|1 (used to enable extended logging on the node)private_node
: 0|1 (private nodes can only be accessed from explicitly allowed ip-addresses)
1 private source node + 2 support nodes.
All three nodes should be places on different servers.
Up to 50 total nodes on one server 32 Gb RAM + some modern quad core CPU (actual number depends on the total bitrate and available bandwidth).
App can send monitoring data to the server configured by "monitor" endpoint.
Data is sent by running src/monitor_node.py
script.
It collects data about each running node and sends it via HTTP POST request to the endpoint.
For each running node a separate request is made.
Info about collected data: http://wiki.acestream.org/wiki/index.php/AceStream_3.0/en#Monitoring
Metadata is sent to the server configured by "metadata_receiver" endpoint by running script src/update_metadata.py
It contains important data which must be persisted between node restart. This includes:
.sauth
and.restart
files for TS streams- monotonic sequence metadata for HLS streams
In production environment you should persist this data somewhere outside the server with running nodes to be able to recover in the case of server failure.