gitmyhub

nginx-rtmp-module

C ★ 14k updated 1y ago

NGINX-based Media Streaming Server

nginx-rtmp-module plugs live and on-demand video streaming into NGINX, supporting RTMP ingest and HLS or MPEG-DASH delivery so you can self-host a streaming server without third-party services.

CNGINXFFmpegRTMPHLSMPEG-DASHsetup: hardcomplexity 4/5

This project, called nginx-rtmp-module, adds live and on-demand video streaming to NGINX. NGINX is a widely used piece of web server software, and a module like this one plugs extra abilities into it. Once added, NGINX can take in a live video feed, hand it out to viewers, and serve recorded video files. The code is written in C.

The README lists what it can do. It handles live streaming over three common methods named RTMP, HLS, and MPEG-DASH, the last two of which are designed to play on phones and in browsers. It can serve video on demand from files stored on the machine, relay streams between servers so the load can be spread out, and record incoming streams to disk. It supports the H264 video and AAC audio formats, can convert video on the fly using a separate tool called FFmpeg, and can call out to your own web addresses when events happen, such as someone starting or stopping a broadcast. It also exposes usage statistics and runs on Linux, FreeBSD, macOS, and Windows, though the README notes several features are not available on Windows.

Installing it is part of building NGINX itself. The README shows the commands: from the NGINX source folder you run its configure step while pointing at this module, then compile and install. There are notes for adding SSL support on certain NGINX versions and for building a debug version.

Most of the README is a large example configuration file that demonstrates the features in practice. The samples show a broadcast setup with one publisher and many viewers, recording the first part of a stream, restricting who can publish, running FFmpeg to shrink a video's resolution, pulling a webcam feed, pushing streams to other machines, serving stored files, and producing HLS and MPEG-DASH output into temporary folders. A final section shows how to read the streaming statistics over plain HTTP.

Where it fits