Work in progress, sorry

RTMP (Real Time Messaging Protocol) is a protocol for streaming audio, video and data over the Internet, between a Flash player and a server.

nginx-rtmp-module is an opensource implementation of RTMP server presented as nginx module. It is available as libnginx-mod-rtmp in stretch-backports.

This article explains how to manually build nginx with nginx-rtmp-module and start the simplest video streaming.

Building and installing

We will make a custom build of nginx package with nginx-rtmp-module and install it.

First get everything we will need for building and running

  # apt-get install build-essential devscripts ffmpeg
  # apt-get build-dep nginx

Then get nginx package source

  $ apt-get source nginx

Now, get latest nginx-rtmp-module release from https://github.com/arut/nginx-rtmp-module/releases, for me it is v1.1.2 and untar it.

$ wget https://github.com/arut/nginx-rtmp-module/archive/v1.1.2.tar.gz
$ tar xvzf v1.1.2.tar.gz

And put module code into the right place inside nginx build tree

$ mkdir nginx-1.2.1/debian/modules/nginx-rtmp-module
$ cp -r nginx-rtmp-module-1.1.2/*  nginx-1.2.1/debian/modules/nginx-rtmp-module

Then open file nginx-1.2.1/debian/rules and find section "config.status.full:". In the end of this section you will see list of of config options like this:

    --add-module=$(MODULESDIR)/nginx-auth-pam \
    --add-module=$(MODULESDIR)/nginx-echo \
    --add-module=$(MODULESDIR)/nginx-upstream-fair \
    --add-module=$(MODULESDIR)/nginx-dav-ext-module \ 

add to this list

  --add-module=$(MODULESDIR)/nginx-rtmp-module \

// If when you read this article rues file were completely rewritten just find a way it adds --add-module to the config options and add one for nginx-rtmp-module

and add the following lines to the nginx-1.2.1/debian/source/include-binaries file

debian/modules/nginx-rtmp-module/test/rtmp-publisher/RtmpPlayer.swf
debian/modules/nginx-rtmp-module/test/rtmp-publisher/RtmpPublisher.swf
debian/modules/nginx-rtmp-module/test/rtmp-publisher/RtmpPlayerLight.swf
debian/modules/nginx-rtmp-module/test/www/bg.jpg
debian/modules/nginx-rtmp-module/test/www/jwplayer_old/player.swf
debian/modules/nginx-rtmp-module/test/www/jwplayer/jwplayer.flash.swf

this will allow dev-script to include binary files form module without errors

Start building:

$ cd cd nginx-1.2.1; debuild 

and after that install built packages

# cd ..
# dpkg -i nginx-full_*.deb nginx-common_*.deb