srs template for website development

2022.03.17

SRSEnvironmental construction

srsOfficial website:SRSOfficial website

Code cloud's source speed:Code cloud's source speed

githubSource speed:githubSource speed

Choose the current latestreleaseVersion3.0

first step,ObtainSRS。Detailed referenceGITGet code

git clone https://gitee.com/winlinvip/srs.oschina.git srs.3.0-20200720

cd srs.3.0-20200720

#Make⽤Current3.0Version

git checkout 3.0release

cd trunk

Second step,CompileSRS。Detailed referenceBuild

./configure && make

(srs template for website development)third step,writeSRSProfile。Detailed referenceRTMPdistribution,Delivery HLS,Delivery HTTP FLV

(srs template for website development)edit conf/srs.conf ,Specify the configuration file when the server starts(srsofconfThe folder has this file)。

1 listen 1935;
2 max_connections 1000;
3 srs_log_tank file;
4 srs_log_file ./objs/srs.log;
5 http_api {
6 enabled on;
7 listen 1985;
8 }
9 http_server {
10 enabled on;
11 listen 8081; # httpListening end⼝,Notice⾃⼰Configured end⼝
12 dir ./objs/nginx/html;
13 }
14 stats {
15 network 0;
16 disk sda sdb xvda xvdb;
17 }
18 vhost __defaultVhost__ {
19 # hls darren
20 hls {
21 enabled on;
22 hls_path ./objs/nginx/html;
23 hls_fragment 10;
24 hls_window 60;
25 }
26 # http-flv darren
27 http_remux {
28 enabled on;
29 mount [vhost]/[app]/[stream].flv;
30 hstrs on;
31 }
32 }


srs template for website development

SRSA full network of video documents private letter1,Request free of charge,More【free】
FFmpeg/WebRTC/RTMP/NDK/AndroidSenior development of audio and video flow media-Learn video tutorial-Tencent Classroom

(srs template for website development)the fourth step,start upSRS。

./objs/srs -c conf/srs.conf

1 ubuntu@VM-0-13-ubuntu:~/0voice/media/srs.3.0-20200720/trunk$ ./objs/s
2rs -c conf/srs.conf
2 Backstage⾏result
3 [2020-07-20 17:34:48.061][Trace][30433][0] XCORE-SRS/3.0.141(OuXuli)
4 [2020-07-20 17:34:48.061][Trace][30433][0] config parse complete
5 [2020-07-20 17:34:48.061][Trace][30433][0] write log to file ./objs/s
rs.log
6 [2020-07-20 17:34:48.061][Trace][30433][0] you can: tailf ./objs/srs.
log
7 [2020-07-20 17:34:48.061][Trace][30433][0] @see: https://github.com/o
ssrs/srs/wiki/v1_CN_SrsLog
(srs template for website development)Confirm that it is already started normally

1 ubuntu@VM-0-13-ubuntu:~/0voice/media/srs.3.0-20200720/trunk$ sudo ps
-ef | grep srs
2 ubuntu 30435 1 0 17:34 pts/0 00:00:00 ./objs/srs -c conf/sr
s.conf
(srs template for website development)Displayubuntu 30435 1 0 17:34 pts/0 00:00:00 ./objs/srs -c conf/srs.conf

Safety exits is runningsrs

sudo kill -SIGQUIT srs_pid

By default is the way in the background startup,If it is convenientGDBDebug, you need to modify the configuration file to start the front desk.。

1 listen 1935;
2 max_connections 1000;
3 #srs_log_tank file;
4 #srs_log_file ./objs/srs.log;
5 # Front desk⾏
6 daemon off;
7 # Print to the Terminal Console
8 srs_log_tank console;
9 http_api {
10 enabled on;
11 listen 1985;
12 }
313 http_server {
14 enabled on;
15 listen 8081; # httpListening end⼝
16 dir ./objs/nginx/html;
17 }
18 stats {
19 network 0;
20 disk sda sdb xvda xvdb;
21 }
22 vhost __defaultVhost__ {
23 # hls darren
24 hls {
25 enabled on;
26 hls_path ./objs/nginx/html;
27 hls_fragment 10;
28 hls_window 60;
29 }
30 # http-flv darren
31 http_remux {
32 enabled on;
33 mount [vhost]/[app]/[stream].flv;
34 hstrs on;
35 }
36 }

Execution method:./objs/srs -c conf/srs.conf

