[mirotalksfu] - add RTMP server and multi-source streaming!, update dep
هذا الالتزام موجود في:
61
rtmpServers/nginx-rtmp/Dockerfile
Normal file
61
rtmpServers/nginx-rtmp/Dockerfile
Normal file
@@ -0,0 +1,61 @@
|
||||
FROM buildpack-deps:bullseye
|
||||
|
||||
# Versions of Nginx and nginx-rtmp-module to use
|
||||
ENV NGINX_VERSION=1.24.0
|
||||
ENV NGINX_RTMP_MODULE_VERSION=1.2.2
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
openssl \
|
||||
libssl-dev \
|
||||
wget \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Download and decompress Nginx and RTMP module
|
||||
RUN mkdir -p /tmp/build && \
|
||||
cd /tmp/build && \
|
||||
wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
|
||||
tar -zxf nginx-${NGINX_VERSION}.tar.gz && \
|
||||
wget https://github.com/arut/nginx-rtmp-module/archive/v${NGINX_RTMP_MODULE_VERSION}.tar.gz && \
|
||||
tar -zxf v${NGINX_RTMP_MODULE_VERSION}.tar.gz
|
||||
|
||||
# Build and install Nginx with RTMP module
|
||||
RUN cd /tmp/build/nginx-${NGINX_VERSION} && \
|
||||
./configure \
|
||||
--sbin-path=/usr/local/sbin/nginx \
|
||||
--conf-path=/etc/nginx/nginx.conf \
|
||||
--error-log-path=/var/log/nginx/error.log \
|
||||
--pid-path=/var/run/nginx/nginx.pid \
|
||||
--lock-path=/var/lock/nginx/nginx.lock \
|
||||
--http-log-path=/var/log/nginx/access.log \
|
||||
--http-client-body-temp-path=/tmp/nginx-client-body \
|
||||
--with-http_ssl_module \
|
||||
--with-threads \
|
||||
--with-ipv6 \
|
||||
--add-module=/tmp/build/nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION} \
|
||||
--with-debug && \
|
||||
make -j $(getconf _NPROCESSORS_ONLN) && \
|
||||
make install && \
|
||||
mkdir /var/lock/nginx && \
|
||||
rm -rf /tmp/build
|
||||
|
||||
# Forward logs to Docker
|
||||
RUN ln -sf /dev/stdout /var/log/nginx/access.log && \
|
||||
ln -sf /dev/stderr /var/log/nginx/error.log
|
||||
|
||||
# ------------------------
|
||||
# FROM tiangolo/nginx-rtmp
|
||||
# ------------------------
|
||||
|
||||
# Copy nginx.conf with RTMP configuration and stat.xsl
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY stat.xsl /usr/share/nginx/html/stat.xsl
|
||||
|
||||
# Rtmp port
|
||||
EXPOSE 1935
|
||||
# Http port
|
||||
EXPOSE 8081
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
30
rtmpServers/nginx-rtmp/README.md
Normal file
30
rtmpServers/nginx-rtmp/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# RTMP Streaming
|
||||
|
||||

|
||||
|
||||
For running an `RTMP` (Real-Time Messaging Protocol) server in Docker, **Nginx with the RTMP module** is one of the best options. It is widely used for streaming video content due to its high performance and flexibility.
|
||||
|
||||
## Setting up Nginx with RTMP in Docker
|
||||
|
||||
```sh
|
||||
# Copy the docker.compose.yml
|
||||
$ cp docker-compose.template.yml docker-compose.yml
|
||||
|
||||
# Pull the official mirotalk rtmp image
|
||||
$ docker pull mirotalk/rtmp:latest
|
||||
|
||||
# Create and start containers
|
||||
$ docker-compose up -d
|
||||
|
||||
# Check the logs
|
||||
$ docker logs -f mirotalk-rtmp
|
||||
|
||||
# To stop and remove resources
|
||||
$ docker-compose down
|
||||
```
|
||||
|
||||
## Custom Configuration
|
||||
|
||||
Modify the `nginx.conf` to suit your specific needs, such as enabling recording, adding authentication, or configuring HLS (HTTP Live Streaming).
|
||||
|
||||
By using Nginx with the RTMP module in Docker, you can quickly and easily set up a robust RTMP server for live video streaming.
|
||||
14
rtmpServers/nginx-rtmp/docker-compose.template.yml
Normal file
14
rtmpServers/nginx-rtmp/docker-compose.template.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
mirotalk-rtmp:
|
||||
container_name: mirotalk-rtmp
|
||||
#image: tiangolo/nginx-rtmp
|
||||
image: mirotalk/rtmp:latest
|
||||
volumes:
|
||||
- ./nginx.conf/:/etc/nginx/nginx.conf/:ro
|
||||
- ./stat.xsl/:/usr/share/nginx/html/stat.xsl/:ro
|
||||
ports:
|
||||
- '1935:1935'
|
||||
- '8081:8081'
|
||||
restart: unless-stopped
|
||||
34
rtmpServers/nginx-rtmp/nginx.conf
Normal file
34
rtmpServers/nginx-rtmp/nginx.conf
Normal file
@@ -0,0 +1,34 @@
|
||||
worker_processes auto;
|
||||
|
||||
rtmp_auto_push on;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
rtmp {
|
||||
server {
|
||||
listen 1935;
|
||||
listen [::]:1935 ipv6only=on;
|
||||
|
||||
application live {
|
||||
live on;
|
||||
record off;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 8081;
|
||||
|
||||
location /stat {
|
||||
rtmp_stat all;
|
||||
rtmp_stat_stylesheet stat.xsl;
|
||||
}
|
||||
|
||||
location /stat.xsl {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
||||
30
rtmpServers/nginx-rtmp/stat.xsl
Normal file
30
rtmpServers/nginx-rtmp/stat.xsl
Normal file
@@ -0,0 +1,30 @@
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<body>
|
||||
<h1>RTMP Statistics</h1>
|
||||
<table border="none">
|
||||
<tr bgcolor="#9acd32">
|
||||
<th>Stream</th>
|
||||
<th>Bitrate (kbps)</th>
|
||||
<th>Bytes</th>
|
||||
<th>Client</th>
|
||||
<th>BW (kbps)</th>
|
||||
<th>Time</th>
|
||||
</tr>
|
||||
<xsl:for-each select="rtmp/server/application/live/">
|
||||
<tr>
|
||||
<td><xsl:value-of select="@name"/></td>
|
||||
<td><xsl:value-of select="bw_in_video"/></td>
|
||||
<td><xsl:value-of select="bytes"/></td>
|
||||
<td><xsl:value-of select="client_ip"/></td>
|
||||
<td><xsl:value-of select="bw_out_video"/></td>
|
||||
<td><xsl:value-of select="time"/></td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم