RTMP Server
Prepare client:
1) Download flash to use on web pages:
https://github.com/Stupeflix/WebcamRecorder
2) When you include flash to web-page set frames variable to set framerate.
Prepare server:
1) Get RTMP module for NGINX
git clone https://github.com/arut/nginx-rtmp-module.git
2) Get nginx source files and compile it with module:
sudo apt-get source nginx
sudo ./configure --add-module=/home/x/tems/nginx-rtmp-module/ --with-debug
sudo make
sudo make install
3) add next config to /usr/local/nginx/conf/nginx.conf:
worker_processes 1;
rtmp_auto_push on;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
wait_key on;
wait_video on;
# приложение записывает видео на сервер
application webcamrec {
live on;
record all;
wait_key on;
wait_video on;
interleave on;
record_path /home/x/tmp;
record_append on;
record_max_size 1024M;
}
....
}
4) Check http port to exclude conflicts with other services.
5) run nginx:
sudo ./nginx
Check results:
1) Download ffmpeg from https://www.ffmpeg.org/ for you OS:
wget http://johnvansickle.com/ffmpeg/releases/ffmpeg-2.5-64bit-static.tar.xz
tar xvf ffmpeg-2.5-64bit-static.tar.xz
Test result:
sudo /home/x/Загрузки/123/ffmpeg-2.5-64bit-static/ffmpeg -i rtsp://streamrural.cmd.com.ar:554/liverural/crural/rural1 -an -f flv -qscale 8 rtmp://localhost:1935/webcamrec/cnncam-`/bin/date +\%Y-\%m-\%d-\%H-\%M`
where -i rtsp://... is a address of ip webcam and -qscale rtmp://localhost/... is a service to translate video
---
https://github.com/arut/nginx-rtmp-module/tree/flv-header-mask
ffmpeg -re -i /home/x/www/y/public/media/upload/files/video/pdd/pdd.mp4 -c:v flv -c:a nellymoser -ar 44100 -ac 1 -f flv rtmp://localhost:1935/myapp/mystream