(srs template for website development)Run in the terminal,logAlso displayed on the terminal

1 [2020-07-20 17:46:33.586][Trace][1533][0] system default latency(ms)
: mw(0-350) + mr(0-350) + play-queue(0-30000)
2 [2020-07-20 17:46:33.586][Warn][1533][0][0] SRS/3.0.141 is beta
3 [2020-07-20 17:46:33.586][Trace][1533][0] http flv live stream, vhos
t=__defaultVhost__, mount=[vhost]/[app]/[stream].flv
4 [2020-07-20 17:46:33.586][Trace][1533][0] http: root mount to ./objs
/nginx/html
5 [2020-07-20 17:46:33.586][Trace][1533][0] st_init success, use epoll
6 [2020-07-20 17:46:33.586][Trace][1533][380] server main cid=380, pid
45
=1533, ppid=2337, asprocess=0
7 [2020-07-20 17:46:33.586][Trace][1533][380] write pid=1533 to ./objs
/srs.pid success!
8 [2020-07-20 17:46:33.586][Trace][1533][380] RTMP listen at tcp://0.0
.0.0:1935, fd=7
9 [2020-07-20 17:46:33.586][Trace][1533][380] HTTP-API listen at tcp:/
/0.0.0.0:1985, fd=8
10 [2020-07-20 17:46:33.586][Trace][1533][380] HTTP-Server listen at tc
p://0.0.0.0:8081, fd=9
11 [2020-07-20 17:46:33.586][Trace][1533][380] signal installed, reload
=1, reopen=10, fast_quit=15, grace_quit=3
12 [2020-07-20 17:46:33.586][Trace][1533][380] http: api mount /console
to ./objs/nginx/html/console

SRSSource code

trunkcontent

(srs template for website development)3rdparty auto conf configure doc etc ide modules research scripts src usr

srs template for website development

srcSource code

app core kernel libs main protocol service utest

srs template for website development(srs template for website development)

appapplication

(srs template for website development)├── app

(srs template for website development)│ ├── srs_app_async_call.cpp

│ ├── srs_app_async_call.hpp Can be used to perform asynchronous tasks,pass throughexecute()function pushTask,Then

existcycle()implement

│ ├── srs_app_bandwidth.cpp

│ ├── srs_app_bandwidth.hpp Provide bandwidth test interface

│ ├── srs_app_caster_flv.cpp

(srs template for website development)│ ├── srs_app_caster_flv.hpp supportPOSTOneflvFlow to the server,SimilarRTMPofpublish

│ ├── srs_app_config.cpp

│ ├── srs_app_config.hpp Read configuration file

│ ├── srs_app_conn.cpp

│ ├── srs_app_conn.hpp srsBasic connection,Each connection corresponds to an extension,All connections are managed

(srs template for website development)│ ├── srs_app_coworkers.cpp

│ ├── srs_app_coworkers.hpp SrsCoWorkers For origin cluster

│ ├── srs_app_dash.cpp

│ ├── srs_app_dash.hpp SrsDash stream mediaDASHbusiness The MPEG-DASH encoder,

transmux RTMP to DASH.

│ ├── srs_app_dvr.cpp

│ ├── srs_app_dvr.hpp SrsDvr RecordingRTMPprocessflvormp4document

│ ├── srs_app_edge.cpp

│ ├── srs_app_edge.hpp SrsEdgeRtmpUpstream Edge node business,For example, draw from the source station to the edge,side

Back to the source station

│ ├── srs_app_empty.cpp

│ ├── srs_app_empty.hpp No content

│ ├── srs_app_encoder.cpp

│ ├── srs_app_encoder.hpp SrsEncoder You can use multipleffmpegTo convert the specified stream,Ultimate call

SrsFFMPEGCome back

│ ├── srs_app_ffmpeg.cpp

│ ├── srs_app_ffmpeg.hpp SrsFFMPEG useffmpegChange flow

│ ├── srs_app_forward.cpp

│ ├── srs_app_forward.hpp SrsForwarder Transfer flow to other servers

│ ├── srs_app_fragment.cpp

(srs template for website development)│ ├── srs_app_fragment.hpp SrsFragment A slice,Such asHLSFragmentation、DVRFragmentation orDASHMinute

piece。It is a media file,E.gFLVorMP4,Duration。

│ ├── srs_app_hds.cpp

│ ├── srs_app_hds.hpp SrsHds WillRTMPTurn intoAdobe HDSflow

