I wanted to quickly publish an RTSP video stream from a webcam on Linux without having to work with the complexity of sources and layers in OBS Studio. I found this neat software RtspSimpleServer downloadable from https://github.com/aler9/rtsp-simple-server.
For my testing purposes using just the default parameters, I did the following:
Install and run RtspSimpleServer
- Using a browser, download and extract the RtspSimpleServer binary from the github repo https://github.com/aler9/rtsp-simple-server into a folder, e.g. /path/to/rtsp/
The files rtsp-simple-server and the rtsp-simple-server.yml are extracted out into a directory /path/to/rtsp/. - Open up a Terminal. At the prompt, type in the cd command to change to the directory of the rtsp-simple-server.
$ cd /path/to/rtsp/ - At the prompt, run the rtsp-simple-server server:
$ ./rtsp-simple-server
Process messages appear to show the server is running.
Publish a video stream
- Optional. If the video for linux utils are not installed, then run the apt command to install it.
$ sudo apt install v4l-utils - Open up a new Terminal. Type in the ffmpeg command to publish the stream from the webcam device (assuming /dev/video0).
$ ffmpeg \
-f v4l2 \
-framerate 90 \
-re -stream_loop -1 \
-video_size 640x320 \
-input_format mjpeg \
-i /dev/video0 \
-c copy \
-f rtsp \
rtsp://localhost:8554/mystream
Processing messages appear.
Open the stream with a VLC client