目录:
RTMP(一)录屏直播理论入门 
RTMP(二)搭建推流服务
RTMP (三)音视频采集与数据封包
RTMP(四)交叉编译与CameraX
RTMP (五)摄像头数据处理
RTMP (六)音视频编码推流
mac + nginx + rtmp 模块
- brew tap denji/nginx 
- brew install nginx-full --with-rtmp-module 
- 配置 
接下来配置config,在 /usr/local/etc/nginx 下的nginx.conf
添加rtmp
rtmp {
    server {
        listen 1935;
        ping 30s;
        notify_method get;
        application myapp {
            live on;
            record off;
            #丢弃闲置5s的连接 
            drop_idle_publisher 5s;
            max_connections 1024;
        }
    #增加对HLS支持开始
    application hls {
        live on;
        hls on;
        hls_path /usr/local/var/www/hls;
        hls_fragment 5s;
    }
    #增加对HLS支持结束
    }
}
下载模块并解压
解压的到 nginx-rtmp-module-1.2.1
配置
server {
        listen       8080;
        server_name  localhost;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
         #...................
        #添加的部分
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }
        location /stat.xsl {
            #为nginx-rtmp-module解压的地址
            #root /usr/local/live/nginx-rtmp-module-master/;
            root /xxxx/dev/server_workspace/nginx-rtmp-module-1.2.1;
        }
        #...................
        location / {
            root   html;
            index  index.html index.htm;
        }
省略后面默认的。。。。
}
- 测试启动
nginx 启动
ngix -s reload 重启
nginx -s stop 停止
注意点
其实就是从 nginx-rtmp-module-1.2.1/test/nginx.conf 中拷贝。
端口占用检查: lsof -i:8080 需要注意的是目录与端口是否被占用,比如8080端口被占用,可以改为了8081,然后需要开放端口。
 如果使用的阿里云服务器可以进入阿里云控制台开放
- 测试 
 ip:8080/stat
- 推流测试 
https://obsproject.com/welcome
先用Obs测试
在OBS 推流软件设置
地址: rtmp://ip:1935/myapp
秘钥:abc
成功后会有记录

然后用vlc输入播放的流地址