│ ├── srs_app_heartbeat.cpp

│ ├── srs_app_heartbeat.hpp SrsHttpHeartbeat HHTPHeartbeat

│ ├── srs_app_hls.cpp

│ ├── srs_app_hls.hpp SrsHls HLSbusiness,Transmux RTMP stream to HLS(m3u8 and

ts).

│├── srs_app_hourglass.cpp

│ ├── srs_app_hourglass.hpp SrsHourGlass TicktickHandler

│ ├── srs_app_http_api.cpp

(srs template for website development)│ ├── srs_app_http_api.hpp SrsHttpApi HTTPbusinessAPI7

│ ├── srs_app_http_client.cpp

│ ├── srs_app_http_client.hpp No content

(srs template for website development)│ ├── srs_app_http_conn.cpp

│ ├── srs_app_http_conn.hpp SrsHttpConn,HTTPconnect,InheritSrsConnection

│ ├── srs_app_http_hooks.cpp

│ ├── srs_app_http_hooks.hpp SrsHttpHooks HTTPHook,HTTPCallbackAPI

(srs template for website development)│ ├── srs_app_http_static.cpp

│ ├── srs_app_http_static.hpp SrsHttpStaticServer HTTPStatic server instance,forHTTPStatic text

PartFLV/MP4Video on-demand service

│ ├── srs_app_http_stream.cpp

│ ├── srs_app_http_stream.hpp SrsHttpStreamServer HTTPLive stream service,support

FLV/TS/MP3/AACflow

│ ├── srs_app_ingest.cpp

│ ├── srs_app_ingest.hpp SrsIngesterIngest file/flow/equipment,useFFMPEGcoding(Optional), pass through

RTMPPushSRS(or othersRTMPserver)

│ ├── srs_app_listener.cpp

│ ├── srs_app_listener.hpp SrsTcpListener SrsUdpListener TCP/UDPListener

│ ├── srs_app_log.cpp

│ ├── srs_app_log.hpp SrsFastLog Log

(srs template for website development)│ ├── srs_app_mpegts_udp.cpp

│ ├── srs_app_mpegts_udp.hpp SrsMpegtsOverUdpThe mpegts over udp stream caster

│ ├── srs_app_ng_exec.cpp

│ ├── srs_app_ng_exec.hpp SrsNgExec

│ ├── srs_app_pithy_print.cpp

│ ├── srs_app_pithy_print.hpp SrsPithyPrint collect information,Then print

│ ├── srs_app_process.cpp

│ ├── srs_app_process.hpp SrsProcessStart and stop processes,When it is terminatedcycleRestart

Procedure

│ ├── srs_app_recv_thread.cpp

│ ├── srs_app_recv_thread.hpp SrsHttpRecvThread HTTPData reading,

SrsPublishRecvThreadLift data reading,SrsQueueRecvThreadReading from queue;SrsRecvThreadPackaged price

│ ├── srs_app_refer.cpp

│ ├── srs_app_refer.hpp SrsRefer

(srs template for website development)│ ├── srs_app_reload.cpp

│ ├── srs_app_reload.hpp ISrsReloadHandler Reread the processing of the configuration file

│ ├── srs_app_rtmp_conn.cpp

│ ├── srs_app_rtmp_conn.hpp SrsRtmpConn RTMPconnect

│ ├── srs_app_rtsp.cpp

│ ├── srs_app_rtsp.hpp SrsRtpConn RTSPconnect,SrsRtspCaster RTSPbusiness

│ ├── srs_app_security.cpp8

(srs template for website development)│ ├── srs_app_security.hpp SrsSecurity Security restriction,Mainly limitedurl

│ ├── srs_app_server.cpp

│ ├── srs_app_server.hpp SrsServer SRSServe,correspondingrtmp、rtsp、http-flvWaiting for the business here

│ ├── srs_app_source.cpp

│ ├── srs_app_source.hpp SrsSource Correspondence one source,Support multipleSrsConsumerDraw,

SrsSourceManagerManagement source, SrsMetaCache⽤Source cacheMetadata,SrsConsumerSource consumers,

SrsGopCache GOPCache

│ ├── srs_app_statistic.cpp

│ ├── srs_app_statistic.hpp SrsStatisticFlow statistics

│ ├── srs_app_st.cpp

(srs template for website development)│ ├── srs_app_st.hpp SrsSTCoroutineAssociate

(srs template for website development)│ ├── srs_app_thread.cpp

