环境准备
yum installgcc gcc-c++ automake pcre pcre-devel zlip zlib-devel opensslopenssl-devel

./configure–add-module=../nginx-rtmp-module-master


make && make install

启动||停止服务

更改nginx端口为8080
注意防火墙设置

设置nat

启动nginx 服务并访问


点播
两个MP4文件,放在/opt/vide/vod下;
一个是test.mp4,由wmv转换过来;
一个是1080P.mp4,从网上现在下来的;
具体信息如下:

然后修改nginx配置文件:
Vi/usr/local/nginx/conf/nginx/conf/nginx.conf

设置NAT

使用vlc播放器播放:rtmp://127.0.0.1/vod/1080P.mp4

rtmp://127.0.0.1/vod/test.mp4

why?
因是通过格式工厂将wmv文件强制转换成MP4格式的,故更换,以手机的摄像机拍摄的视频为准,v8.mp4 12.6MB大小。
rtmp://127.0.0.1/vod/V8.mp4

可以播放,看来原因就是播放文件本身格式的问题。
局域网可访问设置
本机IP 192.168.2.251



直播


重启服务;使用火狐查看http://127.0.0.1/stat

为排除浏览器差异问题,使用谷歌查看发现:

403问题多数是nginx配置的原因,查看nginx.conf文件

添加root用户;再次火狐查看:

谷歌查看:

至此,说明配置成功。
fmpeg
下载ffmpeg:http://ffmpeg.org/releases
解压FFMPEG===tar-jxvf
安装yasm----yum install yasm

考虑到需要太多的依赖,故直接走yum;
安装EPEL Release,因为安装需要使用其他的repo源,所以需要EPEL支持
yum install -y epel-release
如果出现缺少Code提示,可以:
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
安装nux-dextop 源
rpm-Uvhhttp://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
查看repo源是否安装成功
yum repolist
安装ffmpeg
yum install -y ffmpeg

Ffmpeg -version

推流
ffmpeg -re -i V8.mp4 -vcodec libx264-acodec aac -ar 44100 -strict -2 -ac 1-f flv rtmp://127.0.0.1:1935/hls/test1



VLC播放:
rtmp://127.0.0.1:1935/live/djw

网友评论