The server scans the list of current clients for a camera with the same id. If there is already a video stream for this camera, it connects a new client to this channel. If there is no stream for this camera, the server requests information about the camera in the mysql database. The camera information contains a list of streams supported by the camera, credentials for access. Among the streams, a stream is selected that fits the best way for the one that is requested by the client. Streaming begins. The streaming stops when the connection is closed.
Types of streams:
JPG - the server requests the image with the frequency specified by the client, scales it and sends it to the client;
MJPG - the server retranslates the stream to the client;
H264 - the server uses ffmpeg to decompress the image, scale it and forward it to the client. It might be necessary to take into consideration that in reality it can be h265;
MPEG4 - the server uses ffmpeg to decompress the image, scale it and forward it to the client.
Output format: multipart/x-mixed-replace
Command line parameters:
txmjpeg -port port -log log_dir -limit max_num_clients
port - a port, which it is necessary to listen for connection requests on;
log_dir - a folder for logs; max_num_clients - a maximum number of clients. When exceeding the number of clients, we disconnect the client, who has joined before everyone else.
It should be taken into account that streams may be inaccessible at certain time periods. Connection may be temporarily interrupted. When such errors occur, the server should re-request the stream after a short delay. For each stream, which is currently broadcasted, there should be a log. It should contain information about addition and removal of clients, parameters of the broadcasted stream, connection errors, and statistics should be reported from time to time (total broadcast time, total data size, fps).
Libraries: stl, ffmpeg
Code style: a candidate will be provided with a document describing the settings requirements
February 6, 2018
I am willing to pay higher rates for the most experienced freelancers