流媒体使用f'f'mpeg推流技术

                         流媒体推流播放

1、yum install -y net-tools wget unzip gcc gcc-c++ perl

2#备份yum源

 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup #

下载阿里源

 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #清空缓存 yum makecache

 

3、#切换的homme目录

cd /home

 

4、#下载pcre包

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz#解压pcre包

tar -zxvf pcre-8.41.tar.gz

 

5、#下载zlib包

wget http://www.zlib.net/zlib-1.2.11.tar.gz#解压zlib包

tar -zxvf zlib-1.2.11.tar.gz

6、#下载openssl包

 wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1i.tar.gz

7、#解压openssl包

8、 tar -zxvf openssl-1.0.1i.tar.gz

9、#切换到openssl里 cd openssl-1.0.1i

10、 #生成配置文件 默认配置 ./configure

11、#编译程序 make

12、#安装程序 make install

13、wget https://github.com/arut/nginx-rtmp-module/archive/master.zip#解压下载包

unzip -o master.zip

修改名称为:nginx-rtmp-module

 

14、安装nginx

wget http://nginx.org/download/nginx-1.12.2.tar.gz
cd nginx-1.12.2

./configure --prefix=/usr/local/nginx --with-pcre=/home/pcre-8.41 --with-zlib=/home/zlib-1.2.11 --with-openssl=/home/openssl-1.0.1i --add-module=/home/nginx-rtmp-module

 

make && make install

 

安装ffmpeg:

yum install -y epel-release

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro

rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm

yum update -y

yum install -y ffmpeg

修改nginx配置文件:

vi /usr/local/nginx/conf/nginx.conf

直接替换即可 现有的nginx.conf

启动nginx

/usr/local/nginx/sbin/nginx

提送一个rtmp流上去


home下上传一个test.mp4视频

 

#推送rtmp流 下载一个VLC测试


ffmpeg -re -i "/home/test.mp4" -vcodec libx264 -vprofile baseline -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 rtmp://192.168.1.123:1935/myapp/test1




只有在推送的时候才可以播放

 图片1.png

 


猜你喜欢

转载自blog.51cto.com/xiaorenwutest/2135343