ptrevolution_streaming/README.md

102 lines
3.5 KiB
Markdown
Raw Normal View History

2016-10-24 03:49:28 +02:00
# docker-nginx-rtmp
2016-10-24 04:17:32 +02:00
A Dockerfile installing NGINX, nginx-rtmp-module and FFmpeg from source with
default settings for HLS live streaming. Built on Alpine Linux.
2018-11-11 05:26:54 +01:00
* Nginx 1.14.1 (compiled from source)
* nginx-rtmp-module 1.2.1 (compiled from source)
2018-11-11 05:26:54 +01:00
* ffmpeg 4.1 (compiled from source)
2016-10-24 04:17:32 +02:00
* Default HLS settings (See: [nginx.conf](nginx.conf))
2016-11-23 22:55:17 +01:00
[![Docker Stars](https://img.shields.io/docker/stars/alfg/nginx-rtmp.svg)](https://hub.docker.com/r/alfg/nginx-rtmp/)
[![Docker Pulls](https://img.shields.io/docker/pulls/alfg/nginx-rtmp.svg)](https://hub.docker.com/r/alfg/nginx-rtmp/)
[![Docker Automated build](https://img.shields.io/docker/automated/alfg/nginx-rtmp.svg)](https://hub.docker.com/r/alfg/nginx-rtmp/builds/)
2016-10-24 05:07:57 +02:00
[![Build Status](https://travis-ci.org/alfg/docker-nginx-rtmp.svg?branch=master)](https://travis-ci.org/alfg/docker-nginx-rtmp)
2016-10-24 05:03:08 +02:00
2016-10-24 04:17:32 +02:00
## Usage
### Server
2016-11-23 22:55:17 +01:00
* Pull docker image and run:
```
docker pull alfg/nginx-rtmp
2017-01-16 00:35:00 +01:00
docker run -it -p 1935:1935 -p 8080:80 --rm alfg/nginx-rtmp
2016-11-23 22:55:17 +01:00
```
or
* Build and run container from source:
2016-10-24 04:17:32 +02:00
```
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/stream/$STREAM_NAME
2016-10-24 04:17:32 +02:00
```
### SSL
The `nginx.conf` is configured for both HTTP and HTTPS using a self-signed certificate supplied in [/certs](/certs). If you wish to use HTTPS, it is **highly recommended** to obtain your own certificates and update the `ssl_certificate` and `ssl_certificate_key` paths in [nginx.conf](nginx.conf).
I recommend using [Certbot](https://certbot.eff.org/docs/install.html) from [Let's Encrypt](https://letsencrypt.org).
2016-10-24 04:17:32 +02:00
### OBS Configuration
* Stream Type: `Custom Streaming Server`
* URL: `rtmp://localhost:1935/stream`
2016-10-24 04:17:32 +02:00
* Stream Key: `hello`
### Watch Stream
* In Safari, VLC or any HLS player, open:
```
http://<server ip>:8080/live/$STREAM_NAME.m3u8
2016-10-24 04:17:32 +02:00
```
* Example: `http://localhost:8080/live/hello`
2016-10-24 04:17:32 +02:00
### FFmpeg Build
```
2018-11-11 05:26:54 +01:00
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.4.0 (Alpine 6.4.0)
configuration: --prefix=/usr/local --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 --disable-doc --disable-ffplay --extra-libs='-lpthread -lm'
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
2016-10-24 04:17:32 +02:00
configuration:
2018-11-11 05:26:54 +01:00
--prefix=/usr/local
2016-10-24 04:17:32 +02:00
--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
2018-11-11 05:26:54 +01:00
--disable-doc
--disable-ffplay
--extra-libs='-lpthread -lm'
2016-10-24 04:17:32 +02:00
```
## Resources
* https://alpinelinux.org/
* http://nginx.org
* https://github.com/arut/nginx-rtmp-module
* https://www.ffmpeg.org
* https://obsproject.com