Converting RTMP to RTSP in NGINX

grijalvaromero picture grijalvaromero · Feb 19, 2015 · Viewed 23.1k times · Source

I have a question, if I use nginx for RTMP stream, can this function to stream video with RTSP?

What are the differences between RTSP and RTMP? Can I use my RTMP server to stream with the RTSP protocol?

Sorry for my English.

Answer

moonsly picture moonsly · Aug 2, 2015

Using nginx-rtmp, you still can add on-the-fly encoding of your RTMP stream to RTSP using ffmpeg. Example of the config:

rtmp {
   access_log /var/log/nginx/rtmp_access.log;
   server {
       listen 1935;
       ping 30s;
       notify_method get;
       application camera1 {
           live on;
           exec_pull ffmpeg -i rtsp://admin:[email protected]/axis-media/media.amp -threads 2 -f flv -r 25 -s 1280x720 -an rtmp://localhost:1935/cam1/stream 2>>/var/log/nginx/ffmpeg.log;
       }
   }
}