12

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.sdp

It 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.

1

1 Answer 1

11

FWIW, I was able to setup a local RTSP server for testing purposes using simple-rtsp-server and ffmpeg following these steps:

  1. Create a configuration file for the RTSP server called rtsp-simple-server.yml with this single line:
    protocols: [tcp]
    
  2. 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
    
  3. 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.stream

Note that simple-rtsp-server can also handle UDP streams (i.s.o. TCP) but that's tricky running the server as a Docker container.

3
  • 2
    Hours of Googling. HOURS. rtsp-simple-server was the first thing that actually worked to stream my iSight via ffmpeg with no errors, it just worked. Thanks!
    – John Smith
    Commented Nov 25, 2020 at 9:43
  • At this date, the simple-server running on docker now does not accept periods in the path name. It does not accept "live.stream" only "livestream"
    – WurmD
    Commented Dec 4, 2020 at 16:10
  • Why can nothing stream rtsp directly but instead needs an intermediatery server?
    – Managor
    Commented Jun 27, 2023 at 11:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .