[This article is not finished yet]
RTMP is a proprietary protocol developed by Adobe (Macromedia) for use in flash player. Until 2009 it had no public specification. A number of third-party RTMP-related products started in that period were based on the results of reverse engineering. In 2009 RTMP specification has been published which made developing such applications easier. However the spec is not full and misses significant issues concerning streaming H264.
The module has been tested on Linux x86-family platforms. However it should work on FreeBSD too.
The module is distributed under BSD license.
Building is pretty obvious. Just cd to nginx source directory and configure nginx this way:
$ ./configure --add-module=/path/to/nginx-rtmp-module
Then make
and make install
.
Simple live application configuration:
application live {
live on;
}
You can add access list control:
application live {
live on;
allow publish 127.0.0.1;
deny publish all;
allow play all;
}
And you can add record support for live streams:
application live {
live on;
allow publish 127.0.0.1;
deny publish all;
allow play all;
record all;
record_path /path/to/record/dir;
record_max_size 100M;
record_unique off;
}
To watch RTMP stream in browser one should either develop flash application for that or use one of available flash players. The most popular players which are proved to have no problems with the module are:
Old versions of JWPlayer (<=4.4) supported capturing video from webcam. You can find that version in test/ subdirectory. However audio is not captured by this version of player. Recent free versions of JWPlayer have no capture capability at all.
You can use exec directive and ffmpeg for transcoding streams. For example:
application big {
live on;
exec /usr/bin/ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec flv -acodec copy -s 32x32 -f flv rtmp://localhost:1935/small/${name};
}
application small {
live on;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。