前置
- vlc 软件
- ffmpeg
- nginx-full rtmp-moudle
效果
- 推流
- 拉流
安装nginx
// 先克隆到本地
brew tap denji/homebrew-nginx
// 在安装
brew install nginx-full --with-rtmp-module
// 修改配置
* /usr/local/etc/nginx/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /usr/local/var/www;
add_header Cache-Control no-cache;
}
}
}
rtmp {
server {
listen 1935;
application rtmplive {
live on;
max_connections 1024;
}
application hls{
live on;
hls on;
hls_path /usr/local/var/www/hls;
hls_fragment 1s;
}
}
}
### 启动服务
sudo brew services restart denji/nginx/nginx-full
### 检查服务是否启动
* http://localhost:8080/
![](/i/l/?n=24&i=blog/2697130/202402/2697130-20240220112500430-84741610.png)
### 直接推流rtmp
ffmpeg -re -i video1.mp4 -vcodec libx264 -vprofile baseline -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 rtmp://localhost:1935/rtmplive/demo
标签:application,vlc,hls,nginx,rtmp,拉流,推流,local
From: https://www.cnblogs.com/guanchaoguo/p/18022701