1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-20 22:08:39 +00:00

update rtmp-server

This commit is contained in:
kev 2016-07-04 00:07:38 +08:00
parent c439e3c4ce
commit 89e0d7a001
6 changed files with 62 additions and 147 deletions

@ -10,29 +10,18 @@ rtmp
~/fig/rtmp/
├── data/
│ └── video.mp4
├── docker-compose.yml
├── html
│   ├── img
│   │   └── cctv.jpg
│   ├── index.html
│   └── js
│   ├── jquery.min.js
│   ├── jwplayer.flash.swf
│   └── jwplayer.js
└── nginx/
└── nginx.conf
└── docker-compose.yml
```
## docker-compose.yml
```yaml
server:
image: vimagick/nginx
image: vimagick/rtmp-server
ports:
- "1935:1935"
- "9999:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./data:/data
restart: always
@ -64,7 +53,7 @@ $ vlc rtmp://easypi.info/vod/video.mp4
# play local video (local -> remote -> local)
$ ffmpeg -re -i video.mp4 -f flv rtmp://easypi.info/live/video
$ vlc rtmp://easypi.info/live/video.mp4
$ vlc rtmp://easypi.info/live/video
# capture desktop (local -> remote)
$ ffmpeg -f avfoundation -pixel_format bgr0 -i 1:0 -f flv rtmp://easypi.info/live/webcam
@ -80,6 +69,9 @@ $ /opt/vc/bin/raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25 | ffmpeg -i - -f flv
# watch webcam (remote -> local)
$ vlc rtmp://easypi.info/live/webcam
# watch webcam (remote -> local)
$ firefox http://easypi.info:9999/
```
Optinally, you can run a docker container as RTMP client on raspberry pi.

15
rtmp/server/Dockerfile Normal file

@ -0,0 +1,15 @@
#
# Dockerfile for rtmp-server
#
FROM alpine
MAINTAINER kev <noreply@easypi.info>
RUN apk add --no-cache nginx-rtmp
COPY nginx.conf /etc/nginx/nginx.conf
COPY html /var/lib/nginx/html
EXPOSE 80 1935
CMD ["nginx", "-g", "daemon off;"]

@ -1 +1,2 @@
PLEASE PUT VIDEO FILES HERE
PUT VIDEO FILES HERE
====================

@ -1,10 +1,8 @@
server:
image: vimagick/nginx
image: vimagick/rtmp-server
ports:
- "1935:1935"
- "9999:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./data:/data
- ./html:/usr/share/nginx/html
restart: always

38
rtmp/server/nginx.conf Normal file

@ -0,0 +1,38 @@
user nginx;
worker_processes 1;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
rtmp {
server {
listen 1935;
application live {
live on;
}
application vod {
play /data;
}
}
}

@ -1,129 +0,0 @@
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
rtmp {
server {
listen 1935;
application live {
live on;
}
application vod {
play /data;
}
}
}