-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
v1_EN_SampleRealtime
配置SRS为Realtime模式,使用RTMP可以将延迟降低到0.8-3秒,可以应用到对实时性要求不苛刻的地方,譬如视频会议(其实视频会议,以及人类在开会的时候,正常时候是会有人讲,有人在听在想,然后换别人讲,其实1秒左右延迟没有问题的,除非要吵架,就需要0.3秒左右的延迟)。
配置最低延迟的服务器详细信息可以参考:LowLatency,本文举例说明部署的实例步骤。
Suppose the server ip is 192.168.1.170
Step 1, get SRS. For detail, read GIT
git clone https://github.com/winlinvip/simple-rtmp-server
cd simple-rtmp-server/trunk
Or update the exists code:
git pull
Step 2, build SRS. For detail, read Build
./configure --disable-all --with-ssl && make
第三步,编写SRS配置文件。 For detail, read LowLatency
将以下内容保存为文件,譬如conf/realtime.conf
,服务器启动时指定该配置文件(srs的conf文件夹有该文件)。
# conf/realtime.conf
listen 1935;
max_connections 1000;
vhost __defaultVhost__ {
gop_cache off;
queue_length 10;
}
第三步,启动SRS。 For detail, read LowLatency
./objs/srs -c conf/realtime.conf
第四步,启动推流编码器。 For detail, read LowLatency
使用FFMPEG命令推流:
for((;;)); do \
./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv \
-vcodec copy -acodec copy \
-f flv -y rtmp://192.168.1.170/live/livestream; \
sleep 1; \
done
或使用FMLE推流:
FMS URL: rtmp://192.168.1.170/live
Stream: livestream
备注:测量延迟,可以使用FMLE推流时,将智能手机的秒表功能打开,用FMLE摄像头对着秒表,然后对比FMLE的摄像头的图像,和服务器分发的头像的延迟,就知道精确的延迟多大。参考:延迟的测量,如下图所示:
第五步,观看RTMP流。 For detail, read LowLatency
RTMP url is: rtmp://192.168.1.170:1935/live/livestream
User can use vlc to play the RTMP stream.
Or, use online SRS player: http://winlinvip.github.io/srs.release/trunk/research/players/srs_player.html?vhost=defaultVhost&autostart=true&server=192.168.1.170&app=live&stream=livestream&port=1935
Note: Please replace all ip 192.168.1.170 to your server ip.
Winlin 2014.3
Welcome to SRS wiki!
Please select your language:
Please select your language:
Please select your language:
Please select your language:
Please select your language: