how to run rtsp server as service on windows?
Windows services are a special class of programs that are configured to launch and run in the background, usually without any sort of user interface and without needing a user to log in to the PC.
The primary advantage of running an app as a service is that you can have a program start before a user to log in. That can be particularly important with apps that provide important services you want to be available when you leave way from your computer.
1: Install SrvStart
To get started, head over to the SrvStart download page and grab the utility.
2: Create a Configuration File for the New Service
Next, you'll want to create a configuration file that SrvStart will read to create the service.
Fire up Notepad and create your configuration file using the format below. Here, we are using rtspserver, but you can create a file for any program you want to run as a service. The startup command simply specifies the path where the executable file resides. For the shutdown_method command, we are using the winmessage parameter, which causes SrvStart to send a Windows close message to any windows opened by the service.
By default, Windows starts every service in C:\WINNT\SYSTEM32. Here we use startup_dir to specify another working folder.
[rtspserver]
startup="F:\happytimesoft\RtspStreamer\Release\RtspServer.exe"
startup_dir=F:\happytimesoft\RtspStreamer\Release
shutdown_method=winmessage
Obviously, adjust the path and name according to the program you are launching.
Save the new configuration file as rtspserver.ini
3: Use the Command Prompt to Create the New Service
Open Command Prompt by right-clicking the Start menu (or pressing Windows+X), choosing "command Prompt (Admin)" and then clicking Yes to allow it to run with administrative privileges.
At the Command Prompt, use the following syntax to create the new service:
srvstart install rtspserver -c D:\tools\srvstart-master\srvstart\rtspserver.ini
When you run the command, you should receive a SUCCESS message if everything goes well.
Open the Windows Services interface (just click Start and type "services", you can find and configure the new service just like you would any other.
4: Some other operational commands
delete the service:
srvstart remove rtspserver
start service:
net start rtspserver