mpromonet / v4l2rtspserver

RTSP Server for V4L2 device capture supporting HEVC/H264/JPEG/VP8/VP9
The Unlicense
1.83k stars 423 forks source link

Stop and start the stream at will #203

Open dipendra77 opened 3 years ago

dipendra77 commented 3 years ago

How do I stop and start an rtsp stream at will on raspberry Pi ? I am able to stream using the command line script, but I have a use case where I want to start and stop the rtsp stream from my python script running on the pi when I want. How do I achieve that ?
I am very new to this. ANy help or suggestion would be appreciated.

Thank you in advance.

edefranco commented 3 years ago

A simple way can be call a bash script that get the v4l2rtspserver pid (ps -e | grep v4l2rtspserver | awk '{print $1}' and kill it ...

mpromonet commented 3 years ago

Hi,

There is a systemd script to start as a deamon. So you can use systemctl start v4l2rtspserver to start and systemctl stop v4l2rtspserver to stop it.

Using snap distribution allow to control start & stop using snap start/stop v4l2-rtspserver

Best Regards Michel

jshep321 commented 2 years ago

Another method is: pkill v4l2rtspserver will kill the process (by name). Use pkill with caution.

v4l2rtspserver will restart.

I simply added the following line to my user cron (crontab -e) to start at boot. @reboot /usr/local/bin/v4l2rtspserver