Skip to content
winlin edited this page Jul 12, 2014 · 89 revisions

Compiler SRS

This article explains how to compile and package SRS, in addition , can be downloaded directly release the binary, provides several common system installation package , the installation program will install system services , system services can be activated directly . Reference : [Github: release] ([Download Released SRS ( download release version )] (http://winlinvip.github.io/simple-rtmp-server)) or [ domestic Mirror : release] (http://demo. chnvideo.com: 8085/srs/releases)

# Operating System

  • README of Usage, in Centos6.x/Ubuntu12 </ strong> The following test was successful. After Step operation in accordance with the browser open server address can watch all of the DEMO.
  • DEMO demonstrates all SRS features, especially the giant multi- ffmpeg library dependencies , so in order to simplify the recommended Centos6.x/Ubuntu12 </ strong>.
  • If you do need to compile in other systems SRS, SRS described below depend on a variety of libraries , you can turn off certain features to reduce compile dependencies.

# Turn off the firewall and selinux

Sometimes start no problem, but just can not see , because the firewall and selinux open.

You can turn off the firewall using the following method :

`` `bash

Disable the firewall

sudo / etc / init.d / iptables stop sudo / sbin / chkconfig iptables off `` `

selinux also need to disable, run the command getenforce, if it is Disabled, perform the following steps :

1 Edit the configuration file :. Sudo vi / etc / sysconfig / selinux 1 changed the value of SELINUX disabled: SELINUX = disabled 1 Reboot the system : sudo init 6

# Compiler and start

After determining what compiler options used ( refer below) , compiled SRS is actually very simple. Only RTMP and HLS:

` . / configure && make `

Specify the configuration file , you can start SRS:

`bash . / objs / srs-c conf / srs.conf `

Push RTMP streaming and viewing , reference [Usage: RTMP] (https://github.com/winlinvip/simple-rtmp-server/wiki/SampleRTMP)

More use, reference [Usage] (https://github.com/winlinvip/simple-rtmp-server # usage)

# Compiler options and presets

SRS provides a detailed compilation options to control the function of the switch , as well as providing some useful default, the default options for different application scenarios .

SRS will first apply the default set , and then apply the user's option , for example :. / Configure - rtmp-hls - with-http-api, apply the following order:

  • First application presets : - rtmp-hls, open ssl / hls, other features are turned off.
  • Application user options : - with-http-api, open the http api interface.

So the last compile command support functions are : RTMP + HLS + HTTP Interface

The default set of references to support the end of the argument list , or execute :. / Configure-h view .

# Jobs: Acceleration Compiler

Because when you configure SRS need to compile ffmpeg / nginx, this will be a long process , if you have multiple core machine , you can use jobs to parallel compilation .

  • Configure: srs -dependent tools at compile time can be compiled in parallel .
  • Make: srs can be used when compiling the parallel compilation .

Parallel and serial srs compile compile projects include (srs will automatically determine , without user specified ) :

  • Srs: supports parallel compilation.
  • St-1.9: Serial compiled library is relatively small, the compilation time is very short.
  • Http-parser: serial compiler , libraries is relatively small, the compilation time is very short.
  • Openssl: Serial compilation, parallel compilation problems.
  • Nginx: supports parallel compilation.
  • Ffmpeg: supports parallel compilation.
  • Lame: supports parallel compilation. mp3 used ffmpeg library .
  • Libaacplus: Serial compilation, parallel compilation problems. aac used ffmpeg library .
  • X264: supports parallel compilation. x264 used ffmpeg library .

configure using the parallel compiled as follows:

`bash . / configure - jobs = 16 `

Note : configure does not support make that kind of "-jN", only support "- jobs [= N]".

make use of parallel compilation method is as follows :

`bash / / Or make - jobs = 16 make-j16 `

# Package

SRS provides a packaged script that can be srs packed ( not included nginx / ffmpeg and other external program ) . Installation packages are also available for download , refer to the beginning of this article .

Packaged script will compile srs, srs file and then packaged as a zip (zip than tar Universal ) . Help package of detailed reference :

`` `bash . [winlin @ dev6 srs] $ / scripts / package.sh - help

  • help print this message

-. arm configure with arm and make srs use arm tools to get info.

  • no-build donot build srs, user has builded only make install.. `` `

# SRS dependency

SRS relies on g+ + / gcc / make, st-1.9, http-parser2.1, ffmpeg, cherrypy, nginx, openssl-devel, python2.

Some rely can configure configuration script off the table below:

function strong> td> Options strong> td> compile strong> td> dependent libraries strong> td> Description strong> td> tr>
compiler td> Required td> None td> linux, g+ +, gcc, make td> -based build environment td> tr>
RTMP (Basic) td> Required td> None td> st-1.9 td> RTMP servers , st basis for dealing with concurrency library
forward, vhost, refer, reload the basis functions.

st-1.9 is no longer dependent on other libraries can be compiled under various linux,
tested are CentOS4/5/6, Ubuntu12, Debian-Armhf,
other problems arose
Reference : DeliveryRTMP td> tr>
RTMP
(H.264/AAC) td>
optional td> - with-ssl td> ssl td> RTMP distribute H.264/AAC, the need to support complex handshake a>

contents of a simple handshake to 1537 -byte random number ,
and complex handshake to encrypt data according to certain rules

srs using ssl library
own compilation Reference :
RTMPHandshake td> tr>
HLS td> optional td> - with-hls \
- with-nginx td>
nginx td> - with-hls
sliced ​​into the RTMP stream ts, and generate m3u8,
that AppleHLS flow distribution. Reference : HLS a>

- with-nginx
compiles open this feature
nginx a>,
distribute m3u8 and ts by nginx static files
Reference :
DeliveryHLS a> td> tr>
FFMPEG td> optional td> - with-ffmpeg td> ffmpeg
(libaacplus,
lame, yasm,
x264, ffmpeg) td>
transcoding , transfer package, collection tools ,
FFMPEG rely on too many projects ,
and linux on older versions of these libraries are difficult to compile successfully ,

So if need transcoding function , the proposed closure of this feature ,
transcoding if necessary , recommend the use of CentOS6. * / Ubuntu12 system
Reference : FFMPEG a> td> tr>
Transcode td> optional td> - with-transcode td>
transcoding tools such as FFMPEG td> Specify your own tools
output after the transfer code RTMP RTMP streams ,
generally need FFMPEG transcoding tool ,
or disable FFMPEG Reference : FFMPEG a> td> tr>
Ingest td> optional td> - with-ingest td> collection
tools such as FFMPEG td> Specify your own tools
after
the file / stream / device data is pushed to crawl SRS,
general collection needs FFMPEG tool ,
or disable FFMPEG Reference : Ingest a> td> tr>
HttpCallback td> optional td> - with-http-callback td> cherrypy
http-parser2.1
python2 td>
when certain events occur , SRS can call the http address

example, the client connects to the server , SRS will call
on_connect interfaces , SRS comes with a
research / api-server ( using Cherrypy),
provides a default implementation of these http api .

addition, if opened HttpCallback,
players will jump to the default presentation api-server

http-parser2.1 compilation problems in a variety of linux not large

python2.6/2.7 in CentOS6/Ubuntu12 only ,
so CentOS5 start HttpCallback will be reported json module can not find
Reference : HTTPCallback td> tr>
HttpServer td> optional td> - with-http-server td> http-parser2.1 td> SRS embedded in a web server , the basic http protocol ,
mainly for document distribution .
Reference : HTTPServer a> td> tr>
HttpApi td> optional td> - with-http-api td> http-parser2.1 td> SRS provides http-api ( embedded web server ),
support http managed server.
Reference : HTTPApi a> td> tr>
ARM td> optional td> - with-arm-ubuntu12 td> no additional dependent td> SRS runs on ARM,
If you need support complex handshake a> you need dependence ssl,
currently Ubuntu12 compiled ,
debian-armhf (v7cpu) under test
Reference :
SrsLinuxArm td> tr>
librtmp td> optional td> - with-librtmp td> no additional dependent td> SRS provides client libraries srs-librtmp a>,
If you need support < a href = "https://github.com/winlinvip/simple-rtmp-server/wiki/RTMPHandshake"> complicated handshake a> you need to rely on ssl,
support RTMP client push flow SRS, or play RTMP stream

srs-librtmp use synchronization socket, protocol stacks and SRS
consistent service side , and librtmp as only suitable for the client ,
not be used as the server .
Reference :
SrsLibrtmp td> tr>
DEMO td> optional td> - with-ssl \
- with-hls \
- with-nginx \
- with-ffmpeg \
- with-transcode
td>
nginx / cherrypy td> SRS demo player / output stream transcoder / encoder / video conferencing ,
because of the need http server, so dependent on nginx,

addition, video conferencing because of the need to know we publish the stream name ,
so need HttpCallback support
Reference : SampleDemo td> tr>
GPERF td> optional td> - with-gperf td> gperftools td> use Google's tcmalloc memory allocation library ,
gmc / gmp / gcp rely on this option , refer to : GPERF a> td> tr>
GPERF (GMC) td> optional td> - with-gmc td> gperftools td> memory check gperf-memory-check,
gmc rely gperf, Reference : GPERF a> td> tr>
GPERF (GMP) td> optional td> - with-gmp td> gperftools td> memory performance analysis gperf-memory-profile,
gmp dependent gperf, Reference : GPERF < / a> td> tr>
GPERF (GCP) td> optional td> - with-gcp td> gperftools td> CPU performance analysis gperf-cpu-profile,
gcp rely gperf, Reference : GPERF < / a> td> tr>
GPROF td> optional td> - with-gprof td> gprof td> GNU CPU profile performance analysis tools ,
Reference : GPROF a> td > tr> table>

SRS can customize the compiler, such as arm compiled using arm-linux-g + + instead of g+ +. Reference [ARM: manual compilation ] (https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLinuxArm #% E6% 89% 8B% E5% 8A% A8% E7% BC% 96% E8% AF % 91srs)

Note : SRS and ST variables can be set by the compiler before compilation, but ssl need to manually modify Makefile. Fortunately, not every compile ssl .

# Compiler generates the project

configure and make will generate a number of projects in objs directory. Some files in the research catalog , configure will automatically link to the soft objs directory.

HttpCallback ( its server api-server) directories for research / api-server, did not do a soft chain can be started directly . Detailed reference to the following method.

generation projects strong> td> use strong> td> Description strong> td> tr>
. / objs / srs td> . / objs / srs-c conf / srs.conf td> start SRS server td> tr>
. / objs / bandwidth td> . / objs / bandwidth-h td> linux speed tool td> tr>
. / objs / nginx td> sudo. / objs / nginx / sbin / nginx td> HLS / DEMO used nginx server td> tr>
api-server td> python research / api-server / server.py 8085 td> start HTTP hooks and DEMO video conferencing used api-server td> tr>
FFMPEG td> . / objs / ffmpeg / bin / ffmpeg td> SRS transcoding using FFMPEG, DEMO flowmakers also use it td> tr>
librtmp td> . / objs / include / srs_librtmp.h
. / objs / lib / srs_librtmp.a td>
SRS provides client libraries , reference srs-librtmp a> td> tr>
DEMO
( closed HttpCallback) td>
. / objs / nginx / html / players td> SRS of DEMO static page , when there is no open HttpCallback td> tr>
DEMO
( open HttpCallback) td>
research / api-server / static-dir / players td> SRS of DEMO static pages ,
inside and nginx static directory is a directory , a soft link to research / players,
1 when HttpCallback open . (- with-http-callback),
nginx 's default index.html will jump to HttpCallback home ,
because DEMO video conferencing needs HttpCallback,
2. If HttpCallback not open ,
default browsing Nginx is inside dEMO,
certainly will not be a video conference presentation td> tr> table>

# Configuration parameters

SRS configuration (configure) parameters are as follows :

The default set:

    • X86-x64, the default presets , the general x86 or x64 server. release compiled using this configuration .
    • Pi, raspberry pie presets , arm subset. Raspberry faction release compiled with this configuration .
    • Arm, under ubuntu cross-compiler , is equivalent to the - with-arm-ubuntu12. release using this configuration.
    • Dev, development options , as opening function .
    • Fast, turn off all functions , only supports basic RTMP ( not supported h264/aac), the fastest compilation speed .
    • Pure-rtmp, support RTMP ( support h264 + aac), you need to compile ssl.
    • Rtmp-hls, support RTMP and HLS, typical application mode . You can also add built-in http server (- with-http-server).
    • Disable-all, disable all functions only support rtmp (vp6).

Expert Options : There may fail to compile , not an expert not use this .

    • Use-sys-ssl to use the system ssl, not separately compiled ssl ( in the - with-ssl when effective ) .

Winlin 2014.2

Welcome to SRS wiki!

SRS 1.0 wiki

Please select your language:

SRS 2.0 wiki

Please select your language:

SRS 3.0 wiki

Please select your language:

Clone this wiki locally