So I have been able to successfully send an RTP video stream from my server to the client on another system on the LAN and play it using ffplay. I now want to send the video on the same network using RTSP so that the client can receive the video and can have additional options like pausing the video etc. Can anyone give me a general guideline or point me to a resource that can help me in accomplishing my task?
UPDATE:
I have tried these commands:
ffmpeg -re -i input -f rtsp -rtsp_transport tcp rtsp://localhost:8888/live.sdp
ffplay -rtsp_flags listen rtsp://localhost:8888/live.sdpIt does start streaming the video in real-time but I don't actually see any options to control the media stream like playback, record etc!
NB: The .sdp file I am currently using for RTSP is the same as the one I used for RTP streaming.
11 Answer
FWIW, I was able to setup a local RTSP server for testing purposes using simple-rtsp-server and ffmpeg following these steps:
- Create a configuration file for the RTSP server called
rtsp-simple-server.ymlwith this single line:protocols: [tcp] - Start the RTSP server as a Docker container:
$ docker run --rm -it -v $PWD/rtsp-simple-server.yml:/rtsp-simple-server.yml -p 8554:8554 aler9/rtsp-simple-server - Use ffmpeg to stream a video file (looping forever) to the server:
$ ffmpeg -re -stream_loop -1 -i test.mp4 -f rtsp -rtsp_transport tcp rtsp://localhost:8554/live.stream
Once you have that running you can use ffplay to view the stream:
$ ffplay -rtsp_transport tcp rtsp://localhost:8554/live.streamNote that simple-rtsp-server can also handle UDP streams (i.s.o. TCP) but that's tricky running the server as a Docker container.
2