SRS is a Chinese development of a video server, the use of support rtmp and HLS protocol, can be made into a container, let the client push the stream, or can be combined with ffmpeg own initiative to pull the stream, detailed instructions can view the SRS wiki:
Https://github.com/ossrs/srs/wiki/v2_CN_Home
Srs:http://ossrs.net/srs.release/releases/index.html
SRS Web Player: http://www.ossrs.net/players/srs_player.html?stream=livestream&port=19350#
Ffmpeg:http://www.ffmpeg.org/download.html
Or: wget http://ffmpeg.gusari.org/static/64bit/ffmpeg.static.64bit.latest.tar.gz
The compilation parameters used in their own work:
./configure--prefix=/usr/local/srs--with-hls--with-hds--with-dvr--without-nginx--with-ssl--with-ffmpeg-- With-transcode--with-ingest--with-stat--with-http-callback--with-http-server--without-stream-caster-- With-http-api--with-librtmp--with-research--with-utest--without-gperf--without-gmc--without-gmp--WITHOUT-GCP-- Without-gprof--without-arm-ubuntu12--without-mips-ubuntu12--log-trace
Make
Make install
Ln-sf/usr/local/srs/etc/init.d/srs/etc/init.d/srs
The SRS is made into a container configuration:
Listen 1935;
Max_connections 1000;
PID Objs/edge.pid;
Srs_log_file./objs/edge.log;
Vhost __defaultvhost__ {
}
Configuration of the SRS cluster:
Listen 1935;
Max_connections 1000;
PID Objs/edge.pid;
Srs_log_file./objs/edge.log;
Vhost __defaultvhost__ {
mode remote;
Origin 127.0.0.1:19350;
}
The 127.0.0.1:19350 in origin is changed to the socket that can provide the data source for the SRS server, and the SRS service that provides the data source can be made into a container for others to push or to distribute
SRS configuration distributes RTMP streams:
Listen 1935;
Max_connections 1000;
PID Objs/edge.pid;
Srs_log_file./objs/edge.log;
Vhost __defaultvhost__ {
Ingest Livestream {
Enabled on;
Input {
Type stream;
URL rtmp://58.218.152.98:1935/hls/j2--;
}
FFmpeg./objs/ffmpeg/ffmpeg-;
Engine {
Enabled on;
Output rtmp://127.0.0.1:1935/live/livestream;
}
}
}
Type if it is a file to change to File,url is the address of the stream, with this configuration needs to install FFmpeg
SRS Configuration HLS Distribution:
Listen 1935;
Max_connections 1000;
PID Objs/edge.pid;
Srs_log_file./objs/edge.log;
Vhost __defaultvhost__ {
Ingest Livestream {
Enabled on;
Input {
Type stream;
URL rtmp://58.218.152.98:1935/hls/j2--;
}
FFmpeg./objs/ffmpeg/ffmpeg;
Engine {
Enabled on;
Output rtmp://127.0.0.1:1935/live/livestream;
}
}
HLS {
Enabled on;
Hls_fragment 10;
Hls_window 60;
Hls_path./objs/nginx/html;
Hls_m3u8_file [app]/[stream].m3u8;
Hls_ts_file [App]/[stream]-[seq].ts;
}
}
Http_server {
Enabled on;
Listen 8088;
Dir./objs/nginx/html;
}
HLS is the use of on-demand way to achieve live, the video about the size of the film, each piece with a. TS end, and generate a stream name. m3u8 as an index, so see if HLS distribution has no effect directly to see if the Dir directory inside the Http_server has generated these two files
The following are the problems encountered in the actual production environment:
1, video collection is not, but add-bsf:a aac_adtstoasc can be collected
Workaround: Directly modify the profile of the SRS edge.conf add Aparams to the engine and increase the example as follows:
Ingest Livestream {
Enabled on;
Input {
Type stream;
URL http://live.hkstv.hk.lxdns.com/live/hks/playlist.m3u8;
}
Ffmpeg/tmp/ffmpeg;
Engine {
Enabled on;
VCODEC copy;
ACODEC copy;
Aparams
{
Profile:a Aac_low;
Bsf:a AAC_ADTSTOASC;
}
Output rtmp://127.0.0.1:1935/live/livestream;
}
}
2. Video can be collected normally but not with VLC, with perfect decoding and special software can
Workaround: Add-vsync drop parameter (Note: This is only a personal solution, just can be used, not accurate, more coding problems), and then add-r 30 to solve the playback card frame problem, the final FFmpeg acquisition parameters are as follows:
/usr/local/src/ffmpeg-r 30-i rtmp://23.33.33.118/live/11-vsync drop-vcodec copy-c:v copy-report-an-f flv-y rtmp ://127.0.0.1:1935/LIVE/11
This article from the "Single Season Rice" blog, reproduced please contact the author!
Some instructions for SRS (Simple Rtmp Server)