MacOS|MacOS 10.15 安装nginx+rtmp 推流接流 以及 错误记录
1.下载
mkdir nginx_rtmp
wget http://nginx.org/download/nginx-1.15.3.tar.gz
tar -zxvf nginx-1.15.3.tar.gz
git clone https://github.com/arut/nginx-rtmp-module
2. makefile生成 若没有则安装openssl。
--prefix是你的nginx的安装目录,注意修改成你自己的用户名。
将git clone的模块加入。
并指出openssl的地址(无需修改)。这一步似乎大家都需要,mac没有自己找到这个库。
brew install openssl
cd nginx-1.15.3
./configure --prefix=/Users/{your username}/nginx --with-http_ssl_module --add-module=../nginx-rtmp-module --with-openssl=/usr/local/opt/openssl@1.1
若生成成功,则会显示这样的summary
Configuration summary
+ using system PCRE library
+ using OpenSSL library: /usr/local/opt/openssl@1.1
+ using system zlib librarynginx path prefix: "/Users/ray/nginx"
nginx binary file: "/Users/ray/nginx/sbin/nginx"
nginx modules path: "/Users/ray/nginx/modules"
nginx configuration prefix: "/Users/ray/nginx/conf"
nginx configuration file: "/Users/ray/nginx/conf/nginx.conf"
nginx pid file: "/Users/ray/nginx/logs/nginx.pid"
nginx error log file: "/Users/ray/nginx/logs/error.log"
nginx http access log file: "/Users/ray/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
3. make & make install 直接make会报错:
make -j8
...
...
...
/Library/Developer/CommandLineTools/usr/bin/make -f objs/Makefile
cd /usr/local/opt/openssl@1.1 \
&& if [ -f Makefile ];
then /Library/Developer/CommandLineTools/usr/bin/make clean;
fi \
&& ./config --prefix=/usr/local/opt/openssl@1.1/.openssl no-shared no-threads\
&& /Library/Developer/CommandLineTools/usr/bin/make \
&& /Library/Developer/CommandLineTools/usr/bin/make install_sw LIBDIR=lib
/bin/sh: ./config: No such file or directory
make[1]: *** [/usr/local/opt/openssl@1.1/.openssl/include/openssl/ssl.h] Error 127
make: *** [build] Error 2
【MacOS|MacOS 10.15 安装nginx+rtmp 推流接流 以及 错误记录】需要修改
sudo vim ./auto/lib/openssl/conf
把下面的几行中的.openssl去掉,然后保存
39CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
40CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
41CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
42CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
改成
39CORE_INCS="$CORE_INCS $OPENSSL/include"
40CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
41CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
42CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"
此时,需要重新执行第二步configure,再make成功。
最后:
make install
4. 启动服务
cd /Users/{your username}/nginx
sudo vim conf/nginx.conf
将下面的rtmp服务添加在最后(其中rtmplive可以自命名)
rtmp {
server {
listen 1935;
application rtmplive {
live on;
}
}
}
然后启动服务
./sbin/nginx -c ./conf/nginx.conf
5. 测试
ffmpeg -re -i test.mp4 -vcodec libx264 -acodec aac -f flv rtmp://localhost:1935/rtmplive/homeffplay -i. rtmp://localhost:1935/rtmplive/home
此时就能看到你推流的视频啦~
6. References MAC上编译安装nginx-rtmp-module流媒体服务器
推荐阅读
- Mac安装Chromedriver
- MongoDB,Wondows下免安装版|MongoDB,Wondows下免安装版 (简化版操作)
- MAC安装Mongo
- 【Hadoop踩雷】Mac下安装Hadoop3以及Java版本问题
- react|react 安装
- VueX--VUE核心插件
- python-安装sublime遇到异常
- typeScript入门基础介绍
- 监控nginx
- 使用homeBrew|使用homeBrew 安装Goland