Search code examples
ffmpegrtsp

Using ffmpeg to generate RTSP from webcam


I want to get the camera video stream and broadcast it with RTSP on Windows.

I can play the camera video with

> ffplay -f dshow -i "HP HD Webcam"

But if I try start the stream with

> ffmpeg -f rtsp -i video="HP HD Webcam" rtsp://localhost:8888/live.sdp

The stream does not start. The console shows

ffmpeg version ...
configuration: ...
libavutil      55.  6.100 / 55.  6.100
libavcodec     57. 15.100 / 57. 15.100
libavformat    57. 14.100 / 57. 14.100
libavdevice    57.  0.100 / 57.  0.100
libavfilter     6. 15.100 /  6. 15.100
libswscale      4.  0.100 /  4.  0.100
libswresample   2.  0.101 /  2.  0.101
libpostproc    54.  0.100 / 54.  0.100

And if I use ctrl+c to break it, an error shows

video=HP HD Webcam: Immediate exit requested

How can I properly stream the camera to RTSP with ffmpeg?


Solution

  • ffmpeg doesn't substitute a RTSP server, the rtsp is just a muxer/demuxer. When you use it for output it sends the stream with a RTSP ANNOUNCE. So you need a server which supports it running on 8888. The documentation mentions Darwin Streaming Server and revmischa/rtsp-server.