Update nginx url naming convention. Add alias.

This commit is contained in:
alf 2016-11-05 20:58:21 -07:00
parent 9ad4590724
commit 5c76430142
2 changed files with 16 additions and 6 deletions

View File

@ -23,20 +23,20 @@ docker run -it -p 1935:1935 -p 8080:80 --rm nginx-rtmp
* Stream live content to: * Stream live content to:
``` ```
rtmp://<server ip>:1935/encoder/$STREAM_NAME rtmp://<server ip>:1935/stream/$STREAM_NAME
``` ```
### OBS Configuration ### OBS Configuration
* Stream Type: `Custom Streaming Server` * Stream Type: `Custom Streaming Server`
* URL: `rtmp://localhost:1935/live` * URL: `rtmp://localhost:1935/stream`
* Stream Key: `hello` * Stream Key: `hello`
### Watch Stream ### Watch Stream
* In Safari, VLC or any HLS player, open: * In Safari, VLC or any HLS player, open:
``` ```
http://<server ip>:8080/hls/$STREAM_NAME.m3u8 http://<server ip>:8080/live/$STREAM_NAME.m3u8
``` ```
* Example: `http://localhost:8080/hls/hello` * Example: `http://localhost:8080/live/hello`
### FFmpeg Build ### FFmpeg Build

View File

@ -11,10 +11,10 @@ rtmp {
listen 1935; listen 1935;
chunk_size 4000; chunk_size 4000;
application live { application stream {
live on; live on;
exec ffmpeg -i rtmp://localhost:1935/live/$name exec ffmpeg -i rtmp://localhost:1935/stream/$name
-c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 2500k -f flv -g 30 -r 30 -s 1280x720 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_720p2628kbs -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 2500k -f flv -g 30 -r 30 -s 1280x720 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_720p2628kbs
-c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 1000k -f flv -g 30 -r 30 -s 854x480 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_480p1128kbs -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 1000k -f flv -g 30 -r 30 -s 854x480 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_480p1128kbs
-c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 750k -f flv -g 30 -r 30 -s 640x360 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_360p878kbs -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 750k -f flv -g 30 -r 30 -s 640x360 -preset superfast -profile:v baseline rtmp://localhost:1935/hls/$name_360p878kbs
@ -53,6 +53,16 @@ http {
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
} }
location /live {
alias /opt/data/hls;
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
location /stat { location /stat {
rtmp_stat all; rtmp_stat all;
rtmp_stat_stylesheet static/stat.xsl; rtmp_stat_stylesheet static/stat.xsl;