流媒体服务器搭建
(一)原理图
(二)RTSP
http://www.cnblogs.com/lidabo/p/4103227.html
(三)nginx服务器搭建
nginx下载链接http://nginx.org/en/download.html
#wget http://nginx.org/download/nginx-1.10.3.tar.gz
nginx-rtmp-module下载链接 http://nginx.org/en/download.html
#git clone https://github.com/arut/nginx-rtmp-module.git
nginx安装
# tar-zxvf nginx-1.10.3.tar.gz
# cd nginx-1.10.3
编译中会出现缺少包的问题,根据报错自行百度即可
#./configure --prefix=/usr/local/nginx --add-module=../nginx-rtmp-module --with-http_ssl_module
#make
#make install
Nginx配置
1. rtmp {
2. server {
3. listen 1935;
4.
5. application myapp {
6. live on;
7. }
8. application hls {
9. live on;
10. hls on;
11. hls_path /tmp/hls;
12. }
13. }
14. }
1. location /hls {
2. types {
3. application/vnd.apple.mpegurl m3u8;
4. video/mp2t ts;
5. }
6. root /tmp/hls;
7. add_header Cache-Control no-cache;
8. }
(四)安装ffmpeg
安装EPELRelease,因为安装需要使用其他的repo源,所以需要EPEL支持
#yuminstall -y epel-release
如果出现缺少Code提示,可以:
#sudo rpm--import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
安装完成之后,可以查看是否安装成功
#yum repolist
安装Nux-Dextop源
导入一个Code
#sudo rpm --importhttp://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
安装nux-dextop源
#sudo rpm –Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
查看repo源是否安装成功
#yumrepolist
yum安装ffmpeg
#yuminstall -y ffmpeg
安装完成后检查ffmpeg版本
#ffmpeg-version
Ffmpeg推流(以下推流参数配置适用于海康摄像头)
ffmpeg -rtsp_transport tcp -irtsp://admin:admin888@172.16.104.158:554 -vcodec copy -acodec aac -ar 44100-strict -2 -ac 1 -f flv -s 320*240 -q 10-f flv rtmp://192.168.142.130:1935/hls/test2