mac os上搭建最简单rtmp直播服务器
2017-07-05 16:40
218 查看
. 下载
nginx , nginx-rtmp (https://github.com/arut/nginx-rtmp-module), openssl
先编译openssl : ./Configure darwin64-x86_64-cc -shared ,直接./config 会只编译32位版本。导致后面编译无法进行
编译nginx ./configure --prefix=/usr/local --with-module=<nginx-rtmp path>; sudo make install
install后nginx在/usr/local/sbin中
. 编辑
/usr/local/conf/nginx.conf,server配置块中加入:
将 /hls 路径url 使用 hlv 协议。视频存放根目录/tmp
最后再加入rtmp协议支持(http配置块外面),推流用:
然后启动nginx
推流
准备一个mp4文件,使用ffmpeg 命令推流:
ffmpeg -re -i /tmp/test.mp4 -vcodec libx264 -vprofile baseline -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 rtmp://localhost/hls/movie
拉流
vlc中打开网络流:
hlv方式:http://127.0.0.1:8090/hls/movie.m3u8
rtmp方式:rtmp://127.0.0.1/hls/movie
参阅
http://www.tuicool.com/articles/iauQNr
nginx , nginx-rtmp (https://github.com/arut/nginx-rtmp-module), openssl
先编译openssl : ./Configure darwin64-x86_64-cc -shared ,直接./config 会只编译32位版本。导致后面编译无法进行
编译nginx ./configure --prefix=/usr/local --with-module=<nginx-rtmp path>; sudo make install
install后nginx在/usr/local/sbin中
. 编辑
/usr/local/conf/nginx.conf,server配置块中加入:
location /hls { # Serve HLS fragments types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /tmp; add_header Cache-Control no-cache; } |
最后再加入rtmp协议支持(http配置块外面),推流用:
rtmp { server { listen 1935; application hls { allow play all; live on; hls on; hls_path /tmp/hls; } } } |
推流
准备一个mp4文件,使用ffmpeg 命令推流:
ffmpeg -re -i /tmp/test.mp4 -vcodec libx264 -vprofile baseline -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 rtmp://localhost/hls/movie
拉流
vlc中打开网络流:
hlv方式:http://127.0.0.1:8090/hls/movie.m3u8
rtmp方式:rtmp://127.0.0.1/hls/movie
参阅
http://www.tuicool.com/articles/iauQNr
相关文章推荐
- 简单直播实现(一:创建本地rtmp服务器)Mac上搭建直播服务器Nginx+rtmp
- iOS简单直播实现(一:创建本地rtmp服务器)Mac上搭建直播服务器Nginx+rtmp
- iOS简单直播实现(一:创建本地rtmp服务器)Mac上搭建直播服务器Nginx+rtmp
- Mac上搭建直播服务器Nginx+rtmp
- Mac上搭建直播服务器Nginx+rtmp
- Nginx 搭建rtmp直播服务器
- 树莓派nginx+rtmp搭建直播服务器
- OSX安装nginx和rtmp模块(rtmp直播服务器搭建)
- Mac上搭建直播服务器Nginx+rtmp
- OSX安装nginx和rtmp模块(rtmp直播服务器搭建)
- 搭建直播服务器,使用nginx与nginx-rtmp-module搭建流媒体服务器;
- 搭建直播服务器,使用nginx与nginx-rtmp-module搭建流媒体服务器;
- [置顶] 利用Nginx—rtmp—moudle搭建直播服务器
- Mac上搭建直播服务器Nginx+rtmp
- Mac上搭建直播服务器Nginx+rtmp
- MacOS下hls/rtmp直播服务器搭建(包括推流)
- 树莓派使用nginx+rtmp搭建直播服务器
- nginx 搭建rtmp直播服务器
- OSX安装nginx和rtmp模块(rtmp直播服务器搭建)
- NGINX-RTMP直播服务器搭建-OBS录制推流-VLC视频流播放