Created
July 15, 2020 22:04
-
-
Save james2doyle/74ca20cfb4df02a7bf24d4d17f9255d7 to your computer and use it in GitHub Desktop.
Use docker to showcase streaming with nginx rtmp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
web: | |
image: tiangolo/nginx-rtmp | |
volumes: | |
- ./nginx.conf:/etc/nginx/nginx.conf:ro | |
ports: | |
- "8080:80" | |
- "1935:1935" | |
environment: | |
- NGINX_HOST=docker.local | |
- NGINX_PORT=80 | |
# VLC: http://localhost:8080/hls/video.m3u8 | |
# stream: ffmpeg -re -i video.mp4 -vcodec copy -loop -1 -c:a aac -b:a 160k -ar 44100 -strict -2 -f flv rtmp://localhost/live/video |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes auto; | |
rtmp_auto_push on; | |
events { | |
worker_connections 1024; | |
} | |
rtmp { | |
server { | |
listen 1935; | |
listen [::]:1935 ipv6only=on; | |
chunk_size 4000; | |
application live { | |
live on; | |
record off; | |
interleave on; | |
hls on; | |
hls_path /usr/local/nginx/html/hls; | |
hls_fragment 15s; | |
} | |
} | |
} | |
http { | |
default_type application/octet-stream; | |
server { | |
listen 80; | |
location /tv { | |
root /usr/local/nginx/html/hls; | |
} | |
} | |
types { | |
application/vnd.apple.mpegurl m3u8; | |
video/mp2t ts; | |
text/html html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment