Giter Site home page Giter Site logo

reiuiji / irl-srt-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from irlserver/irl-srt-server

0.0 0.0 0.0 444 KB

SRT Live Server for streaming with low latency srt live server for low latency for usage with SRTLA/Belabox.

License: MIT License

C++ 99.38% CMake 0.45% Dockerfile 0.17%

irl-srt-server's Introduction

SRT Live Server

Introduction

srt-live-server (SLS) is an open source live streaming server for low latency based on Secure Reliable Tranport (SRT). Normally, the latency of transport by SLS is less than 1 second in internet.

Requirements

Please install the SRT library first, refer to SRT for system enviroment setup. SLS can only run on Unix-based operating systems.

Compilation

git submodule update --init
mkdir build && cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release
make -j

Binaries are created in build/bin/ directory.

Usage

cd build

Help information

./srt_server -h

Run with default configuration file

./srt_server -c ../sls.conf

Configuration

Configuration directives are documented on the wiki page.

Testing

srt-live-server only supports the MPEG-TS format streaming.

Test with FFmpeg

You can push camera live stream using FFmpeg. FFmpeg must be compiled with --enable-libsrt flag - to obtain appropriate binaries, download FFmpeg sourcecode from https://github.com/FFmpeg/FFmpeg, then compile FFmpeg with --enable-libsrt.

srt library is installed in folder /usr/local/lib64.

If ERROR: srt >= 1.3.0 not found using pkg-config occurs during the compilation of FFmpeg, please check the ffbuild/config.log file and follow its instruction to resolve this issue. In most cases it can be resolved by executing the following command:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig

If error while loading shared libraries: libsrt.so.1 occurs, please add srt library path to the runtime linker configuration file, /etc/ld.so.conf, then refresh the cache by running the comand /sbin/ldconfig as root.

Push stream from webcam to SRT

./ffmpeg -f avfoundation -framerate 30 -i "0:0" -vcodec libx264  -preset ultrafast -tune zerolatency -flags2 local_header  -acodec libmp3lame -g  30 -pkt_size 1316 -flush_packets 0 -f mpegts "srt://[your.sls.ip]:8080?streamid=uplive.sls/live/test"

Play a SRT stream using FFplay

./ffplay -fflags nobuffer -i "srt://[your.sls.ip]:8080?streamid=live.sls/live/test"

Test with OBS

OBS supports SRT protocol to publish streams from version v25.0 onwards. To publish SRT stream from OBS to SRT Live Server you can use the following url:

srt://[your.sls.ip]:8080?streamid=uplive.sls/live/test

You can also add a SRT stream as an input source. To do this, add a Media source to OBS, enter mpegts as input format and set the following input URL:

srt://[your.sls.ip]:8080?streamid=live.sls/live/test

Test with SRT Live Client

There is a test tool in SLS which can be used as a performance test - it has no codec overhead, only network overhead. The SRT Live Client can play a SRT stream to a TS file, or push a TS file to a SRT stream.

Push a TS file via SRT

./srt_client -r srt://[your.sls.ip]:8080?streamid=uplive.sls/live/test -i [the full file name of exist ts file]

Play a SRT stream

./srt_client -r srt://[your.sls.ip]:8080?streamid=live.sls/live/test -o [the full file name of ts file to save]

Use SLS with docker

Please refer to: https://hub.docker.com/r/ravenium/srt-live-server

Development

To build a debug build of the SRT Live Server, run the following commands:

git submodule update --init
mkdir build && cd build
cmake ../ -DCMAKE_BUILD_TYPE=Debug
make -j

Note:

  • SLS refers to the RTMP url format (domain/app/stream_name), example: www.sls.com/live/test. The URL must be set in streamid parameter of SRT, which will be the unique identification a stream.

  • How to distinguish the publisher and player of the same stream? In the configuration file file, you can set parameters of domain_player/domain_publisher and app_player/app_publisher to resolve it. Importantly, the two combination strings of domain_publisher/app_publisher and domain_player/app_player must not be equal in the same server block.

  • I supplied a simple android app for testing SLS, which can be downloaded from https://github.com/Edward-Wu/liteplayer-srt

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.