│ ├── srs_app_thread.hpp SrsCoroutineManagerAssociation

(srs template for website development)│ ├── srs_app_utility.cpp

│ └── srs_app_utility.hpp Tools:SrsPlatformInfo、SrsNetworkDevices、SrsMemInfo、

(srs template for website development)SrsDiskStatetc

├── core

(srs template for website development)│ ├── srs_core_autofree.cpp

│ ├── srs_core_autofree.hpp Build an object that is automatically released in the stack,This design is still very worthless

We have to learn

(srs template for website development)│ ├── srs_core.cpp

│ ├── srs_core.hpp Version related⼀Some information

│ ├── srs_core_mem_watch.cpp

│ ├── srs_core_mem_watch.hpp Memory monitor interface

│ ├── srs_core_performance.cpp

(srs template for website development)│ ├── srs_core_performance.hpp Performance test

│ ├── srs_core_time.cpp

│ ├── srs_core_time.hpp Time unit

(srs template for website development)│ ├── srs_core_version3.cpp

│ └── srs_core_version3.hpp Version Information

├── kernel // Audio and video format

│ ├── srs_kernel_aac.cpp

│ ├── srs_kernel_aac.hpp SrsAacTransmuxer synthesisAACAudio flow,beltADTS header

│ ├── srs_kernel_balance.cpp

│ ├── srs_kernel_balance.hpp SrsLbRoundRobinLoad balancing,Used for edge nodes draw flow and other multiple services

Server function

│ ├── srs_kernel_buffer.cpp

│ ├── srs_kernel_buffer.hpp SrsBufferRead the use of bytes

│ ├── srs_kernel_codec.cpp9

(srs template for website development)│ ├── srs_kernel_codec.hpp Encoder related,Including video and audio,Very core file;SrsFlvVideoUse to detectFLVofvideo tagCorrespondence;SrsFlvAudioUse to detectFLVofaudio tagCorrespondence;SrsMaxNbSamples

(srs template for website development)256ExpressvideobiggestNALUSNumber,audiobiggestpacketquantity;SrsFrameStorage frame,SrsAudioFrame storage

AACframe,SrsVideoFrameStorage video frame;SrsFormatEncoder format,Contains one or more streams,For exampleRTMP

formatTime,Contains a video and an audio frame。Guess the data instance when the flow of light is preservedSrsFormat?

│ ├── srs_kernel_consts.cpp

(srs template for website development)│ ├── srs_kernel_consts.hpp SRSConstant definition,For example, played tags#define

SRS_CONSTS_LOG_PLAY "PLA";Published tag#define
SRS_CONSTS_LOG_CLIENT_PUBLISH

"CPB";SRS_CONSTS_HTTP_XXXWaitHTTPResponse code;SRS_CONSTS_RTSP_XXXResponse code, etc.。

│ ├── srs_kernel_error.cpp

(srs template for website development)│ ├── srs_kernel_error.hpp Return value constant definition,ERROR_XXX;SrsCplxError Anomaly

│ ├── srs_kernel_file.cpp

│ ├── srs_kernel_file.hpp Document reading and writing,SrsFileWriterFile writing,SrsFileReaderFile reader

│ ├── srs_kernel_flv.cpp

│ ├── srs_kernel_flv.hpp FLV SrsFlvDecoderAnalyze,SrsFlvTransmuxerWillRTMPTurn intoFLVflow;

(srs template for website development)SrsSharedPtrMessagecorrespondRTMPNews

│ ├── srs_kernel_io.cpp

│ ├── srs_kernel_io.hpp IORead and write interface

│ ├── srs_kernel_log.cpp

│ ├── srs_kernel_log.hpp Log related

│ ├── srs_kernel_mp3.cpp

│ ├── srs_kernel_mp3.hpp SrsMp3TransmuxerWillRTMPTurn intoMP3flow

│ ├── srs_kernel_mp4.cpp

│ ├── srs_kernel_mp4.hpp SrsMp4Encoder MP4multiplexer;

│ ├── srs_kernel_stream.cpp

│ ├── srs_kernel_stream.hpp SrsSimpleStreamusevectorSimple byte implementedappendkind,mainly at

hlsandhttpIn use,Improvement in the future。

│ ├── srs_kernel_ts.cpp

│ ├── srs_kernel_ts.hpp SrsTsTransmuxerWillRTMPStreamhttp-tsflow,This file is implemented.tsFormat

