Reputation: 607
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.
Upvotes: 11
Views: 29550
Reputation: 1010
Some happy update here, new answer is...
...BUT I'm not sure that you can do it with nginx though.
I managed to do it with kerberos.io fork of rtsp-simple-server. It is fork of this rtsp-simple-server, which is fork of mediamtx hehe.
So I was able to connect my old Yi Action 4k camera to kerberos.io. And now I'm using it as a video baby monitor!
Nevertheless I've only tried kerberos.io version. Once you launched it, it launches RTMP, RTSP and some other servers. Here's my configuration:
# Enable (explicitly) support for the RTMP protocol.
rtmpDisable: no
# Address of the RTMP listener. This is needed only when encryption is "no" or "optional".
rtmpAddress: :1935
# Encrypt connections with TLS (RTMPS).
# Available values are "no", "strict", "optional".
rtmpEncryption: "no"
paths:
live:
runOnDemand: ffmpeg -i rtmp://localhost/live \
-c:v copy -c:a aac -f rtsp rtsp://0.0.0.0:$RTSP_PORT/$RTSP_PATH
runOnDemandRestart: yes
I saved it to cam.yaml and then launched docker (actually I use docker-compose, and now I'm converting it to docker run
version, let me know if it doesn't work):
docker run -d -p 1935:1935 -p 8554:8554 -v <path to your cam.yaml>:/rtsp-simple-server.yml kerberos/rtsp-simple-server:latest
Note if you want to enable HTTP broadcast, also pass -p 8888:8888
(so you can watch it on http://your-ip:8888/live)
Here 'live' is a suffix of your RTMP and RTSP urls.
So, once you launch it, you can connect your cameras to rtmp://<your-server-ip>/live
Once again, actually it is not only RTSP it rebroadcasts to, but also http and some other protocols.
Upvotes: 0
Reputation: 8965
This is an old question but I want to clarify some concepts for future visitors.
I have a question, if I use
nginx
for RTMP stream, can this function to stream video with RTSP?
The answer is NO. Your nginx
server will stream using the RTMP protocol. What you can do is: Receive a stream from a RTSP protocol and convert it into a RTMP protocol using ffmpeg
.
What are the differences between RTSP and RTMP? Can I use my RTMP server to stream with the RTSP protocol?
The main difference is that they are different protocols. It is like talking about UDP and TCP. U can't send data using UDP and receive it using TCP. What you can do is send data using UDP receive it using UDP and the re-send it using TCP. So that is what we gonna do here.
Upvotes: 0
Reputation: 612
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;
}
}
}
Upvotes: -1
Reputation: 18
RTMP - proprietary protocol from Adobe, RTSP is open standard from IETF. They are not compatible with each other.
Upvotes: -9