Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit efcdc76

Browse files
committed
feat(README): 修改README
1 parent feeae10 commit efcdc76

File tree

3 files changed

+380
-11
lines changed

3 files changed

+380
-11
lines changed

‎.github/workflows/docker-image.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
5757
5858
# Use Docker `latest` tag convention
59-
[ "$VERSION" == "master" ] && VERSION=latest
59+
# [ "$VERSION" == "master" ] && VERSION=latest
6060
6161
echo IMAGE_ID=$IMAGE_ID
6262
echo VERSION=$VERSION
@@ -70,3 +70,6 @@ jobs:
7070
docker buildx create --name multi-platform --use --platform linux/amd64,linux/arm64 --driver docker-container
7171
# 进行 push
7272
docker buildx build --platform linux/arm64,linux/arm64/v8,linux/ppc64le,linux/amd64,linux/386 -t $IMAGE_ID:$VERSION . --push
73+
if [[ $VERSION != *"ffmpeg"* ]]; then
74+
docker buildx build --platform linux/arm64,linux/arm64/v8,linux/ppc64le,linux/amd64,linux/386 -t $IMAGE_ID:latest . --push
75+
fi

‎README-zh.md‎

Lines changed: 188 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,211 @@
22
* @Description:
33
* @Author: LLiuHuan
44
* @Date: 2022年04月11日 16:30:02
5-
* @LastEditTime: 2024-07-11 15:15:36
5+
* @LastEditTime: 2024-09-05 09:49:19
66
* @LastEditors: LLiuHuan
77
-->
88
### 介绍
9-
> nginx-http-flv-module官方镜像是四年前的,因项目需要弄个最新版
9+
> nginx-http-flv-module官方镜像是N年前的,因项目需要弄个最新版
1010
1111
1. 本项目使用最新版 `nginx-http-flv-module` 目前版本为 `1.2.11`
1212
2. rtmp和http nginx 解析都为 stream,有需要可自行修改
1313

1414
### 使用
1515
1. 运行容器
16-
`docker run --name flv -p 31935:1935 -p 39000:9000 -itd lliuhuan/nginx-http-flv-module`
16+
```
17+
docker run --name flv -p 1935:1935 -p 8080:80 -itd lliuhuan/nginx-http-flv-module
18+
```
1719
2. 使用OBS或其他软件推送
1820
```
19-
Server: rtmp://127.0.0.1:31935/stream
21+
Server: rtmp://127.0.0.1:1935/stream
2022
Secret Key: t55
2123
```
2224
![image](./static/1.OBS.gif)
2325
3. 使用IINA或其他软件播放
24-
`http://127.0.0.1:39000/stream?app=stream&stream=t55`
26+
```
27+
http://127.0.0.1:8080/stream?app=stream&stream=t55
28+
```
2529
![image](./static/2.IINA.gif)
2630