(srs template for website development)Shutdown interface

│ ├── srs_kernel_utility.cpp

│ └── srs_kernel_utility.hpp Tool function,for examplebool srs_string_ends_with(std::string str,

std::string flag)

├── libs

│ ├── srs_lib_bandwidth.cpp

│ ├── srs_lib_bandwidth.hpp SrsBandwidthClient srs-librtmp Client bandwidth statistics

│ ├── srs_librtmp.cpp

│ ├── srs_librtmp.hpp srsProvided clientrtmpLibrary

│ ├── srs_lib_simple_socket.cpp

│ └── srs_lib_simple_socket.hpp SimpleSocketStream rtmpClientsocketEncapsulate10

├── main

│ ├── srs_main_ingest_hls.cpp PullhlsReleasertmpflow media services

│ ├── srs_main_mp4_parser.cpp MP4 boxAnalyze

│ └── srs_main_server.cpp srsStream media server main entrance

├── protocol The protocol related to the streaming media agreement is here

│ ├── srs_http_stack.cpp

│ ├── srs_http_stack.hpp HTTPprotocol

│ ├── srs_protocol_amf0.cpp

│ ├── srs_protocol_amf0.hpp Amf0Analyze

│ ├── srs_protocol_format.cpp

(srs template for website development)│ ├── srs_protocol_format.hpp SrsRtmpFormatinheritSrsFormat, representRTMPFormat

│ ├── srs_protocol_io.cpp

(srs template for website development)│ ├── srs_protocol_io.hpp Agreement data readIOEncapsulation interface,for exampleISrsProtocolReadWriter

│ ├── srs_protocol_json.cpp

│ ├── srs_protocol_json.hpp jsonkind

│ ├── srs_protocol_kbps.cpp

│ ├── srs_protocol_kbps.hpp Bit rate statistics

│ ├── srs_protocol_stream.cpp

│ ├── srs_protocol_stream.hpp Flow reading,fromISrsReaderRead data tobufferin

│ ├── srs_protocol_utility.cpp

│ ├── srs_protocol_utility.hpp Agreement tool function

(srs template for website development)│ ├── srs_raw_avc.cpp

│ ├── srs_raw_avc.hpp SrsRawH264Stream H264Bare flow analysis,SrsRawAacStream AAC

Bare flow analysis

(srs template for website development)│ ├── srs_rtmp_handshake.cpp

│ ├── srs_rtmp_handshake.hpp RTMPshake hands,includeSrsSimpleHandshakeand

SrsComplexHandshake

│ ├── srs_rtmp_msg_array.cpp

(srs template for website development)│ ├── srs_rtmp_msg_array.hpp SrsMessageArrayMessage array

│ ├── srs_rtmp_stack.cpp

│ ├── srs_rtmp_stack.hpp RTMPProtocol stack

│ ├── srs_rtsp_stack.cpp

│ └── srs_rtsp_stack.hpp RTSPProtocol stack

├── service

│ ├── srs_service_conn.cpp

│ ├── srs_service_conn.hpp ISrsConnection HTTP/RTMP/RTSPThe connection interface of the object;

IConnectionManagerManagement connection interface

│ ├── srs_service_http_client.cpp

│ ├──
srs_service_http_client.hpp SrsHttpClient HTTPClient

│ ├── srs_service_http_conn.cpp11

(srs template for website development)│ ├── srs_service_http_conn.hpp HTTPconnect SrsHttpParser,SrsHttpMessage,

SrsHttpResponseWriter,SrsHttpResponseReader

│ ├── srs_service_log.cpp

│ ├── srs_service_log.hpp SrsConsoleLogLog related

│ ├── srs_service_rtmp_conn.cpp

│ ├── srs_service_rtmp_conn.hpp SrsBasicRtmpClient RTMPClient class

(srs template for website development)│ ├── srs_service_st.cpp

│ ├── srs_service_st.hpp rightst-threadAssociate package

│ ├── srs_service_utility.cpp

│ └── srs_service_utility.hpp serviceComponent tool class

└── utest

├── srs_utest_amf0.cpp

├── srs_utest_amf0.hpp

├── srs_utest_app.cpp

├── srs_utest_app.hpp

├── srs_utest_avc.cpp

├── srs_utest_avc.hpp

├── srs_utest_config.cpp

├── srs_utest_config.hpp

........... There are otherutestdocument,Here is ignored here

8 directories, 203 files

返回列表
更多新闻资讯