Giter Club home page Giter Club logo

rtmp_relay's Introduction

RTMP relay v1.0

Build Status Build Status

Relays RTMP streams to multiple endpoints.

Usage

RTMP relay uses yaml-cpp submodule. The following command has to be run after cloning the RTMP relay:

$ git submodule update --init

To compile the RTMP relay, just run "make" in the root directory. You can pass these arguments to rtmp_relay (located in the bin directory):

  • --config <config_file> – path to config file
  • --daemon – run RTMP relay as daemon
  • --kill-daemon – kill the daemon
  • --reload-config – reload the daemon's configuration
  • --help – print the documentation

Docker build

Check out submodules the same way as for a normal build, then run docker-compose build. This will result in a local image named evo-rtmp-relay:latest.

Configuration

RTMP relay configuration files are YAML-based. It must start with servers array. Each server has following attributes:

  • endpoints – array of endpoint descriptors
    • applicationName – for host streams this is the filter of incoming stream application names (can contain a regex), for client streams this is the name of the application (optional)
    • streamName – for host streams this is the filter of incoming stream names (can contain a regex), for client streams this is the name of the stream (optional)
    • type – type of connection (client or host)
    • direction – direction of the stream (input or output)
    • addresses – list of addresses to connect to (for client connections) or listen to (for server connections)
    • video – flag that indicates whether to forward video stream (default value is true)
    • audio – flag that indicates whether to forward audio stream (default value is true)
    • data – flag that indicates whether to forward data stream (default value is true)
    • metaDataBlacklist – list of metadata fields that should not be forwarded
    • connectionTimeout – how long should the attempt to connect last (default value is 5.0)
    • reconnectInterval – the interval of reconnection (default value is 5.0)
    • reconnectCount – amount of connect attempts (0 to reconnect forever)
    • pingInterval – client ping interval in seconds (default value is 60.0)
    • bufferSize – size of the client buffer for input streams (default value is 3000)
    • amfVersion – AMF version (for client connections) to use for communication (default value is 0)

applicationName can have the following tokens:

  • {id} – id of the application
  • {applicationName} – name of the application
  • {streamName} – name of the stream
  • {ipAddress} – IP address of the destination
  • {port} – destination port

streamName name can have the following tokens:

  • {id} – id of the sender
  • {applicationName} – name of the application
  • {streamName} – name of the source stream
  • {ipAddress} – IP address of the destination
  • {port} – destination port

Optionally you can add a web status page with "statusPage" object, which has the following attribute:

  • address – the address of the web status page

Status page can be accessed in the following addresses:

  • <server address>/stats – HTML output
  • <server address>/stats.html – HTML output
  • <server address>/stats.json – JSON output
  • <server address>/stats.txt – text output

To configure logging, you can add "log" object to the config file. It has the following attributes

  • level – the log threshold level (0 for no logs and 4 for all logs)
  • syslogEnabled – should the syslog be used (default value is true) (on *NIX only)
  • syslogIdent – identification to be passed to openlog (on *NIX only)
  • syslogFacility – facility to be passed to openlog (on *NIX only)

Example configuration:

log:
    level: 4
    syslogIdent: relay
    syslogFacility: "LOG_LOCAL3"
statusPage:
    address: "0.0.0.0:80"
servers:
  - endpoints:
      - addresses: [ "0.0.0.0:13004" ]
        type: "host"
        direction: "input"
        applicationName: "app/name"
        video: true
        audio: true
      - addresses: [ "52.19.130.93:1935" ]
        type: "client"
        direction: "output"
        applicationName: "app/name"
        streamName: "stream_name"
        video: true
        audio: true
        pingInterval: 60.0
      - addresses: [ "127.0.0.1:13005" ]
        type: "client"
        direction: "output"
        applicationName: "app/name"
        streamName: "{streamName}_2"
        video: true
        audio: true
        pingInterval: 60.0
        connectionTimeout: 5.0
        reconnectInterval: 5.0
        reconnectCount: 3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.