minor updates.

This commit is contained in:
alf 2016-10-23 19:17:32 -07:00
parent fdcafae6ed
commit eff52a00de
3 changed files with 109 additions and 30 deletions

View File

@ -2,8 +2,8 @@ FROM alpine:latest
MAINTAINER Alfred Gutierrez <alf.g.jr@gmail.com> MAINTAINER Alfred Gutierrez <alf.g.jr@gmail.com>
ENV NGINX_VERSION 1.9.15 ENV NGINX_VERSION 1.9.15
ENV FFMPEG_VERSION 3.0.2
ENV NGINX_RTMP_VERSION 1.1.10 ENV NGINX_RTMP_VERSION 1.1.10
ENV FFMPEG_VERSION 3.0.2
EXPOSE 1935 EXPOSE 1935
EXPOSE 80 EXPOSE 80
@ -11,14 +11,14 @@ EXPOSE 80
RUN mkdir -p /opt/data && mkdir /www RUN mkdir -p /opt/data && mkdir /www
RUN apk update && apk add \ RUN apk update && apk add \
gcc binutils-libs binutils build-base libgcc make pkgconf pkgconfig \ gcc binutils-libs binutils build-base libgcc make pkgconf pkgconfig \
openssl openssl-dev ca-certificates pcre \ openssl openssl-dev ca-certificates pcre \
musl-dev libc-dev pcre-dev zlib-dev musl-dev libc-dev pcre-dev zlib-dev
# Get nginx source. # Get nginx source.
RUN cd /tmp && wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \ RUN cd /tmp && wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \
&& tar zxf nginx-${NGINX_VERSION}.tar.gz \ && tar zxf nginx-${NGINX_VERSION}.tar.gz \
&& rm nginx-${NGINX_VERSION}.tar.gz && rm nginx-${NGINX_VERSION}.tar.gz
# Get nginx-rtmp module. # Get nginx-rtmp module.
RUN cd /tmp && wget https://github.com/arut/nginx-rtmp-module/archive/v${NGINX_RTMP_VERSION}.tar.gz \ RUN cd /tmp && wget https://github.com/arut/nginx-rtmp-module/archive/v${NGINX_RTMP_VERSION}.tar.gz \
@ -44,28 +44,28 @@ RUN cd /tmp/ && wget http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz
# Compile ffmpeg. # Compile ffmpeg.
RUN cd /tmp/ffmpeg-${FFMPEG_VERSION} && \ RUN cd /tmp/ffmpeg-${FFMPEG_VERSION} && \
./configure \ ./configure \
--enable-version3 \ --enable-version3 \
--enable-gpl \ --enable-gpl \
--enable-nonfree \ --enable-nonfree \
--enable-small \ --enable-small \
--enable-libmp3lame \ --enable-libmp3lame \
--enable-libx264 \ --enable-libx264 \
--enable-libx265 \ --enable-libx265 \
--enable-libvpx \ --enable-libvpx \
--enable-libtheora \ --enable-libtheora \
--enable-libvorbis \ --enable-libvorbis \
--enable-libopus \ --enable-libopus \
--enable-libfdk-aac \ --enable-libfdk-aac \
--enable-libass \ --enable-libass \
--enable-libwebp \ --enable-libwebp \
--enable-librtmp \ --enable-librtmp \
--enable-postproc \ --enable-postproc \
--enable-avresample \ --enable-avresample \
--enable-libfreetype \ --enable-libfreetype \
--enable-openssl \ --enable-openssl \
--disable-debug \ --disable-debug \
&& make && make install && make distclean && make && make install && make distclean
RUN cd /opt/ && tar cvzf /tmp/nginx.tar.gz nginx RUN cd /opt/ && tar cvzf /tmp/nginx.tar.gz nginx

View File

@ -1 +1,80 @@
# docker-nginx-rtmp # docker-nginx-rtmp
A Dockerfile installing NGINX, nginx-rtmp-module and FFmpeg from source with
default settings for HLS live streaming. Built on Alpine Linux.
* Nginx 1.9.15 (compiled from source)
* nginx-rtmp-module 1.1.10 (compiled from source)
* ffmpeg 3.0.2 (compiled from source)
* Default HLS settings (See: [nginx.conf](nginx.conf))
## Usage
### Server
* Build and run container:
```
docker build -t nginx-rtmp .
docker run -it -p 1935:1935 -p 8080:80 --rm nginx-rtmp
```
* Stream live content to:
```
rtmp://<server ip>:1935/encoder/$STREAM_NAME
```
### OBS Configuration
* Stream Type: `Custom Streaming Server`
* URL: `rtmp://localhost:1935/live`
* Stream Key: `hello`
### Watch Stream
* In Safari, VLC or any HLS player, open:
```
http://<server ip>:8080/hls/$STREAM_NAME.m3u8
```
* Example: `http://localhost:8080/hls/hello`
### FFmpeg Build
```
ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.0 (Alpine 5.3.0)
configuration: --enable-version3 --enable-gpl --enable-nonfree --enable-small --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libtheora --enable-libvorbis --enable-libopus --enable-libfdk-aac --enable-libass --enable-libwebp --enable-librtmp --enable-postproc --enable-avresample --enable-libfreetype --enable-openssl --disable-debug
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
configuration:
--enable-version3
--enable-gpl
--enable-nonfree
--enable-small
--enable-libmp3lame
--enable-libx264
--enable-libx265
--enable-libvpx
--enable-libtheora
--enable-libvorbis
--enable-libopus
--enable-libfdk-aac
--enable-libass
--enable-libwebp
--enable-librtmp
--enable-postproc
--enable-avresample
--enable-libfreetype
--enable-openssl
--disable-debug
```
## Resources
* https://alpinelinux.org/
* http://nginx.org
* https://github.com/arut/nginx-rtmp-module
* https://www.ffmpeg.org
* https://obsproject.com

View File

@ -11,10 +11,10 @@ rtmp {
listen 1935; listen 1935;
chunk_size 4000; chunk_size 4000;
application encoder { application live {
live on; live on;
exec ffmpeg -i rtmp://localhost:1935/encoder/$name exec ffmpeg -i rtmp://localhost:1935/live/$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