31+
#### RTMP 方式
32+
33+
##### 推流
34+
```bash
35+
# 服务
36+
rtmp://127.0.0.1:1935/[app]
37+
# streamname
38+
t55
39+
```
40+
##### 播放
41+
```
42+
http://127.0.0.1:8080/stream?app=stream&stream=[streamname]
43+
```
44+
45+
#### HLS 方式
46+
##### 推流
47+
```bash
48+
# 服务
49+
rtmp://127.0.0.1:1935/hls
50+
# streamname
51+
t55
52+
```
53+
##### 播放
54+
```
55+
http://localhost:8080/hls/[streamname].m3u8
56+
```
57+
58+
#### DASH 方式
59+
##### 推流
60+
```bash
61+
# 服务
62+
rtmp://127.0.0.1:1935/dash
63+
# streamname
64+
t55
65+
```
66+
##### 播放
67+
```
68+
http://localhost:8080/dash/[streamname].mpd
69+
```
70+
71+
#### 监控
72+
```
73+
http://127.0.0.1:8080/stat
74+
```
75+
76+
### 默认Nginx配置
77+
```nginx
78+
user root;
79+
worker_processes 1; #运行在 Windows 上时,设置为 1,因为 Windows 不支持 Unix domain socket
80+
#worker_processes auto; #1.3.8 和 1.2.5 以及之后的版本
81+
82+
#worker_cpu_affinity 0001 0010 0100 1000; #只能用于 FreeBSD 和 Linux
83+
#worker_cpu_affinity auto; #1.9.10 以及之后的版本
84+
85+
error_log logs/error.log error;
86+
87+
#如果此模块被编译为动态模块并且要使用与 RTMP 相关的功
88+
#能时,必须指定下面的配置项并且它必须位于 events 配置
89+
#项之前,否则 NGINX 启动时不会加载此模块或者加载失败
90+
91+
#load_module modules/ngx_http_flv_live_module.so;
92+
93+
# error_log /var/log/nginx/error.log notice;
94+
# pid /var/run/nginx.pid;
95+
96+
events {
97+
worker_connections 4096; ## Default: 1024
98+
}
99+
100+
rtmp_auto_push on;
101+
rtmp_auto_push_reconnect 1s;
102+
rtmp_socket_dir /tmp;
103+
104+
rtmp {
105+
out_queue 4096;
106+
out_cork 8;
107+
max_streams 128;
108+
timeout 15s;
109+
drop_idle_publisher 15s;
110+
111+
log_interval 5s; #log 模块在 access.log 中记录日志的间隔时间,对调试非常有用
112+
log_size 1m; #log 模块用来记录日志的缓冲区大小
113+
114+
server {
115+
listen 1935; # 接受推流的端口号
116+
chunk_size 8192; # 单一推流数据包的最大容量?
117+
access_log off; # 加上这行,取消操作日志
118+
application stream { # mlive 模块,可以自行更换名字
119+
live on; # 打开直播
120+
meta off; # 为了兼容网页前端的 flv.js,设置为 off 可以避免报错
121+
gop_cache on; # 支持GOP缓存,以减少首屏时间 改为off 延迟较大
122+
allow play all; # 允许来自任何 ip 的人拉流
123+
}
124+
125+
application hls { # hls 模块,可以自行更换名字
126+
live on;
127+
hls on;
128+
hls_path /tmp/hls;
129+
}
130+
131+
application dash { # dash 模块,可以自行更换名字
132+
live on;
133+
dash on;
134+
dash_path /tmp/dash;
135+
}
136+
}
137+
}
138+
139+
http {
140+
include mime.types;
141+
default_type application/octet-stream;
142+
sendfile on;
143+
#tcp_nopush on;
144+
#keepalive_timeout 0;
145+
keepalive_timeout 65;
146+
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
147+
# '$status $body_bytes_sent "$http_referer" '
148+
# '"$http_user_agent" "$http_x_forwarded_for"';
149+
#access_log logs/access.log main;
150+
access_log off; # 加上这行,取消操作日志
151+
#gzip on;
152+
server {
153+
listen 80; # http 服务的端口
154+
# server_name localhost;
155+
location / {
156+
root html;
157+
index index.html index.htm;
158+
add_header 'Access-Control-Allow-Origin' '*'; # 允许跨域
159+
add_header 'Access-Control-Allow-Credentials' 'true';
160+
}
161+
162+
location /stream {
163+
flv_live on; # 打开 http-flv 服务
164+
chunked_transfer_encoding on; #支持 'Transfer-Encoding: chunked' 方式回复
165+
166+
add_header 'Access-Control-Allow-Origin' '*'; # 允许跨域
167+
add_header 'Access-Control-Allow-Credentials' 'true';
168+
}
169+
170+
location /hls { # hls 服务 根据需求修改
171+
types {
172+
application/vnd.apple.mpegurl m3u8;
173+
video/mp2t ts;
174+
}
175+
176+
root /tmp;
177+
add_header 'Cache-Control' 'no-cache';
178+
}
179+
180+
location /dash { # dash 服务 根据需求修改
181+
root /tmp;
182+
add_header 'Cache-Control' 'no-cache';
183+
}
184+
185+
location /stat { # 推流播放和录制统计数据的配置 根据需求确定是否开放
186+
rtmp_stat all;
187+
rtmp_stat_stylesheet stat.xsl;
188+
}
189+
190+
location /stat.xsl {
191+
root rtmp; #指定 stat.xsl 的位置
192+
}
193+
194+
#如果需要 JSON 风格的 stat, 不用指定 stat.xsl
195+
#但是需要指定一个新的配置项 rtmp_stat_format
196+
#location /stat {
197+
# rtmp_stat all;
198+
# rtmp_stat_format json;
199+
#}
200+
201+
location /control {
202+
rtmp_control all; #rtmp 控制模块的配置
203+
}
204+
}
205+
}
206+
207+
```
208+
209+
27210
### 通过工作流自动构建镜像
28211
当 push 标签为v* 时自动执行工作流,构建 Docker 镜像并上传到 Docker Hub
29212

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /